Commit 8ed00a70 authored by Jason R. Coombs's avatar Jason R. Coombs Committed by GitHub

Merge pull request #968 from moriyoshi/moriyoshi/local-version-label-in-egg-fragment

A local version label starts with a '+' sign
parents 5470fb8f f33cfac3
...@@ -4,6 +4,10 @@ v34.2.0 ...@@ -4,6 +4,10 @@ v34.2.0
* #966: Add support for reading dist-info metadata and * #966: Add support for reading dist-info metadata and
thus locating Distributions from zip files. thus locating Distributions from zip files.
* #968: Allow '+' and '!' in egg fragments
so that it can take package names that contain
PEP 440 conforming version specifiers.
v34.1.1 v34.1.1
------- -------
......
...@@ -30,7 +30,7 @@ from fnmatch import translate ...@@ -30,7 +30,7 @@ from fnmatch import translate
from setuptools.py26compat import strip_fragment from setuptools.py26compat import strip_fragment
from setuptools.py27compat import get_all_headers 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) HREF = re.compile("""href\\s*=\\s*['"]?([^'"> ]+)""", re.I)
# this is here to fix emacs' cruddy broken syntax highlighting # this is here to fix emacs' cruddy broken syntax highlighting
PYPI_MD5 = re.compile( PYPI_MD5 = re.compile(
......
...@@ -181,6 +181,48 @@ class TestPackageIndex: ...@@ -181,6 +181,48 @@ class TestPackageIndex:
res = setuptools.package_index.local_open(url) res = setuptools.package_index.local_open(url)
assert 'content' in res.read() 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: class TestContentCheckers:
def test_md5(self): def test_md5(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment