-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a98fd60
commit 99dcc74
Showing
2 changed files
with
45 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# build outputs | ||
/dist/* | ||
/build/* | ||
/lib/PyYAML.egg-info/* | ||
/.venv/ | ||
/wheelhouse/* | ||
/yaml/_yaml.c | ||
MANIFEST | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,62 @@ | ||
SHELL := bash | ||
|
||
.PHONY: build dist | ||
PYTHON ?= $(shell command -v python3) | ||
PYTHON ?= $(shell command -v python) | ||
|
||
PYTHON=/usr/bin/python3 | ||
TEST= | ||
PARAMETERS= | ||
ifndef PYTHON | ||
$(error Can't find 'python3'. Set PYTHON=/path/to/bin/python3) | ||
endif | ||
|
||
build: | ||
${PYTHON} setup.py build ${PARAMETERS} | ||
ifeq (,$(shell $(PYTHON) --version | grep -E 'Python 3\.([6789]|1[0-9])\.' || true)) | ||
$(error Unsupported python version. Needs 3.6+) | ||
endif | ||
|
||
buildext: | ||
${PYTHON} setup.py --with-libyaml build ${PARAMETERS} | ||
VENV ?= .venv | ||
|
||
force: | ||
${PYTHON} setup.py build -f ${PARAMETERS} | ||
export PATH := $(VENV)/bin:$(PATH) | ||
|
||
forceext: | ||
${PYTHON} setup.py --with-libyaml build -f ${PARAMETERS} | ||
o ?= | ||
|
||
install: | ||
${PYTHON} setup.py install ${PARAMETERS} | ||
.DELETE_ON_ERROR: | ||
|
||
installext: | ||
${PYTHON} setup.py --with-libyaml install ${PARAMETERS} | ||
default: | ||
|
||
test: build | ||
PYYAML_FORCE_LIBYAML=0 ${PYTHON} -I -m pytest | ||
test: venv | ||
PYYAML_FORCE_LIBYAML=0 pytest | ||
|
||
testext: buildext | ||
PYYAML_FORCE_LIBYAML=1 ${PYTHON} -I -m pytest | ||
test-ext: venv | ||
PYYAML_FORCE_LIBYAML=1 pytest | ||
|
||
testall: | ||
${PYTHON} -m pytest | ||
build: venv | ||
${PYTHON} setup.py build ${o} | ||
|
||
dist: | ||
@# No longer uploading a zip file to pypi | ||
@# ${PYTHON} setup.py --with-libyaml sdist --formats=zip,gztar | ||
${PYTHON} setup.py --with-libyaml sdist --formats=gztar | ||
build-ext: venv | ||
${PYTHON} setup.py --with-libyaml build ${o} | ||
|
||
install: venv | ||
${PYTHON} setup.py install ${o} | ||
|
||
installext: venv | ||
${PYTHON} setup.py --with-libyaml install ${o} | ||
|
||
clean: | ||
${PYTHON} setup.py --with-libyaml clean -a | ||
rm -fr \ | ||
dist/ \ | ||
$(RM) -r \ | ||
.pytest_cache/ \ | ||
lib/PyYAML.egg-info/ \ | ||
lib/yaml/__pycache__/ \ | ||
tests/__pycache__/ \ | ||
tests/legacy_tests/__pycache__/ \ | ||
yaml/_yaml.c | ||
tests/legacy_tests/__pycache__/ | ||
$(RM) yaml/_yaml.c \ | ||
lib/yaml/_yaml.cpython-* | ||
|
||
distclean: clean | ||
$(RM) -r $(VENV) | ||
|
||
venv: $(VENV) | ||
|
||
$(VENV): | ||
$(PYTHON) -m venv $@ | ||
@echo $(PATH) | ||
pip install pytest | ||
pip install -e . |