File: Makefile

package info (click to toggle)
python-reedsolo 1.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 328 kB
  • sloc: python: 1,452; makefile: 88; sh: 2
file content (125 lines) | stat: -rw-r--r-- 3,801 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# This Makefile runs tests and builds the package to upload to pypi
# To use this Makefile, pip install py-make
# You also need to pip install also other required modules: `pip install flake8 nose coverage twine pytest pytest-cov`
# Up to Python 3.9 included, nosetests was used, but from 3.10 onward, support for it was dropped since it is not maintained anymore, so that pytest and pytest-cov are used instead.
# Then, cd to this folder, and type `pymake -p` to list all commands, then `pymake <command>` to run the related entry.
# To test on multiple Python versions, install them, install also the C++ redistributables for each (so that Cython works), and then type `pymake testtox`.
# To pymake buildupload (deploy on pypi), you need to `pip install cython` and install a C++ compiler, on Windows and with Python 3.7 you need Microsoft Visual C++ 14.0. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/fr/visual-cpp-build-tools/
# for Python 3.10, read the updated instructions at: https://wiki.python.org/moin/WindowsCompilers

.PHONY:
	alltests
	all
	flake8
	test
	testsetup
    testsetuppost
	testcoverage
    testtox
	distclean
	coverclean
	prebuildclean
	clean
    toxclean
	installdev
	install
	build
	buildupload
	pypi
	help

help:
	@+make -p

alltests:
	@+make test
	@+make flake8
	@+make testsetup

all:
	@+make alltests
	@+make build

flake8:
	@+flake8 -j 8 --count --statistics --exit-zero .

test:
     # Build the Cython extension
	python setup.py build_ext --inplace
     # Run the tests
	python -m unittest discover tests

testnobinary:
     # Run the tests
	python -m unittest discover tests
     #pytest --cov-branch

testnose:
    nosetests -vv --with-coverage

testtox:
    # Test for multiple Python versions
	tox --skip-missing-interpreters -p all

testsetup:
	python setup.py check --metadata --restructuredtext --strict

testsetuppost:
	twine check "dist/*"

testcoverage:
     # This is the preferred way to run the tests since Python 3.10
	@+make coverclean
     # Build the Cython extension
	#python setup.py build_ext --inplace --cythonize  # unnecessary to call build_ext --inplace now
    python setup.py develop --cythonize
     # Run the tests
	# nosetests reedsolo --with-coverage --cover-package=reedsolo --cover-erase --cover-min-percentage=80 -d -v
     # With PyTest, it is now necessary to first install the python module so that it is found (--cov=<module>)
     #python setup.py develop
     #pytest --cov-report term-missing --cov-config=.coveragerc --cov=. tests/ --cov-branch
     #python setup.py develop --uninstall
    coverage run --branch -m pytest . -v
    coverage report -m


distclean:
	@+make coverclean
	@+make prebuildclean
	@+make clean
    @+make toxclean
prebuildclean:
	@+python -c "import shutil; shutil.rmtree('build', True)"
	@+python -c "import shutil; shutil.rmtree('dist', True)"
	@+python -c "import shutil; shutil.rmtree('reedsolo.egg-info', True)"
coverclean:
	@+python -c "import os; os.remove('.coverage') if os.path.exists('.coverage') else None"
	@+python -c "import shutil; shutil.rmtree('__pycache__', True)"
	@+python -c "import shutil; shutil.rmtree('tests/__pycache__', True)"
clean:
	@+python -c "import os, glob; [os.remove(i) for i in glob.glob('*.py[co]')]"
	@+python -c "import os, glob; [os.remove(i) for i in glob.glob('tests/*.py[co]')]"
toxclean:
	@+python -c "import shutil; shutil.rmtree('.tox', True)"


installdev:
	@+python setup.py develop --uninstall
	@+python setup.py develop

install:
	@+python setup.py install

build:
	@+make prebuildclean
	@+make testsetup
	@+python setup.py sdist bdist_wheel
	# @+python setup.py bdist_wininst
    pymake testsetuppost  # @+make does not work here, dunno why

pypi:
	twine upload dist/*

buildupload:
	@+make build
	@+make pypi