-
Notifications
You must be signed in to change notification settings - Fork 212
/
Makefile
155 lines (132 loc) · 4.54 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
.PHONY: default deploy deploy-github deploy-pypi update-pypi clean tests env
TEST_ENV=env
DEV_TEST_ENV=env-dev
SETUP=pip install -U pip setuptools && python setup.py install > /dev/null
default:
: do nothing when dpkg-buildpackage runs this project Makefile
deploy-github:
git tag `grep "nodeenv_version =" nodeenv.py | grep -o -E '[0-9]\.[0-9]{1,2}\.[0-9]{1,2}'`
git push --tags origin master
deploy-pypi:
rm -rf dist
python setup.py sdist bdist_wheel
twine upload --repository pypi dist/*
update-pypi:
python setup.py register
deploy: contributors deploy-github deploy-pypi
clean:
@rm -rf nodeenv.egg-info/
@rm -rf dist/
@rm -rf build/
@rm -rf ${TEST_ENV}/
@rm -rf nodeenv/
clean-test-env:
@rm -rf ${TEST_ENV}
# https://virtualenv.pypa.io/en/legacy/reference.html#cmdoption-no-site-packages
# https://github.com/pypa/virtualenv/issues/1681
setup-test-env:
@virtualenv ${TEST_ENV} > /dev/null 2>&1
env: clean-test-env setup-test-env
@. ${TEST_ENV}/bin/activate && \
python setup.py install
# https://virtualenv.pypa.io/en/legacy/reference.html#cmdoption-no-site-packages
# https://github.com/pypa/virtualenv/issues/1681
env-dev:
@rm -rf ${DEV_TEST_ENV} && \
virtualenv ${DEV_TEST_ENV} && \
. ${DEV_TEST_ENV}/bin/activate && \
pip install -r requirements-dev.txt
test1: clean clean-test-env setup-test-env
@echo " ="
@echo " = test1: separate nodejs's env"
@echo " ="
@. ${TEST_ENV}/bin/activate && \
${SETUP} && \
nodeenv -j 4 nodeenv
test2: clean clean-test-env setup-test-env
@echo " ="
@echo " = test2: the same virtualenv's env, with 4 jobs"
@echo " ="
@. ${TEST_ENV}/bin/activate && \
${SETUP} && \
nodeenv -j 4 -p
test3: clean clean-test-env setup-test-env
@echo " ="
@echo " = test3: the same virtualenv's env, without any params"
@echo " ="
@. ${TEST_ENV}/bin/activate && \
${SETUP} && \
nodeenv -p
# https://github.com/ekalinin/nodeenv/issues/43
test4: clean clean-test-env
@echo " ="
@echo " = test4: system nodejs's for python3.9"
@echo " ="
@virtualenv --python=python3.9 ${TEST_ENV} && \
. ${TEST_ENV}/bin/activate && \
${SETUP} && \
nodeenv -p --node=system
test5: clean clean-test-env
@echo " ="
@echo " = test5: prebuilt nodejs's env for python2"
@echo " ="
@virtualenv --python=python2.7 ${TEST_ENV} && \
. ${TEST_ENV}/bin/activate && \
${SETUP} && \
nodeenv -p --prebuilt
test7: clean clean-test-env setup-test-env
@echo " ="
@echo " = test7: freeze for global installation"
@echo " ="
@. ${TEST_ENV}/bin/activate && \
${SETUP} && \
nodeenv -j 4 -p --prebuilt && \
. ${TEST_ENV}/bin/activate && \
npm install -g sitemap && \
npm -v && \
node -v && \
test "`freeze | grep -v corepack | wc -l`" = " 1";
test8: clean clean-test-env setup-test-env
@echo " ="
@echo " = test8: unicode paths, #49"
@echo " ="
@. ${TEST_ENV}/bin/activate && \
${SETUP} && \
rm -rf öäü && mkdir öäü && cd öäü && \
nodeenv -j 4 --prebuilt env && \
rm -rf öäü
test9: clean clean-test-env setup-test-env
@echo " ="
@echo " = test9: unicode paths, #187"
@echo " ="
@. ${TEST_ENV}/bin/activate && \
${SETUP} && \
rm -rf "test dir" && mkdir "test dir" && cd "test dir" && \
nodeenv -j 4 --prebuilt env && \
rm -rf "test dir"
test10: clean clean-test-env setup-test-env
@echo " ="
@echo " = test10: symlink does not fail if npm already exists, #189"
@echo " ="
@. ${TEST_ENV}/bin/activate && \
${SETUP} && \
nodeenv -j 4 -p --prebuilt && \
nodeenv -j 4 -p --prebuilt
tests: test1 test2 test3 test4 test7 test8 test9 test10 clean
ut: env-dev
@. ${DEV_TEST_ENV}/bin/activate && tox -e py39
coverage: env-dev
@. ${DEV_TEST_ENV}/bin/activate && \
coverage run -p -m pytest && \
coverage report -m && \
coverage html
contributors:
@echo "Nodeenv is written and maintained by Eugene Kalinin." > AUTHORS
@echo "" >> AUTHORS
@echo "Patches and Suggestions" >> AUTHORS
@echo '```````````````````````' >> AUTHORS
@echo "" >> AUTHORS
@git log --raw | grep "^Author: " | \
sort | uniq -c | sort -n -r | \
cut -d ':' -f 2 | sed 's/^/- /' | \
cut -d '<' -f1 | uniq | grep -v Kalinin | sed 's/ *$$//g' >> AUTHORS