@@ -66,15 +66,19 @@ dev: install-dep
6666# # dist : create a module package for distribution
6767dist : 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
7377docs : 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
152156sloccount.sc : $(PYSOURCES ) Makefile
@@ -162,10 +166,10 @@ list-author-emails:
162166
163167mypy3 : mypy
164168mypy : $(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
181185pyupgrade : $(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
0 commit comments