Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be more helpful when pyproject.toml is missing #240

Merged
merged 3 commits into from
Jan 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions bork/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,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