Makefile 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. project:=s3recon
  2. version:=$(shell python -c 'import sys, os; sys.path.insert(0, os.path.abspath(".")); print(__import__("${project}").__version__)')
  3. .PHONY: list
  4. list help:
  5. @make -pq | awk -F':' '/^[a-zA-Z0-9][^$$#\/\t=]*:([^=]|$$)/ {split($$1,A,/ /);for(i in A)print A[i]}' | sed '/Makefile/d' | sort
  6. .PHONY: format
  7. format:
  8. python -m black .
  9. .PHONY: build
  10. build: clean
  11. rm -rf ./dist/*
  12. python3 setup.py sdist bdist_wheel
  13. .PHONY: test
  14. test:
  15. @echo "not implemented"
  16. .PHONY: clean
  17. clean:
  18. rm -rf ./dist ./build ./*.egg-info ./htmlcov
  19. find . -name '*.pyc' -delete
  20. find . -name '__pycache__' -delete
  21. .PHONY: check
  22. check:
  23. twine check dist/*
  24. .PHONY: upload-test
  25. upload-test: test clean build check
  26. twine upload --repository-url https://test.pypi.org/legacy/ dist/*
  27. .PHONY: tag
  28. tag:
  29. ifeq (,$(shell git tag --list | grep "${version}"))
  30. git tag "v${version}"
  31. endif
  32. .PHONY: release
  33. release: tag
  34. ifdef version
  35. curl -sSLf -XPOST \
  36. -H "Authorization: token ${GITHUB_ACCESS_TOKEN}" \
  37. -H "Content-Type: application/json" \
  38. "https://api.github.com/repos/clarketm/${project}/releases" \
  39. --data "{\"tag_name\": \"v${version}\",\"target_commitish\": \"master\",\"name\": \"v${version}\",\"draft\": false,\"prerelease\": false}"
  40. endif
  41. .PHONY: upload
  42. publish upload: test clean build check
  43. twine upload dist/*
  44. .PHONY: deploy
  45. deploy: release publish