From df30564eafe757522eee875168b6fa4fb7d2bb4f Mon Sep 17 00:00:00 2001 From: Gregor von Laszewski Date: Fri, 15 Dec 2023 05:22:24 -0500 Subject: [PATCH] create makefile templates --- Makefile | 106 +++------------------------------------------ makefile-banner.mk | 7 +++ makefile-check.mk | 8 ++++ makefile-clean.mk | 11 +++++ makefile-pypi.mk | 54 +++++++++++++++++++++++ makefile-test.mk | 6 +++ 6 files changed, 93 insertions(+), 99 deletions(-) create mode 100644 makefile-banner.mk create mode 100644 makefile-check.mk create mode 100644 makefile-clean.mk create mode 100644 makefile-pypi.mk create mode 100644 makefile-test.mk diff --git a/Makefile b/Makefile index 1785d8b2..d5ad6bad 100644 --- a/Makefile +++ b/Makefile @@ -1,109 +1,17 @@ -package=sys +package=common UNAME=$(shell uname) VERSION=`head -1 VERSION` -.PHONY: conda - -define banner - @echo - @echo "############################################################" - @echo "# $(1) " - @echo "############################################################" -endef +include makefile-banner.mk source: - $(call banner, "Install cloudmesh-common") + $(call banner, "Install cloudmesh-${package}") pip install -e . -U -flake8: - cd ..; flake8 --max-line-length 124 --ignore=E722 cloudmesh-$(package)/cloudmesh - cd ..; flake8 --max-line-length 124 --ignore=E722 cloudmesh-$(package)/tests - -pylint: - cd ..; pylint --rcfile=cloudmesh-$(package)/.pylintrc cloudmesh-$(package)/cloudmesh - cd ..; pylint --rcfile=cloudmesh-$(package)/.pylintrc --disable=F0010 cloudmesh-$(package)/tests - -requirements: - echo "# cloudmesh-common requirements"> tmp.txt - #echo "cloudmesh-common" > tmp.txt - #echo "cloudmesh-cmd5" >> tmp.txt - # pip-compile setup.py - cat requirements.txt >> tmp.txt - mv tmp.txt requirements.txt - -git commit -m "update requirements" requirements.txt - -git push - -test: - pytest -v --html=.report.html - open .report.html - -dtest: - pytest -v --capture=no - -clean: - $(call banner, "CLEAN") - rm -rf *.zip - rm -rf *.egg-info - rm -rf *.eggs - rm -rf docs/build - rm -rf build - rm -rf dist - find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf - rm -rf .tox - rm -f *.whl - - -###################################################################### -# PYPI -###################################################################### - -twine: - pip install -U twine - -dist: - python setup.py sdist bdist_wheel - twine check dist/* - -patch: clean twine - $(call banner, "patch") - cms bumpversion patch - python setup.py sdist bdist_wheel - git push origin main --tags - twine check dist/* - twine upload --repository testpypi dist/* - -minor: clean - $(call banner, "minor") - cms bumpversion minor - @cat VERSION - @echo - -major: clean - $(call banner, "major") - cms bumpversion major - @cat VERSION - @echo - -release: clean - $(call banner, "release") - git tag "v$(VERSION)" - git push origin main --tags - python setup.py sdist bdist_wheel - twine check dist/* - twine upload --repository pypi dist/* - $(call banner, "install") - @cat VERSION - @echo +include makefile-test.mk -upload: - twine check dist/* - twine upload dist/* +include makefile-clean.mk -pip: - pip install --index-url https://test.pypi.org/simple/ cloudmesh-$(package) -U +include makefile-check.mk -log: - $(call banner, log) - gitchangelog | fgrep -v ":dev:" | fgrep -v ":new:" > ChangeLog - git commit -m "chg: dev: Update ChangeLog" ChangeLog - git push +include makefile-pypi.mk diff --git a/makefile-banner.mk b/makefile-banner.mk new file mode 100644 index 00000000..25f25702 --- /dev/null +++ b/makefile-banner.mk @@ -0,0 +1,7 @@ +define banner + @echo + @echo "############################################################" + @echo "# $(1) " + @echo "############################################################" +endef + diff --git a/makefile-check.mk b/makefile-check.mk new file mode 100644 index 00000000..5c54a112 --- /dev/null +++ b/makefile-check.mk @@ -0,0 +1,8 @@ + +flake8: + cd ..; flake8 --max-line-length 124 --ignore=E722 cloudmesh-$(package)/cloudmesh + cd ..; flake8 --max-line-length 124 --ignore=E722 cloudmesh-$(package)/tests + +pylint: + cd ..; pylint --rcfile=cloudmesh-$(package)/.pylintrc cloudmesh-$(package)/cloudmesh + cd ..; pylint --rcfile=cloudmesh-$(package)/.pylintrc --disable=F0010 cloudmesh-$(package)/tests diff --git a/makefile-clean.mk b/makefile-clean.mk new file mode 100644 index 00000000..bd1a45df --- /dev/null +++ b/makefile-clean.mk @@ -0,0 +1,11 @@ +clean: + $(call banner, "CLEAN") + rm -rf *.zip + rm -rf *.egg-info + rm -rf *.eggs + rm -rf docs/build + rm -rf build + rm -rf dist + find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf + rm -rf .tox + rm -f *.whl diff --git a/makefile-pypi.mk b/makefile-pypi.mk new file mode 100644 index 00000000..42f26ccf --- /dev/null +++ b/makefile-pypi.mk @@ -0,0 +1,54 @@ +###################################################################### +# PYPI +###################################################################### + +twine: + pip install -U twine + +dist: + python setup.py sdist bdist_wheel + twine check dist/* + +patch: clean twine + $(call banner, "patch") + cms bumpversion patch + python setup.py sdist bdist_wheel + git push origin main --tags + twine check dist/* + twine upload --repository testpypi dist/* + +minor: clean + $(call banner, "minor") + cms bumpversion minor + @cat VERSION + @echo + +major: clean + $(call banner, "major") + cms bumpversion major + @cat VERSION + @echo + +release: clean + $(call banner, "release") + git tag "v$(VERSION)" + git push origin main --tags + python setup.py sdist bdist_wheel + twine check dist/* + twine upload --repository pypi dist/* + $(call banner, "install") + @cat VERSION + @echo + +upload: + twine check dist/* + twine upload dist/* + +pip: + pip install --index-url https://test.pypi.org/simple/ cloudmesh-$(package) -U + +log: + $(call banner, log) + gitchangelog | fgrep -v ":dev:" | fgrep -v ":new:" > ChangeLog + git commit -m "chg: dev: Update ChangeLog" ChangeLog + git push diff --git a/makefile-test.mk b/makefile-test.mk new file mode 100644 index 00000000..2d2e00f5 --- /dev/null +++ b/makefile-test.mk @@ -0,0 +1,6 @@ +test: + pytest -v --html=.report.html + open .report.html + +dtest: + pytest -v --capture=no