Skip to content

Commit

Permalink
Allow path dependency that is missing build-system (#675)
Browse files Browse the repository at this point in the history
  • Loading branch information
oysols authored Dec 18, 2023
1 parent 2b87606 commit fba71c1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/poetry/core/packages/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,7 @@ def create_from_pep_508(
if os.path.isdir(p) and (os.path.sep in name or name.startswith(".")):
if not is_python_project(Path(name)):
raise ValueError(
f"Directory {name!r} is not installable. File 'setup.[py|cfg]' "
"not found."
f"Directory {name!r} is not installable. Not a Python project."
)
link = Link(path_to_url(p))
elif is_archive_file(p):
Expand Down
8 changes: 2 additions & 6 deletions src/poetry/core/packages/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from poetry.core.constraints.version import Version
from poetry.core.constraints.version import VersionRange
from poetry.core.constraints.version import parse_marker_version_constraint
from poetry.core.pyproject.toml import PyProjectTOML
from poetry.core.version.markers import SingleMarker
from poetry.core.version.markers import SingleMarkerLike
from poetry.core.version.markers import dnf
Expand Down Expand Up @@ -129,12 +128,9 @@ def is_python_project(path: Path) -> bool:
setup_cfg = path / "setup.cfg"
setuptools_project = setup_py.exists() or setup_cfg.exists()

pyproject = PyProjectTOML(path / "pyproject.toml")
pyproject = (path / "pyproject.toml").exists()

supports_pep517 = setuptools_project or pyproject.is_build_system_defined()
supports_poetry = pyproject.is_poetry_project()

return supports_pep517 or supports_poetry
return pyproject or setuptools_project


def is_archive_file(name: str) -> bool:
Expand Down
3 changes: 0 additions & 3 deletions src/poetry/core/pyproject/toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ def data(self) -> dict[str, Any]:

return self._data

def is_build_system_defined(self) -> bool:
return "build-system" in self.data

@property
def build_system(self) -> BuildSystem:
if self._build_system is None:
Expand Down
3 changes: 3 additions & 0 deletions tests/fixtures/project_minimal/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[project]
name = "minimal"
version = "1"
6 changes: 6 additions & 0 deletions tests/packages/test_directory_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ def test_directory_dependency_is_not_a_python_project(
dep.validate(raise_error=True)


def test_directory_dependency_minimal() -> None:
path = Path(__file__).parent.parent / "fixtures" / "project_minimal"
dep = DirectoryDependency("demo", path)
dep.validate(raise_error=True)


def _test_directory_dependency_pep_508(
name: str, path: Path, pep_508_input: str, pep_508_output: str | None = None
) -> None:
Expand Down

0 comments on commit fba71c1

Please sign in to comment.