Skip to content

Commit 345c691

Browse files
bugfix: handle errors in pyproject for cli command finding
1 parent 088c652 commit 345c691

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/setuptools_scm/__main__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def main() -> None:
3636
print(fname)
3737

3838

39-
def _get_cli_opts():
39+
def _get_cli_opts() -> argparse.Namespace:
4040
prog = "python -m setuptools_scm"
4141
desc = "Print project version according to SCM metadata"
4242
parser = argparse.ArgumentParser(prog, description=desc)
@@ -67,13 +67,15 @@ def _get_cli_opts():
6767
return parser.parse_args()
6868

6969

70-
def _find_pyproject(parent):
70+
def _find_pyproject(parent: str) -> str:
7171
for directory in walk_potential_roots(os.path.abspath(parent)):
7272
pyproject = os.path.join(directory, "pyproject.toml")
73-
if os.path.exists(pyproject):
73+
if os.path.isfile(pyproject):
7474
return pyproject
7575

76-
raise FileNotFoundError("'pyproject.toml' was not found")
76+
return os.path.abspath(
77+
"pyproject.toml"
78+
) # use default name to trigger the default errors
7779

7880

7981
if __name__ == "__main__":

0 commit comments

Comments
 (0)