Skip to content

Commit

Permalink
Merge #240
Browse files Browse the repository at this point in the history
240: Be more helpful when pyproject.toml is missing r=duckinator a=nbraud

- [x] Emit an error referring to PEP 517 and to the buildsystem's documentation.
- [x] When the `setup.py` style is detected, suggest a basic `pyproject.toml`.
- [ ] Improve bork's error display, to ensure error messages aren't pushed off-screen by a backtrace.

Co-authored-by: nicoo <nicoo@mur.at>
  • Loading branch information
bors[bot] and nbraud committed Jan 6, 2021
2 parents 41c4c12 + b9dadb9 commit e0ce3b3
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions bork/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,32 @@ def aliases():


def build():
builder.dist()
builder.zipapp()
try:
builder.dist()
builder.zipapp()

except FileNotFoundError as e:
if e.filename != 'pyproject.toml':
raise e

setup = lambda ext: Path.cwd() / f"setup.{ext}"

if setup("cfg").exists() or setup("py").exists():
msg = """If you use setuptools, the following should be sufficient:
[build-system]
requires = ["setuptools > 42", "wheel"]
build-backend = "setuptools.build_meta" """

else:
msg = "Please refer to your build system's documentation."

logger().error(
"You need a 'pyproject.toml' file describing which buildsystem to "
"use, per PEP 517. %s", msg
)

raise e


def clean():
Expand Down

0 comments on commit e0ce3b3

Please sign in to comment.