Skip to content

Commit 495792b

Browse files
committed
use python -m pip instead of pip
see pypa/pip#5221
1 parent f6e95a9 commit 495792b

File tree

1 file changed

+34
-33
lines changed

1 file changed

+34
-33
lines changed

{{cookiecutter.project_slug}}/Makefile

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
.PHONY: build docs
1+
².PHONY: build docs
22

33
# ==================================================================================================
44
# Variables
55
# ==================================================================================================
66

77
MODULES:={{ cookiecutter.project_slug }}
88
PACKAGE_NAME:={{ cookiecutter.project_slug }}
9-
9+
PIP:=/usr/bin/env python3 -m pip
10+
PIPENV:=/usr/bin/env pipenv
1011

1112
# ==================================================================================================
1213
# do-it-all targets
@@ -22,28 +23,28 @@ dev: ensure-pipenv pipenv-install-dev requirements ln-venv
2223
# ==================================================================================================
2324

2425
ensure-pipenv:
25-
pip3 install --user --upgrade 'pipenv>=9.0' 'pip>=9.0'
26+
$(PIP) install --user --upgrade 'pipenv>=9.0' 'pip>=9.0'
2627
@echo "ensure your local python install is in your PATH"
2728

2829
pipenv-install-dev:
29-
pipenv install --dev
30+
$(PIPENV) install --dev
3031

3132
ln-venv:
3233
# use that to configure a symbolic link to the virtualenv in .venv
3334
rm -rf .venv
34-
ln -s $$(pipenv --venv) .venv
35+
ln -s $$($(PIPENV) --venv) .venv
3536

3637
.venv: ln-venv
3738

3839
install-local: install-local-only-deps install-local-only-curpackage
3940

4041
install-local-only-deps:
4142
# Install only dependencies
42-
pipenv install
43+
$(PIPENV) install
4344

4445
install-local-only-curpackage:
4546
# Install current package as well
46-
pipenv run pip install .
47+
$(PIPENV) run pip install .
4748

4849

4950
# ==================================================================================================
@@ -53,13 +54,13 @@ install-local-only-curpackage:
5354
style: isort autopep8 yapf
5455

5556
isort:
56-
pipenv run isort -y -rc $(MODULES)
57+
$(PIPENV) run isort -y -rc $(MODULES)
5758

5859
autopep8:
59-
pipenv run autopep8 --in-place --recursive setup.py $(MODULES)
60+
$(PIPENV) run autopep8 --in-place --recursive setup.py $(MODULES)
6061

6162
yapf:
62-
pipenv run yapf --style .yapf --recursive -i $(MODULES)
63+
$(PIPENV) run yapf --style .yapf --recursive -i $(MODULES)
6364

6465
format: style
6566

@@ -71,20 +72,20 @@ format: style
7172
checks: pep508 isort-check flake8 pylint mypy
7273

7374
pep508:
74-
pipenv check
75+
$(PIPENV) check
7576

7677
isort-check:
77-
pipenv run isort -c -rc $(MODULES)
78+
$(PIPENV) run isort -c -rc $(MODULES)
7879

7980
flake8:
80-
pipenv run python setup.py flake8
81+
$(PIPENV) run python setup.py flake8
8182

8283
pylint:
83-
pipenv run pylint --rcfile=.pylintrc --output-format=colorized $(MODULES)
84+
$(PIPENV) run pylint --rcfile=.pylintrc --output-format=colorized $(MODULES)
8485

8586
mypy:
8687
# Static type checker only enabled on methods that uses Python Type Annotations
87-
pipenv run mypy --config-file .mypy.ini $(MODULES)
88+
$(PIPENV) run mypy --config-file .mypy.ini $(MODULES)
8889

8990
clean-mypy:
9091
rm -rf .venv .mypy_cache || true
@@ -98,13 +99,13 @@ sct: style check test
9899
# ==================================================================================================
99100

100101
test:
101-
pipenv run pytest $(MODULES)
102+
$(PIPENV) run pytest $(MODULES)
102103

103104
test-v:
104-
pipenv run pytest -vv $(MODULES)
105+
$(PIPENV) run pytest -vv $(MODULES)
105106

106107
test-coverage:
107-
pipenv run py.test -v --cov $(PACKAGE_NAME) --cov-report html:coverage_html --cov-report term $(MODULES)
108+
$(PIPENV) run py.test -v --cov $(PACKAGE_NAME) --cov-report html:coverage_html --cov-report term $(MODULES)
108109

