mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Add FrozenRequirement._init_args_from_dist() helper method.
This commit is contained in:
parent
98338dc431
commit
309cb37091
2 changed files with 14 additions and 2 deletions
0
news/88BB743A-BE4E-4012-A714-9FE3B36BD30A.trivial
Normal file
0
news/88BB743A-BE4E-4012-A714-9FE3B36BD30A.trivial
Normal file
|
@ -168,7 +168,13 @@ class FrozenRequirement(object):
|
|||
_date_re = re.compile(r'-(20\d\d\d\d\d\d)$')
|
||||
|
||||
@classmethod
|
||||
def from_dist(cls, dist, dependency_links):
|
||||
def _init_args_from_dist(cls, dist, dependency_links):
|
||||
"""
|
||||
Compute and return arguments (req, editable, comments) to pass to
|
||||
FrozenRequirement.__init__().
|
||||
|
||||
This method is for use in FrozenRequirement.from_dist().
|
||||
"""
|
||||
location = os.path.normcase(os.path.abspath(dist.location))
|
||||
comments = []
|
||||
from pip._internal.vcs import vcs, get_src_requirement
|
||||
|
@ -235,7 +241,13 @@ class FrozenRequirement(object):
|
|||
editable = True
|
||||
egg_name = cls.egg_name(dist)
|
||||
req = make_vcs_requirement_url(svn_location, rev, egg_name)
|
||||
return cls(dist.project_name, req, editable, comments)
|
||||
|
||||
return (req, editable, comments)
|
||||
|
||||
@classmethod
|
||||
def from_dist(cls, dist, dependency_links):
|
||||
args = cls._init_args_from_dist(dist, dependency_links)
|
||||
return cls(dist.project_name, *args)
|
||||
|
||||
@staticmethod
|
||||
def egg_name(dist):
|
||||
|
|
Loading…
Reference in a new issue