summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2011-09-19 13:12:23 (GMT)
committerÉric Araujo <merwok@netwok.org>2011-09-19 13:12:23 (GMT)
commit505f0ebf8839cc0a44d06b2cef96a20e5e693e74 (patch)
tree18108900184fe11ad7b036bf4bd2b06de5302b75 /Lib
parentc1b7e7f8bbcae936a5e75277e9e86d9ebec5469f (diff)
downloadcpython-505f0ebf8839cc0a44d06b2cef96a20e5e693e74.zip
cpython-505f0ebf8839cc0a44d06b2cef96a20e5e693e74.tar.gz
cpython-505f0ebf8839cc0a44d06b2cef96a20e5e693e74.tar.bz2
Final bag of small changes coming from distutils2.
- minor cleanup in Metadata - trigger creation of the sysconfig._CONFIG_VARS dict - home_page is used over home-page: it’s not a compound word, it’s an escaped space Distutils2 is now synchronized with Packaging.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/packaging/command/bdist_dumb.py4
-rw-r--r--Lib/packaging/compat.py8
-rw-r--r--Lib/packaging/metadata.py7
-rw-r--r--Lib/packaging/pypi/simple.py7
-rw-r--r--Lib/packaging/tests/test_command_bdist_dumb.py2
-rw-r--r--Lib/packaging/tests/test_command_build_ext.py11
-rw-r--r--Lib/packaging/tests/test_command_register.py2
-rw-r--r--Lib/packaging/tests/test_dist.py6
-rw-r--r--Lib/packaging/tests/test_metadata.py4
9 files changed, 22 insertions, 29 deletions
diff --git a/Lib/packaging/command/bdist_dumb.py b/Lib/packaging/command/bdist_dumb.py
index d5773f0..309f64f 100644
--- a/Lib/packaging/command/bdist_dumb.py
+++ b/Lib/packaging/command/bdist_dumb.py
@@ -5,9 +5,9 @@ sys.prefix or sys.exec_prefix.
"""
import os
-
from shutil import rmtree
from sysconfig import get_python_version
+
from packaging.util import get_platform
from packaging.command.cmd import Command
from packaging.errors import PackagingPlatformError
@@ -24,7 +24,7 @@ class bdist_dumb(Command):
"platform name to embed in generated filenames "
"(default: %s)" % get_platform()),
('format=', 'f',
- "archive format to create (tar, gztar, zip)"),
+ "archive format to create (tar, gztar, bztar, zip)"),
('keep-temp', 'k',
"keep the pseudo-installation tree around after " +
"creating the distribution archive"),
diff --git a/Lib/packaging/compat.py b/Lib/packaging/compat.py
index a82efd3..dcb58f5 100644
--- a/Lib/packaging/compat.py
+++ b/Lib/packaging/compat.py
@@ -1,8 +1,4 @@
-"""Compatibility helpers.
-
-This module provides classes, variables and imports which are used to
-support packaging across Python 2.x and 3.x.
-"""
+"""Compatibility helpers."""
from packaging import logger
@@ -10,8 +6,6 @@ from packaging import logger
# XXX Having two classes with the same name is not a good thing.
# XXX 2to3-related code should move from util to this module
-# TODO Move common code here: PY3 (bool indicating if we're on 3.x), any, etc.
-
try:
from packaging.util import Mixin2to3 as _Mixin2to3
_CONVERT = True
diff --git a/Lib/packaging/metadata.py b/Lib/packaging/metadata.py
index a3db51c..c13acbe 100644
--- a/Lib/packaging/metadata.py
+++ b/Lib/packaging/metadata.py
@@ -552,16 +552,17 @@ class Metadata:
return data
# Mapping API
+ # XXX these methods should return views or sets in 3.x
def keys(self):
- return _version2fieldlist(self['Metadata-Version'])
+ return list(_version2fieldlist(self['Metadata-Version']))
def __iter__(self):
for key in self.keys():
yield key
def values(self):
- return [self[key] for key in list(self.keys())]
+ return [self[key] for key in self.keys()]
def items(self):
- return [(key, self[key]) for key in list(self.keys())]
+ return [(key, self[key]) for key in self.keys()]
diff --git a/Lib/packaging/pypi/simple.py b/Lib/packaging/pypi/simple.py
index 76aad02..9faabaa 100644
--- a/Lib/packaging/pypi/simple.py
+++ b/Lib/packaging/pypi/simple.py
@@ -23,12 +23,11 @@ from packaging.version import get_version_predicate
from packaging import __version__ as packaging_version
from packaging.pypi.base import BaseClient
from packaging.pypi.dist import (ReleasesList, EXTENSIONS,
- get_infos_from_url, MD5_HASH)
+ get_infos_from_url, MD5_HASH)
from packaging.pypi.errors import (PackagingPyPIError, DownloadError,
- UnableToDownload, CantParseArchiveName,
- ReleaseNotFound, ProjectNotFound)
+ UnableToDownload, CantParseArchiveName,
+ ReleaseNotFound, ProjectNotFound)
from packaging.pypi.mirrors import get_mirrors
-from packaging.metadata import Metadata
__all__ = ['Crawler', 'DEFAULT_SIMPLE_INDEX_URL']
diff --git a/Lib/packaging/tests/test_command_bdist_dumb.py b/Lib/packaging/tests/test_command_bdist_dumb.py
index cc03fa5..8e2d497 100644
--- a/Lib/packaging/tests/test_command_bdist_dumb.py
+++ b/Lib/packaging/tests/test_command_bdist_dumb.py
@@ -35,7 +35,7 @@ class BuildDumbTestCase(support.TempdirManager,
dist = Distribution({'name': 'foo', 'version': '0.1',
'py_modules': ['foo'],
- 'home-page': 'xxx', 'author': 'xxx',
+ 'home_page': 'xxx', 'author': 'xxx',
'author_email': 'xxx'})
os.chdir(pkg_dir)
cmd = bdist_dumb(dist)
diff --git a/Lib/packaging/tests/test_command_build_ext.py b/Lib/packaging/tests/test_command_build_ext.py
index c84631c..2926c37 100644
--- a/Lib/packaging/tests/test_command_build_ext.py
+++ b/Lib/packaging/tests/test_command_build_ext.py
@@ -4,14 +4,13 @@ import site
import sysconfig
import textwrap
from io import StringIO
-from sysconfig import _CONFIG_VARS
from packaging.dist import Distribution
from packaging.errors import (UnknownFileError, CompileError,
PackagingPlatformError)
from packaging.command.build_ext import build_ext
from packaging.compiler.extension import Extension
-from test.script_helper import assert_python_ok
+from test.script_helper import assert_python_ok
from packaging.tests import support, unittest, verbose
@@ -75,16 +74,16 @@ class BuildExtTestCase(support.TempdirManager,
sys.platform = 'sunos' # fooling finalize_options
- old_var = _CONFIG_VARS.get('Py_ENABLE_SHARED')
- _CONFIG_VARS['Py_ENABLE_SHARED'] = 1
+ old_var = sysconfig.get_config_var('Py_ENABLE_SHARED')
+ sysconfig._CONFIG_VARS['Py_ENABLE_SHARED'] = 1
try:
cmd.ensure_finalized()
finally:
sys.platform = old
if old_var is None:
- del _CONFIG_VARS['Py_ENABLE_SHARED']
+ del sysconfig._CONFIG_VARS['Py_ENABLE_SHARED']
else:
- _CONFIG_VARS['Py_ENABLE_SHARED'] = old_var
+ sysconfig._CONFIG_VARS['Py_ENABLE_SHARED'] = old_var
# make sure we get some library dirs under solaris
self.assertGreater(len(cmd.library_dirs), 0)
diff --git a/Lib/packaging/tests/test_command_register.py b/Lib/packaging/tests/test_command_register.py
index 9c64e2d..9872e2e 100644
--- a/Lib/packaging/tests/test_command_register.py
+++ b/Lib/packaging/tests/test_command_register.py
@@ -99,7 +99,7 @@ class RegisterTestCase(support.TempdirManager,
def _get_cmd(self, metadata=None):
if metadata is None:
- metadata = {'home-page': 'xxx', 'author': 'xxx',
+ metadata = {'home_page': 'xxx', 'author': 'xxx',
'author_email': 'xxx',
'name': 'xxx', 'version': 'xxx'}
pkg_info, dist = self.create_dist(**metadata)
diff --git a/Lib/packaging/tests/test_dist.py b/Lib/packaging/tests/test_dist.py
index 8d91a92..f912c6f 100644
--- a/Lib/packaging/tests/test_dist.py
+++ b/Lib/packaging/tests/test_dist.py
@@ -72,7 +72,7 @@ class DistributionTestCase(support.TempdirManager,
Distribution(attrs={'author': 'xxx',
'name': 'xxx',
'version': '1.2',
- 'home-page': 'xxxx',
+ 'home_page': 'xxxx',
'badoptname': 'xxx'})
logs = self.get_logs(logging.WARNING)
self.assertEqual(len(logs), 1)
@@ -82,7 +82,7 @@ class DistributionTestCase(support.TempdirManager,
# an empty options dictionary should not stay in the
# list of attributes
dist = Distribution(attrs={'author': 'xxx', 'name': 'xxx',
- 'version': '1.2', 'home-page': 'xxxx',
+ 'version': '1.2', 'home_page': 'xxxx',
'options': {}})
self.assertEqual([], self.get_logs(logging.WARNING))
@@ -99,7 +99,7 @@ class DistributionTestCase(support.TempdirManager,
dist = Distribution(attrs={'author': 'xxx',
'name': 'xxx',
'version': 'xxx',
- 'home-page': 'xxxx',
+ 'home_page': 'xxxx',
'options': {'sdist': {'owner': 'root'}}})
self.assertIn('owner', dist.get_option_dict('sdist'))
diff --git a/Lib/packaging/tests/test_metadata.py b/Lib/packaging/tests/test_metadata.py
index 68b3d97..6b7dd38 100644
--- a/Lib/packaging/tests/test_metadata.py
+++ b/Lib/packaging/tests/test_metadata.py
@@ -101,7 +101,7 @@ class MetadataTestCase(LoggingCatcher,
# XXX caveat: the keys method and friends are not 3.x-style views
# should be changed or documented
- self.assertEqual(list(metadata), list(metadata.keys()))
+ self.assertEqual(list(metadata), metadata.keys())
def test_read_metadata(self):
fields = {'name': 'project',
@@ -301,7 +301,7 @@ class MetadataTestCase(LoggingCatcher,
Metadata(mapping={'author': 'xxx',
'name': 'xxx',
'version': 'xxx',
- 'home-page': 'xxxx'})
+ 'home_page': 'xxxx'})
logs = self.get_logs(logging.WARNING)
self.assertEqual(1, len(logs))
self.assertIn('not a valid version', logs[0])