Skip to content

Commit

Permalink
Moved some stuff from setup.py into pyproject.toml
Browse files Browse the repository at this point in the history
Improved stuff in setup.py a bit
  • Loading branch information
KOLANICH committed May 28, 2021
1 parent 510318f commit 9e2ff9d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4.3"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to_template = "__version__ = \"{version}\"\n"
write_to = "parglare/version.py"
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ include_package_data = True
package_dir =
parglare = parglare
test_suite = tests
setup_requires = setuptools_scm;
setup_requires = setuptools >= 42; wheel; setuptools_scm[toml] >= 3.4.3;


[options.extras_require]
Expand Down
11 changes: 4 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,18 @@
this_dir = Path(__file__).absolute().parent

if sys.argv[-1].startswith('publish'):
if os.system("pip list | grep wheel"):
if os.system("pip3 list | grep wheel"):
print("wheel not installed.\nUse `pip install wheel`.\nExiting.")
sys.exit()
if os.system("pip list | grep twine"):
if os.system("pip3 list | grep twine"):
print("twine not installed.\nUse `pip install twine`.\nExiting.")
sys.exit()
os.system("python setup.py sdist bdist_wheel")
os.system("python3 -m pep517 -bs .")
if sys.argv[-1] == 'publishtest':
os.system("twine upload -r test dist/*")
else:
os.system("twine upload dist/*")
sys.exit()

if __name__ == "__main__":
setup(use_scm_version={
"write_to": str(this_dir / "parglare" / "version.py"),
"write_to_template": '__version__ = "{version}"\n',
})
setup()

0 comments on commit 9e2ff9d

Please sign in to comment.