Skip to content

Commit

Permalink
Merge branch 'subdirectory-sbi' of https://github.com/sbidoul/require…
Browse files Browse the repository at this point in the history
…ments-parser into sbidoul-subdirectory-sbi
  • Loading branch information
davidfischer committed Sep 9, 2017
2 parents f9e93d0 + fd2c098 commit b9f0290
Show file tree
Hide file tree
Showing 23 changed files with 214 additions and 0 deletions.
7 changes: 7 additions & 0 deletions requirements/requirement.py
Expand Up @@ -49,6 +49,7 @@ class Requirement(object):
* ``revision`` - a version control system specifier
* ``name`` - the name of the requirement
* ``uri`` - the URI if this requirement was specified by URI
* ``subdirectory`` - the subdirectory fragment of the URI
* ``path`` - the local path to the requirement
* ``hash_name`` - the type of hashing algorithm indicated in the line
* ``hash`` - the hash value indicated by the requirement line
Expand All @@ -66,6 +67,7 @@ def __init__(self, line):
self.specifier = False
self.vcs = None
self.name = None
self.subdirectory = None
self.uri = None
self.path = None
self.revision = None
Expand Down Expand Up @@ -110,6 +112,7 @@ def parse_editable(cls, line):
egg = fragment.get('egg')
req.name, req.extras = parse_extras_require(egg)
req.hash_name, req.hash = get_hash_info(fragment)
req.subdirectory = fragment.get('subdirectory')
for vcs in VCS:
if req.uri.startswith(vcs):
req.vcs = vcs
Expand All @@ -122,6 +125,7 @@ def parse_editable(cls, line):
egg = fragment.get('egg')
req.name, req.extras = parse_extras_require(egg)
req.hash_name, req.hash = get_hash_info(fragment)
req.subdirectory = fragment.get('subdirectory')
req.path = groups['path']

return req
Expand Down Expand Up @@ -153,6 +157,7 @@ def parse_line(cls, line):
egg = fragment.get('egg')
req.name, req.extras = parse_extras_require(egg)
req.hash_name, req.hash = get_hash_info(fragment)
req.subdirectory = fragment.get('subdirectory')
for vcs in VCS:
if req.uri.startswith(vcs):
req.vcs = vcs
Expand All @@ -164,6 +169,7 @@ def parse_line(cls, line):
egg = fragment.get('egg')
req.name, req.extras = parse_extras_require(egg)
req.hash_name, req.hash = get_hash_info(fragment)
req.subdirectory = fragment.get('subdirectory')
if groups['scheme'] == 'file':
req.local_file = True
elif '#egg=' in line:
Expand All @@ -177,6 +183,7 @@ def parse_line(cls, line):
name, extras = parse_extras_require(egg)
req.name = fragment.get('egg')
req.hash_name, req.hash = get_hash_info(fragment)
req.subdirectory = fragment.get('subdirectory')
req.path = groups['path']
else:
# This is a requirement specifier.
Expand Down
1 change: 1 addition & 0 deletions tests/reqfiles/comment_2.expected
Expand Up @@ -4,6 +4,7 @@
"local_file": false,
"name": "req",
"editable": false,
"subdirectory": null,
"uri": null,
"extras": [],
"vcs": null,
Expand Down

0 comments on commit b9f0290

Please sign in to comment.