From 055b5a726e7da3191dba9404ba61b29e76ad59e4 Mon Sep 17 00:00:00 2001
From: Paul Moore
Date: Wed, 25 Jul 2018 21:43:50 +0100
Subject: [PATCH] A project is installable if it has either setup.py or
pyproject.toml
---
src/pip/_internal/req/req_install.py | 4 ++--
src/pip/_internal/utils/misc.py | 5 ++++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py
index 7f9ff4e0f..d348cbc36 100644
--- a/src/pip/_internal/req/req_install.py
+++ b/src/pip/_internal/req/req_install.py
@@ -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):
diff --git a/src/pip/_internal/utils/misc.py b/src/pip/_internal/utils/misc.py
index c6c8a09d0..1fd18961f 100644
--- a/src/pip/_internal/utils/misc.py
+++ b/src/pip/_internal/utils/misc.py
@@ -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