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