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
......@@ -45,7 +45,7 @@ class Poetry:
fallback=self._config.setting('settings.pypi.fallback', True)
)
)
@property
def file(self):
return self._file
......@@ -68,11 +68,18 @@ class Poetry:
@classmethod
def create(cls, cwd): # type: () -> Poetry
poetry_file = Path(cwd) / 'pyproject.toml'
candidates = [Path(cwd)]
candidates.extend(Path(cwd).parents)
for path in candidates:
poetry_file = path / 'pyproject.toml'
if poetry_file.exists():
break
if not poetry_file.exists():
else:
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)
......
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