Skip to content

Commit fa46c0a

Browse files
authored
Check python3 (#1478)
1 parent 5883109 commit fa46c0a

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

Makefile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,19 @@ dev: install-dep
6666
## dist : create a module package for distribution
6767
dist: dist/${MODULE}-$(VERSION).tar.gz
6868

69-
dist/${MODULE}-$(VERSION).tar.gz: $(SOURCES)
69+
check-python3:
70+
# Check that the default python version is python 3
71+
python --version 2>&1 | grep "Python 3"
72+
73+
dist/${MODULE}-$(VERSION).tar.gz: check-python3 $(SOURCES)
7074
python setup.py sdist bdist_wheel
7175

7276
## docs : make the docs
7377
docs: FORCE
7478
cd docs && $(MAKE) html
7579

7680
## clean : clean up all temporary / machine-generated files
77-
clean: FORCE
81+
clean: check-python3 FORCE
7882
rm -f ${MODILE}/*.pyc tests/*.pyc
7983
python setup.py clean --all || true
8084
rm -Rf .coverage
@@ -142,11 +146,11 @@ diff-cover.html: coverage.xml
142146
diff-cover --compare-branch=main $^ --html-report $@
143147

144148
## test : run the ${MODULE} test suite
145-
test: $(PYSOURCES)
149+
test: check-python3 $(PYSOURCES)
146150
python -m pytest ${PYTEST_EXTRA}
147151

148152
## testcov : run the ${MODULE} test suite and collect coverage
149-
testcov: $(PYSOURCES)
153+
testcov: check-python3 $(PYSOURCES)
150154
python -m pytest --cov --cov-config=.coveragerc --cov-report= ${PYTEST_EXTRA}
151155

152156
sloccount.sc: $(PYSOURCES) Makefile
@@ -162,10 +166,10 @@ list-author-emails:
162166

163167
mypy3: mypy
164168
mypy: $(filter-out setup.py gittagger.py,$(PYSOURCES))
165-
if ! test -f $(shell python3 -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))')/py.typed ; \
169+
if ! test -f $(shell python -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))')/py.typed ; \
166170
then \
167171
rm -Rf typeshed/ruamel/yaml ; \
168-
ln -s $(shell python3 -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))') \
172+
ln -s $(shell python -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))') \
169173
typeshed/ruamel/ ; \
170174
fi # if minimally required ruamel.yaml version is 0.15.99 or greater, than the above can be removed
171175
MYPYPATH=$$MYPYPATH:typeshed mypy $^
@@ -181,7 +185,7 @@ shellcheck: FORCE
181185
pyupgrade: $(PYSOURCES)
182186
pyupgrade --exit-zero-even-if-changed --py36-plus $^
183187

184-
release-test: FORCE
188+
release-test: check-python3 FORCE
185189
git diff-index --quiet HEAD -- || ( echo You have uncommited changes, please commit them and try again; false )
186190
./release-test.sh
187191

release-test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fi
1919
test_prefix=""
2020
run_tests() {
2121
local mod_loc
22-
mod_loc=$(pip show ${package} |
22+
mod_loc=$(pip show ${package} |
2323
grep ^Location | awk '{print $2}')/${module}
2424
"${test_prefix}"bin/py.test "--ignore=${mod_loc}/schemas/" \
2525
--pyargs -x ${module} -n auto --dist=loadfile
@@ -42,6 +42,7 @@ then
4242
&& pip install --force-reinstall -U pip==${pipver} \
4343
&& pip install setuptools==${setuptoolsver} wheel
4444
pip install -rtest-requirements.txt
45+
pip install -e .
4546
make test
4647
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; make install
4748
mkdir testenv1/not-${module}

0 commit comments

Comments
 (0)