Skip to content

Commit

Permalink
Fix parsing lines using -e and end of line comments
Browse files Browse the repository at this point in the history
  • Loading branch information
belak committed Aug 19, 2016
1 parent 4a43544 commit 95006a3
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
4 changes: 4 additions & 0 deletions requirements/requirement.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ def parse_editable(cls, line):

req = cls('-e {0}'.format(line))
req.editable = True

if ' #' in line:
line = line[:line.find(' #')]

vcs_match = VCS_REGEX.match(line)
local_match = LOCAL_REGEX.match(line)

Expand Down
54 changes: 54 additions & 0 deletions tests/reqfiles/editable_2.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[
{
"specifier": false,
"local_file": false,
"name": "MyProject",
"editable": true,
"uri": "svn+svn://svn.myproject.org/svn/MyProject",
"extras": [],
"vcs": "svn",
"path": null,
"line": "-e svn+svn://svn.myproject.org/svn/MyProject#egg=MyProject # Test comment",
"specs": [],
"revision": null
},
{
"specifier": false,
"local_file": false,
"name": "MyProject",
"editable": true,
"uri": "git://git.myproject.org/MyProject.git",
"extras": [],
"vcs": "git",
"path": null,
"line": "-e git://git.myproject.org/MyProject.git@da39a3ee5e6b4b0d3255bfef95601890afd80709#egg=MyProject # Test comment",
"specs": [],
"revision": "da39a3ee5e6b4b0d3255bfef95601890afd80709"
},
{
"specifier": false,
"local_file": false,
"name": "MyProject",
"editable": true,
"uri": "hg+http://hg.myproject.org/MyProject/",
"extras": [],
"vcs": "hg",
"path": null,
"line": "-e hg+http://hg.myproject.org/MyProject/@special_feature#egg=MyProject # Test comment",
"specs": [],
"revision": "special_feature"
},
{
"specifier": false,
"local_file": false,
"name": "MyProject",
"editable": true,
"uri": "bzr+lp://MyProject",
"extras": [],
"vcs": "bzr",
"path": null,
"line": "-e bzr+lp://MyProject#egg=MyProject # Test comment",
"specs": [],
"revision": null
}
]
4 changes: 4 additions & 0 deletions tests/reqfiles/editable_2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-e svn+svn://svn.myproject.org/svn/MyProject#egg=MyProject # Test comment
--editable git://git.myproject.org/MyProject.git@da39a3ee5e6b4b0d3255bfef95601890afd80709#egg=MyProject # Test comment
--editable hg+http://hg.myproject.org/MyProject/@special_feature#egg=MyProject # Test comment
-e bzr+lp://MyProject#egg=MyProject # Test comment

0 comments on commit 95006a3

Please sign in to comment.