Skip to content

Commit

Permalink
Merge branch 'bugfixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
techalchemy committed Jun 3, 2018
2 parents fa2f10a + ec1e475 commit 8332429
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/requirementslib/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ class FileRequirement(BaseRequirement):
req = attrib()
_has_hashed_name = False
_uri_scheme = None
_setup_path = attrib(default=None)

@uri.default
def get_uri(self):
Expand All @@ -299,11 +300,10 @@ def get_name(self):
if loc:
self._uri_scheme = "path" if self.path else "uri"
name = None
setup_path = Path(self.path) / 'setup.py'
if self._uri_scheme != "uri" and self.path and setup_path.exists():
if self._uri_scheme != "uri" and self.path and self.setup_path:
from distutils.core import run_setup
try:
dist = run_setup(setup_path.as_posix(), stop_after='init')
dist = run_setup(self.setup_path.as_posix(), stop_after='init')
except FileNotFoundError:
dist = None
else:
Expand Down Expand Up @@ -348,6 +348,16 @@ def is_remote_artifact(self):
self.link.is_artifact or self.link.is_wheel
) and not self.req.editable

@property
def setup_path(self):
if not self._setup_path:
if not self.path:
return
setup_path = Path(self.path) / 'setup.py'
if setup_path.exists():
self._setup_path = setup_path
return self._setup_path

@classmethod
def from_line(cls, line):
link = None
Expand Down

0 comments on commit 8332429

Please sign in to comment.