read version from setup.cfg
authorClaudio Luck <claudio.luck@pep.foundation>
Thu, 19 Mar 2020 17:17:22 +0100
changeset 66 701c5e980f33
parent 65 d659b8c2ed22
child 67 db1b6e9a6bb7
read version from setup.cfg
Makefile
--- a/Makefile	Thu Mar 19 16:47:39 2020 +0100
+++ b/Makefile	Thu Mar 19 17:17:22 2020 +0100
@@ -1,8 +1,9 @@
 YML_PATH  =
 DEBVER   := 1
 PYTHON   := python3
-PKGVER    = $(shell $(PYTHON) setup.py -V)
+PKGVER    = $(shell awk '/^version/ {print $$3}' setup.cfg)
 TWINE    := $(PYTHON) -m twine
+TWINEREP := pypi
 YML2C     = $(PYTHON) yml2c
 
 all: homepage
@@ -36,14 +37,18 @@
 	rm -rf *.egg-info
 	rm -f YML2_$(PKGVER).orig.tar.gz
 	rm -f python-yml2_$(PKGVER)-$(DEBVER)_all.deb
+	rm -f dist/YML2-$(PKGVER).tar.gz
 
-.PHONY: dist dist/YML2-$(PKGVER).tar.gz
-dist: dist/YML2-$(PKGVER).tar.gz
+sdist-pypi: dist/YML2-$(PKGVER).tar.gz
 	$(TWINE) check $<
 
+upload-pypi: sdist-pypi
+	$(TWINE) upload --repository "$(TWINEREP)" $<
+
+.PHONY: dist/YML2-$(PKGVER).tar.gz
 dist/YML2-$(PKGVER).tar.gz:
 	$(PYTHON) setup.py sdist
 
 install:
-	pip install .
+	pip install -e .