Fix url regexp to proceed oslo-specific url's properly

The current url_re regexp ignores dots in egg section, so it proceeds
url with "#egg=oslo.messaging" as "#egg=oslo". This patch fixes it.

Change-Id: Ifcea3e825218578f799c0a951baac8f8e8ef5de5
This commit is contained in:
Victor Sergeyev 2015-08-05 12:58:09 +03:00
parent 30d3973eb2
commit e45b270ad8
2 changed files with 6 additions and 1 deletions

View File

@ -38,7 +38,7 @@ Requirements = collections.namedtuple('Requirements', ['reqs'])
url_re = re.compile(
'^(?P<url>\s*(?:-e\s)?\s*(?:(?:git+)?https|http|file)://[^#]*)'
'#egg=(?P<name>[-\w]+)')
'#egg=(?P<name>[-\.\w]+)')
def parse(content, permit_urls=False):

View File

@ -61,6 +61,11 @@ class TestParseRequirement(testtools.TestCase):
req=requirement.Requirement('thing', 'file:///path/to/thing', '', '',
''),
permit_urls=True)),
('oslo-url', dict(
line='file:///path/to/oslo.thing#egg=oslo.thing',
req=requirement.Requirement('oslo.thing',
'file:///path/to/oslo.thing', '', '', ''),
permit_urls=True)),
('url-comment', dict(
line='file:///path/to/thing#egg=thing # http://altpath#egg=boo',
req=requirement.Requirement('thing', 'file:///path/to/thing', '', '',