forked from pypa/pipenv
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
122 lines (97 loc) · 3.53 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
get_venv_dir:=$(shell mktemp -d 2>/dev/null || mktemp -d -t 'tmpvenv')
venv_dir := $(get_venv_dir)/pipenv_venv
venv_file := $(CURDIR)/.test_venv
get_venv_path =$(file < $(venv_file))
# This is how we will build tag-specific wheels, e.g. py36 or py37
PY_VERSIONS:= 2.7 3.5 3.6 3.7 3.8
# This is how we will build generic wheels, e.g. py2 or py3
INSTALL_TARGETS := $(addprefix install-py,$(PY_VERSIONS))
CLEAN_TARGETS := $(addprefix clean-py,$(PY_VERSIONS))
DATE_STRING := $(shell date +%Y.%m.%d)
THIS_MONTH_DATE := $(shell date +%Y.%m.01)
NEXT_MONTH_DATE := $(shell date -d "+1 month" +%Y.%m.01)
format:
black pipenv/*.py
test:
docker-compose up
.PHONY: install
install:
pip install -e . && pipenv install --dev
install.stamp:
[ ! -e install.stamp ] && $(MAKE) install
@touch install.stamp
.PHONY: install-py%
install-py%: install.stamp
@echo building for $(addprefix python, $(subst install-py,,$@))
PIPENV_PYTHON=$(subst install-py,,$@) pipenv install --dev
install-virtualenvs.stamp: ${INSTALL_TARGETS}
@touch install-virtualenvs.stamp
.PHONY: ramdisk
ramdisk:
sudo mkdir -p /mnt/ramdisk
sudo mount -t tmpfs -o size=2g tmpfs /mnt/ramdisk
sudo chown -R ${USER}:${USER} /mnt/ramdisk
.PHONY: ramdisk-virtualenv
ramdisk-virtualenv: ramdisk
[ ! -e "/mnt/ramdisk/.venv/bin/activate" ] && \
python -m virtualenv /mnt/ramdisk/.venv
@echo "/mnt/ramdisk/.venv" >> $(venv_file)
.PHONY: virtualenv
virtualenv:
[ ! -e $(venv_dir) ] && rm -rf $(venv_file) && python -m virtualenv $(venv_dir)
@echo $(venv_dir) >> $(venv_file)
.PHONY: test-install
test-install: virtualenv
. $(get_venv_path)/bin/activate && \
python -m pip install --upgrade pip virtualenv -e .[tests,dev] && \
pipenv install --dev
.PHONY: submodules
submodules:
git submodule sync
git submodule update --init --recursive
.PHONY: tests
tests: virtualenv submodules test-install
. $(get_venv_path)/bin/activate && \
pipenv run pytest -ra -vvv --full-trace --tb=long
.PHONY: test-specific
test-specific: submodules virtualenv test-install
. $(get_venv_path)/bin/activate && pipenv run pytest -ra -k '$(tests)'
.PHONY: retest
retest: virtualenv submodules test-install
. $(get_venv_path)/bin/activate && pipenv run pytest -ra -k 'test_check_unused or test_install_editable_git_tag or test_get_vcs_refs or test_skip_requirements_when_pipfile or test_editable_vcs_install or test_basic_vcs_install or test_git_vcs_install or test_ssh_vcs_install or test_vcs_can_use_markers' -vvv --full-trace --tb=long
.PHONY: build
build: install.stamp
pipenv run python setup.py sdist bdist_wheel
build.stamp:
[ ! -e build.stamp ] && $(MAKE) build
@touch build.stamp
.PHONY: update-version
update-version:
@sed -i "s/^__version__ = .\+$\/__version__ = \"$(DATE_STRING)\"/g" ./pipenv/__version__.py
.PHONY: update-prerelease-version
update-prerelease-version:
@sed -i "s/^__version__ = .\+$\/__version__ = \"$(THIS_MONTH_DATE).a1\"/g" ./pipenv/__version__.py
.PHONY: pre-bump
pre-bump:
@sed -i "s/^__version__ = .\+$\/__version__ = \"$(NEXT_MONTH_DATE).dev0\"/g" ./pipenv/__version__.py
.PHONY: lint
lint:
flake8 .
.PHONY: check
check: build.stamp
pipenv run twine check dist/* && pipenv run check-manifest .
.PHONY: upload-test
upload-test: build
twine upload --repository=testpypi dist/*
.PHONY: clean-py%
clean-py%:
@echo "cleaning environment for $@..."
PIPENV_PYTHON="$(subst clean-py,,$@)" pipenv --rm
.PHONY: cleanbuild
cleanbuild:
@echo "cleaning up existing builds..."
@rm -rf build/ dist/
@rm -rf build.stamp
.PHONY: clean
clean: cleanbuild
rm -rf install.stamp build.stamp install-virtualenvs.stamp