@@ -4,13 +4,22 @@ venv_file := $(CURDIR)/.test_venv
4
4
get_venv_path =$(file < $(venv_file ) )
5
5
# This is how we will build tag-specific wheels, e.g. py36 or py37
6
6
PY_VERSIONS: = 2.7 3.5 3.6 3.7 3.8
7
+ BACKSLASH = '\\'
7
8
# This is how we will build generic wheels, e.g. py2 or py3
8
9
INSTALL_TARGETS := $(addprefix install-py,$(PY_VERSIONS ) )
9
10
CLEAN_TARGETS := $(addprefix clean-py,$(PY_VERSIONS ) )
10
11
DATE_STRING := $(shell date +% Y.% m.% d)
11
12
THIS_MONTH_DATE := $(shell date +% Y.% m.01)
12
13
NEXT_MONTH_DATE := $(shell date -d "+1 month" +% Y.% m.01)
13
-
14
+ PATCHED_PIP_VERSION := $(shell awk '/__version__/{gsub(/"/,"",$$3) ; print $$3}' pipenv/patched/notpip/__init__.py)
15
+ PATCHED_PIPTOOLS_VERSION := $(shell awk -F "=" '/pip-tools/ {print $$3}' pipenv/patched/patched.txt)
16
+ GITDIR_STAMPFILE := $(CURDIR ) /.git-checkout-dir
17
+ create_git_tmpdir = $(shell mktemp -dt pipenv-vendor-XXXXXXXX 2>/dev/null || mktemp -d 2>/dev/null)
18
+ write_git_tmpdir = $(file > $(GITDIR_STAMPFILE ) ,$(create_git_tmpdir ) )
19
+ get_checkout_dir = $(file < $(GITDIR_STAMPFILE ) )
20
+ get_checkout_subdir = $(addprefix $(get_checkout_dir ) , $(1 ) )
21
+ pip-checkout-dir = $(get_checkout_dir ) /patch-pip
22
+ piptools-checkout-dir = $(get_checkout_dir ) /patch-piptools
14
23
15
24
format :
16
25
black pipenv/* .py
19
28
20
29
.PHONY : install
21
30
install :
22
- pip install -e . && pipenv install --dev
31
+ pip install -e .
23
32
24
- install.stamp :
25
- [ ! -e install.stamp ] && $(MAKE ) install
33
+ install.stamp : install
26
34
@touch install.stamp
27
35
28
36
.PHONY : install-py%
@@ -75,12 +83,8 @@ retest: virtualenv submodules test-install
75
83
. $(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
76
84
77
85
.PHONY : build
78
- build : install.stamp
79
- pipenv run python setup.py sdist bdist_wheel
80
-
81
- build.stamp :
82
- [ ! -e build.stamp ] && $(MAKE ) build
83
- @touch build.stamp
86
+ build : install-virtualenvs.stamp install.stamp
87
+ PIPENV_PYTHON=3.7 pipenv run python setup.py sdist bdist_wheel
84
88
85
89
.PHONY : update-version
86
90
update-version :
@@ -121,5 +125,56 @@ cleanbuild:
121
125
@rm -rf build.stamp
122
126
123
127
.PHONY : clean
124
- clean : cleanbuild
125
- rm -rf install.stamp build.stamp install-virtualenvs.stamp
128
+ clean :
129
+ rm -rf install.stamp build.stamp install-virtualenvs.stamp .git-checkout-dir
130
+
131
+ .PHONY : gitclean
132
+ gitclean :
133
+ @echo " Cleaning up git trees..."
134
+ @rm -rf $(file < .git-checkout-dir)
135
+ @echo " Cleaning up git checkout stamp"
136
+ @rm -rf .git-checkout-dir
137
+
138
+ .git-checkout-dir :
139
+ @echo " Creating git repo temp file"
140
+ @echo " Creating git checkout stamp file at .git-checkout-dir"
141
+ @echo $(file > $(CURDIR ) /.git-checkout-dir,$(shell mktemp -dt pipenv-vendor-XXXXXXXX 2>/dev/null || mktemp -d 2>/dev/null) )
142
+
143
+ .PHONY : clone-pip
144
+ clone-pip : .git-checkout-dir
145
+ [ -e $( pip-checkout-dir) ] && echo " Pip already exists, moving on!" || git clone https://github.com/pypa/pip.git $(pip-checkout-dir ) -b $(PATCHED_PIP_VERSION )
146
+
147
+ .PHONY : clone-piptools
148
+ clone-piptools : .git-checkout-dir
149
+ [ -e $( piptools-checkout-dir) ] && echo " Piptools already exists, moving on!" || git clone https://github.com/jazzband/pip-tools.git $(piptools-checkout-dir ) -b $(PATCHED_PIPTOOLS_VERSION )
150
+
151
+ .PHONY : patch-pip
152
+ patch-pip : clone-pip
153
+ @find $(CURDIR ) /tasks/vendoring/patches/patched/ -regex " .*/pip[0-9]+.patch" -exec cp {} $(pip-checkout-dir ) \;
154
+ @sed -i -r ' s:([a-b]\/)pipenv/patched/:\1src/:g' $(pip-checkout-dir ) /* .patch
155
+ @find $(CURDIR ) /tasks/vendoring/patches/patched/ -regex " .*/_post-pip-[^/\.]*.patch" -exec cp {} $(pip-checkout-dir ) / \;
156
+ @sed -i -r ' s:([a-b]\/)pipenv/patched/not:\1src/:g' $(pip-checkout-dir ) /_post-* .patch
157
+ @cd $(pip-checkout-dir ) / && git apply --ignore-whitespace --verbose pip* .patch
158
+ @echo " Head to $( pip-checkout-dir) to update the pip patches to the latest version"
159
+
160
+ .PHONY : patch-piptools
161
+ patch-piptools : clone-piptools
162
+ @find $(CURDIR ) /tasks/vendoring/patches/patched/ -regex " .*/piptools[^/\.]*.patch" -exec cp {} $(piptools-checkout-dir ) / \;
163
+ @sed -i -r ' s:([a-b]\/)pipenv/patched/:\1/:g' $(piptools-checkout-dir ) /* .patch
164
+ @cd $(piptools-checkout-dir ) / && git apply --ignore-whitespace --verbose piptools* .patch
165
+ @echo " Head to $( piptools-checkout-dir) to update the piptools patches to the latest version"
166
+
167
+ .PHONY : patches
168
+ patches : patch-pip patch-piptools
169
+
170
+ .PHONY : reimport-pip-patch
171
+ reimport-pip-patch :
172
+ @sed -i -r ' s:([a-b]\/)src/:\1pipenv/patched/not:g' $(pip-checkout-dir ) /_post-* .patch
173
+ @sed -i -r ' s:([a-b]\/)src/:\1pipenv/patched/:g' $(pip-checkout-dir ) /pip* .patch
174
+ @find $(pip-checkout-dir ) -maxdepth 1 -regex " .*/pip[0-9]+.patch" -exec cp {} $(CURDIR ) /tasks/vendoring/patches/patched/ \;
175
+ @find $(pip-checkout-dir ) -maxdepth 1 -regex " .*/_post-pip-[^/\.]*.patch" -exec cp {} $(CURDIR ) /tasks/vendoring/patches/patched/ \;
176
+
177
+ .PHONY : reimport-piptools-patch
178
+ reimport-piptools-patch :
179
+ @sed -i -r ' s:([a-b]\/):\1pipenv/patched/:g' $(piptools-checkout-dir ) /* .patch
180
+ @find $(piptools-checkout-dir ) / -maxdepth 1 -regex " .*/piptools[^/\.]*.patch" -exec cp {} $(CURDIR ) /tasks/vendoring/patches/patched/ \;
0 commit comments