From d03d3ca0cb0b0daa97f2acaea4dc52a9308415fc Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Fri, 24 Apr 2020 03:26:38 -0400 Subject: [PATCH] Overhaul makefile and allow universal wheels - Add makefile tasks for building, checking builds, and simple version updates Signed-off-by: Dan Ryan --- Makefile | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 4 ++++ 2 files changed, 71 insertions(+) diff --git a/Makefile b/Makefile index 059945bb..cefc7fea 100644 --- a/Makefile +++ b/Makefile @@ -2,12 +2,36 @@ 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 . + +install.stamp: 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 @@ -48,3 +72,46 @@ test-specific: submodules virtualenv test-install .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-virtualenvs.stamp install.stamp + PIPENV_PYTHON=3.7 pipenv run python setup.py sdist bdist_wheel + +.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: + rm -rf install.stamp build.stamp install-virtualenvs.stamp diff --git a/setup.cfg b/setup.cfg index fbc691d4..c9ac02b6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -65,3 +65,7 @@ norecursedirs = filterwarnings = ignore::DeprecationWarning ignore::PendingDeprecationWarning + +[bdist_wheel] +universal = 1 +zip_safe = true