-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
59 lines (54 loc) · 1.51 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
57
58
59
VENV=.venv
PYPI_USER=$(shell echo ${TWINE_USERNAME} | base64 -d)
PYPI_PASS=$(shell echo ${TWINE_PASSWORD} | base64 -d)
.PHONY: init-venv
init-venv:
@echo "Start init-venv..."
@test -d ${VENV} && echo "Virtual environment is exists." \
|| python3 -m venv ${VENV}
@. ${VENV}/bin/activate \
&& echo "Installing python libraries..." \
&& pip install -q --upgrade pip \
&& pip install -q -r requirements.txt
@echo "Finish init-venv"
.PHONY: clean
clean:
@echo "Start clean..."
rm -rf build dist VERSION.txt
find . -name '__pycache__' -type d |xargs rm -rf
find . -name '*.egg-info' -type d |xargs rm -rf
find . -name '*.egg-info' -type f -delete
find . -name '*~' -type f -delete
find ./pygeckodriver -name 'geckodriver_*' -type f -delete
@echo "Finish clean"
.PHONY: build
build: init-venv
@echo "Start build..."
@. ${VENV}/bin/activate \
&& python ./update.py \
&& python ./setup.py sdist bdist_wheel \
|| :
@echo "Finish build"
.PHONY: upload-test
upload-test: clean build
@echo "Start upload-test..."
@test -f VERSION.txt \
&& . ${VENV}/bin/activate \
&& python -m twine upload \
-u ${PYPI_USER} \
-p ${PYPI_PASS} \
--repository-url 'https://test.pypi.org/legacy/' \
dist/* \
|| echo 'Upload nothing'
@echo "Finish upload-test"
.PHONY: upload-pypi
upload-pypi: clean build
@echo "Start upload-pypi..."
@test -f VERSION.txt \
&& . ${VENV}/bin/activate \
&& python -m twine upload \
-u ${PYPI_USER} \
-p ${PYPI_PASS} \
dist/* \
|| echo 'Upload nothing'
@echo "Finish upload-pypi"