A project is installable if it has either setup.py or pyproject.toml

This commit is contained in:
Paul Moore 2018-07-25 21:43:50 +01:00
parent 049eb58797
commit 055b5a726e
2 changed files with 6 additions and 3 deletions

View File

@ -220,8 +220,8 @@ class InstallRequirement(object):
if looks_like_dir:
if not is_installable_dir(p):
raise InstallationError(
"Directory %r is not installable. File 'setup.py' "
"not found." % name
"Directory %r is not installable. Neither 'setup.py' "
"nor 'pyproject.toml' found." % name
)
link = Link(path_to_url(p))
elif is_archive_file(p):

View File

@ -187,12 +187,15 @@ def format_size(bytes):
def is_installable_dir(path):
"""Return True if `path` is a directory containing a setup.py file."""
"""Return True if `path` is a directory containing a setup.py or pyproject.toml file."""
if not os.path.isdir(path):
return False
setup_py = os.path.join(path, 'setup.py')
if os.path.isfile(setup_py):
return True
pyproject_toml = os.path.join(path, 'pyproject.toml')
if os.path.isfile(pyproject_toml):
return True
return False