109110

110111
# ==================================================================================================
@@ -116,13 +117,13 @@ dists: requirements sdist bdist wheels
116117
build: dists
117118

118119
sdist:
119-
pipenv run python setup.py sdist
120+
$(PIPENV) run python setup.py sdist
120121

121122
bdist:
122-
pipenv run python setup.py bdist
123+
$(PIPENV) run python setup.py bdist
123124

124125
wheel:
125-
pipenv run python setup.py bdist_wheel
126+
$(PIPENV) run python setup.py bdist_wheel
126127

127128
clean-dist:
128129
rm -rfv build dist/
@@ -143,29 +144,29 @@ docker:
143144
# ==================================================================================================
144145

145146
shell:
146-
pipenv shell
147+
$(PIPENV) shell
147148

148149
ctags:
149150
find -name '*.py' -exec ctags -a {} \;
150151

151152
update: pipenv-update dev
152153

153154
pipenv-update:
154-
pipenv update
155+
$(PIPENV) update
155156

156157
requirements:
157158
# needed until PBR supports `Pipfile`
158159
{% if cookiecutter.is_application -%}
159160
# Freeze requirements for applications
160-
pipenv run pipenv_to_requirements --freeze
161+
$(PIPENV) run pipenv_to_requirements --freeze
161162
{% else -%}
162-
pipenv run pipenv_to_requirements
163+
$(PIPENV) run pipenv_to_requirements
163164
{%- endif %}
164165

165166
update-recreate: update style check test
166167

167168
lock:
168-
pipenv lock
169+
$(PIPENV) lock
169170

170171

171172
githook: style requirements
@@ -178,12 +179,12 @@ githook: style requirements
178179
tag-pbr:
179180
@{ \
180181
set -e ;\
181-
export VERSION=$$(pipenv run python setup.py --version | cut -d. -f1,2,3); \
182+
export VERSION=$$($(PIPENV) run python setup.py --version | cut -d. -f1,2,3); \
182183
echo "I: Computed new version: $$VERSION"; \
183184
echo "I: presse ENTER to accept or type new version number:"; \
184185
read VERSION_OVERRIDE; \
185186
VERSION=$${VERSION_OVERRIDE:-$$VERSION}; \
186-
PROJECTNAME=$$(pipenv run python setup.py --name); \
187+
PROJECTNAME=$$($(PIPENV) run python setup.py --name); \
187188
echo "I: Tagging $$PROJECTNAME in version $$VERSION with tag: $$VERSION" ; \
188189
echo "$$ git tag -s $$VERSION -m \"$$PROJECTNAME $$VERSION\""; \
189190
echo "I: Pushing tag $$VERSION, press ENTER to continue, C-c to interrupt"; \
@@ -199,7 +200,7 @@ push: githook
199200
git push origin --tags
200201

201202
publish: clean-dist dists
202-
pipenv run python setup.py sdist bdist_wheel upload -r pypi-test || true
203+
$(PIPENV) run python setup.py sdist bdist_wheel upload -r pypi-test || true
203204

204205

205206

@@ -208,7 +209,7 @@ publish: clean-dist dists
208209
# ==================================================================================================
209210

210211
clean: clean-dist clean-docs clean-mypy
211-
pipenv --rm || true
212+
$(PIPENV) --rm || true
212213
find . -name '__pycache__' -exec rm -rf {} \; || true
213214
find . -name '.cache' -exec rm -rf {} \; || true
214215
find . -name '*.egg-info' -exec rm -rf {} \; || true
@@ -220,13 +221,13 @@ clean: clean-dist clean-docs clean-mypy
220221
# ==================================================================================================
221222

222223
docs: clean-docs sdist
223-
pipenv run make -C docs/ html
224+
$(PIPENV) run make -C docs/ html
224225

225226
clean-docs:
226227
rm -rfv docs/_build
227228

228229
docs-apidoc:
229-
pipenv run sphinx-apidoc \
230+
$(PIPENV) run sphinx-apidoc \
230231
-f \
231232
-o docs/source/reference \
232233
-e \
@@ -245,7 +246,7 @@ docs-open:
245246

246247
run:
247248
# add you run commands here
248-
# pipenv run ...
249+
# $(PIPENV) run ...
249250

250251

251252
# ==================================================================================================

0 commit comments

Comments
 (0)