Skip to content

Commit 5549ee8

Browse files
authored
Merge pull request #4304 from pypa/feature/linting-cleanup
2 parents d69198c + e065e3c commit 5549ee8

17 files changed

+181
-32
lines changed

Makefile

Lines changed: 67 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,22 @@ venv_file := $(CURDIR)/.test_venv
44
get_venv_path =$(file < $(venv_file))
55
# This is how we will build tag-specific wheels, e.g. py36 or py37
66
PY_VERSIONS:= 2.7 3.5 3.6 3.7 3.8
7+
BACKSLASH = '\\'
78
# This is how we will build generic wheels, e.g. py2 or py3
89
INSTALL_TARGETS := $(addprefix install-py,$(PY_VERSIONS))
910
CLEAN_TARGETS := $(addprefix clean-py,$(PY_VERSIONS))
1011
DATE_STRING := $(shell date +%Y.%m.%d)
1112
THIS_MONTH_DATE := $(shell date +%Y.%m.01)
1213
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
1423

1524
format:
1625
black pipenv/*.py
@@ -19,10 +28,9 @@ test:
1928

2029
.PHONY: install
2130
install:
22-
pip install -e . && pipenv install --dev
31+
pip install -e .
2332

24-
install.stamp:
25-
[ ! -e install.stamp ] && $(MAKE) install
33+
install.stamp: install
2634
@touch install.stamp
2735

2836
.PHONY: install-py%
@@ -75,12 +83,8 @@ retest: virtualenv submodules test-install
7583
. $(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
7684

7785
.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
8488

8589
.PHONY: update-version
8690
update-version:
@@ -121,5 +125,56 @@ cleanbuild:
121125
@rm -rf build.stamp
122126

123127
.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/ \;

news/4271.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
``+`` signs in URL authentication fragments will no longer be incorrectly replaced with space ( `` `` ) characters.

news/4273.bugfix.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Fix a bug that Pipenv rejects to work under the root directory.
1+
Fixed a regression which caused Pipenv to fail when running under ``/``.

news/4274.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
``setup.py`` files with ``version`` variables read from ``os.environ`` are now able to be parsed successfully.

news/4276.bugfix.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Fix a bug that system-wide packages will be considered when inside a venv.
1+
Fixed a bug which caused Pipenv to fail to install packages in a virtual environment if those packages were already present in the system global environment.

news/4279.trivial.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
Remove expection of ``version`` key in ``test_ssh_vcs_install`` to prevent it
2-
from failing.
1+
Remove expection of ``version`` key in ``test_ssh_vcs_install`` to prevent it from failing.

news/4295.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed a regression with installing the current directory, or ``.``, inside a ``venv`` based virtual environment.

news/4296.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed a bug with the discovery of python paths on Windows which could prevent installation of environments during ``pipenv install``.

news/4298.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed an issue in the ``requirementslib`` AST parser which prevented parsing of ``setup.py`` files for dependency metadata.

news/4302.vendor.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
- Updated vendored dependencies:
2-
3-
- **pythonfinder**: ``1.2.2`` => ``1.2.4``
4-
- **requirementslib**: ``1.5.9`` => ``1.5.10``
1+
Updated vendored dependencies:
2+
- **pythonfinder**: ``1.2.2`` => ``1.2.4``
3+
- **requirementslib**: ``1.5.9`` => ``1.5.10``

0 commit comments

Comments
 (0)