Commit 253bb029 by Konstantin Molchanov Committed by Sébastien Eustace

Search pyproject.toml in cwd parents. (#71)

* Search pyproject.toml in cwd parents.

* Fix error message when pyproject.toml is not found.

* Attempt to fix Python 2.7 and 3.4 compatibility.
parent 4b2ffcaf
...@@ -68,11 +68,18 @@ class Poetry: ...@@ -68,11 +68,18 @@ class Poetry:
@classmethod @classmethod
def create(cls, cwd): # type: () -> Poetry def create(cls, cwd): # type: () -> Poetry
poetry_file = Path(cwd) / 'pyproject.toml' candidates = [Path(cwd)]
candidates.extend(Path(cwd).parents)
if not poetry_file.exists(): for path in candidates:
poetry_file = path / 'pyproject.toml'
if poetry_file.exists():
break
else:
raise RuntimeError( raise RuntimeError(
'Poetry could not find a pyproject.toml file in {}'.format(cwd) 'Poetry could not find a pyproject.toml file in {} or its parents'.format(cwd)
) )
local_config = TomlFile(poetry_file.as_posix()).read(True) local_config = TomlFile(poetry_file.as_posix()).read(True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment