diff options
Diffstat (limited to 'setuptools')
| -rw-r--r-- | setuptools/config.py | 11 | ||||
| -rwxr-xr-x | setuptools/namespaces.py | 2 | ||||
| -rwxr-xr-x | setuptools/package_index.py | 2 | ||||
| -rw-r--r-- | setuptools/py27compat.py | 1 | ||||
| -rw-r--r-- | setuptools/tests/test_config.py | 13 | ||||
| -rw-r--r-- | setuptools/tests/test_packageindex.py | 42 |
6 files changed, 52 insertions, 19 deletions
diff --git a/setuptools/config.py b/setuptools/config.py index 19b39629..39a01f88 100644 --- a/setuptools/config.py +++ b/setuptools/config.py @@ -412,17 +412,6 @@ class ConfigMetadataHandler(ConfigHandler): 'version': self._parse_version, } - def parse_section_classifiers(self, section_options): - """Parses configuration file section. - - :param dict section_options: - """ - classifiers = [] - for begin, (_, rest) in section_options.items(): - classifiers.append('%s :%s' % (begin.title(), rest)) - - self['classifiers'] = classifiers - def _parse_version(self, value): """Parses `version` option value. diff --git a/setuptools/namespaces.py b/setuptools/namespaces.py index 556b5dd2..7c24a566 100755 --- a/setuptools/namespaces.py +++ b/setuptools/namespaces.py @@ -52,7 +52,7 @@ class Installer: "importlib.util.module_from_spec(" "importlib.machinery.PathFinder.find_spec(%(pkg)r, " "[os.path.dirname(p)])))", - "m = m or not has_mfs and " + "m = m or " "sys.modules.setdefault(%(pkg)r, types.ModuleType(%(pkg)r))", "mp = (m or []) and m.__dict__.setdefault('__path__',[])", "(p not in mp) and mp.append(p)", diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 42361058..3544dd54 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -30,7 +30,7 @@ from fnmatch import translate from setuptools.py26compat import strip_fragment from setuptools.py27compat import get_all_headers -EGG_FRAGMENT = re.compile(r'^egg=([-A-Za-z0-9_.]+)$') +EGG_FRAGMENT = re.compile(r'^egg=([-A-Za-z0-9_.+!]+)$') HREF = re.compile("""href\\s*=\\s*['"]?([^'"> ]+)""", re.I) # this is here to fix emacs' cruddy broken syntax highlighting PYPI_MD5 = re.compile( diff --git a/setuptools/py27compat.py b/setuptools/py27compat.py index a71a936e..f0a80a8e 100644 --- a/setuptools/py27compat.py +++ b/setuptools/py27compat.py @@ -21,7 +21,6 @@ if sys.version_info < (3,): linux_py2_ascii = ( platform.system() == 'Linux' and - sys.getfilesystemencoding() == 'ascii' and sys.version_info < (3,) ) diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py index fa8d523b..799fb165 100644 --- a/setuptools/tests/test_config.py +++ b/setuptools/tests/test_config.py @@ -257,6 +257,7 @@ class TestMetadata: def test_classifiers(self, tmpdir): expected = set([ 'Framework :: Django', + 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.5', ]) @@ -269,19 +270,21 @@ class TestMetadata: tmpdir.join('classifiers').write( 'Framework :: Django\n' + 'Programming Language :: Python :: 3\n' 'Programming Language :: Python :: 3.5\n' ) with get_dist(tmpdir) as dist: assert set(dist.metadata.classifiers) == expected - # From section. + # From list notation config.write( - '[metadata.classifiers]\n' - 'Framework :: Django\n' - 'Programming Language :: Python :: 3.5\n' + '[metadata]\n' + 'classifiers =\n' + ' Framework :: Django\n' + ' Programming Language :: Python :: 3\n' + ' Programming Language :: Python :: 3.5\n' ) - with get_dist(tmpdir) as dist: assert set(dist.metadata.classifiers) == expected diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py index d68867c2..1a66394f 100644 --- a/setuptools/tests/test_packageindex.py +++ b/setuptools/tests/test_packageindex.py @@ -181,6 +181,48 @@ class TestPackageIndex: res = setuptools.package_index.local_open(url) assert 'content' in res.read() + def test_egg_fragment(self): + """ + EGG fragments must comply to PEP 440 + """ + epoch = [ + '', + '1!', + ] + releases = [ + '0', + '0.0', + '0.0.0', + ] + pre = [ + 'a0', + 'b0', + 'rc0', + ] + post = [ + '.post0' + ] + dev = [ + '.dev0', + ] + local = [ + ('', ''), + ('+ubuntu.0', '+ubuntu.0'), + ('+ubuntu-0', '+ubuntu.0'), + ('+ubuntu_0', '+ubuntu.0'), + ] + versions = [ + [''.join([e, r, p, l]) for l in ll] + for e in epoch + for r in releases + for p in sum([pre, post, dev], ['']) + for ll in local] + for v, vc in versions: + dists = list(setuptools.package_index.distros_for_url( + 'http://example.com/example.zip#egg=example-' + v)) + assert dists[0].version == '' + assert dists[1].version == vc + class TestContentCheckers: def test_md5(self): |
