From a554448dddab4bf867fee30c1ccd0e6ea4de474b Mon Sep 17 00:00:00 2001 From: David Hotham Date: Sun, 15 May 2022 14:26:38 +0100 Subject: [PATCH] tolerate `poetry init` in `/` --- src/poetry/layouts/layout.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/poetry/layouts/layout.py b/src/poetry/layouts/layout.py index f5dfd28e950..e81d201ebb8 100644 --- a/src/poetry/layouts/layout.py +++ b/src/poetry/layouts/layout.py @@ -90,7 +90,11 @@ def package_path(self) -> Path: def get_package_include(self) -> InlineTable | None: package = inline_table() - include = self._package_path_relative.parts[0] + parts = self._package_path_relative.parts + if not parts: + return None + + include = parts[0] package.append("include", include) # type: ignore[no-untyped-call] if self.basedir != Path():