Last active
January 21, 2020 15:41
-
-
Save duckinator/94205a8465403b2354d4469a437bad9f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from pathlib import Path | |
import pep517.build | |
import sys | |
import textwrap | |
# quick-and-dirty pep517 wrapper that handles projects without a pyproject.toml. | |
# Released under public domain, CC0, or MIT license, whichever you prefer. | |
# This means you can re-license it to whatever you want and don't need to give me credit. | |
# - @duckinator | |
def _ensure_pyproject_exists(): | |
pyproject_file = Path(Path.cwd(), 'pyproject.toml') | |
print(pyproject_file) | |
if not pyproject_file.exists(): | |
pyproject_file.write_text(textwrap.dedent("""\ | |
[build-system] | |
requires = ["setuptools", "wheel"] | |
build-backend = "setuptools.build_meta" | |
""")) | |
def build(args): | |
_ensure_pyproject_exists() | |
if not args: | |
args = ['--binary', '--source', '.'] | |
pep517.build.main(pep517.build.parser.parse_args(args)) | |
if __name__ == '__main__': | |
build(sys.argv[1:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment