|
1 | 1 | TEST_DIR=tests
|
| 2 | +#PYPI_URL=https://test.pypi.org/legacy/ |
| 3 | +PYPI_URL=https://upload.pypi.org/legacy/ |
| 4 | +DEFAULT_PYTHON_VERSION=three |
2 | 5 |
|
3 | 6 | ## Sets up the virtual environment via pipenv.
|
4 | 7 | .PHONY: setup
|
5 | 8 | setup:
|
6 |
| - pipenv --three install --dev |
| 9 | + pipenv --$(DEFAULT_PYTHON_VERSION) install --dev |
7 | 10 |
|
8 |
| -## Cleans test and packaging outputs. |
| 11 | +## Removes everything including virtual environments. |
9 | 12 | .PHONY: clean
|
10 |
| -clean: |
11 |
| - rm -rf .coverage htmlcov/ build/ dist/ |
| 13 | +clean: mostlyclean |
| 14 | + -pipenv --rm |
| 15 | + rm -f Pipfile.lock |
| 16 | + |
| 17 | +## Removes test and packaging outputs. |
| 18 | +.PHONY: mostlyclean |
| 19 | +mostlyclean: |
| 20 | + rm -rf .coverage htmlcov/ .pytest_cache/ build/ dist/ |
12 | 21 |
|
13 | 22 | ## Runs tests.
|
14 | 23 | .PHONY: test
|
15 |
| -test: clean |
| 24 | +test: |
16 | 25 | pipenv run pytest $(TEST_DIR) -v -s --disable-warnings
|
17 | 26 |
|
18 | 27 | ## Creates coverage report.
|
19 | 28 | .PHONY: coverage
|
20 | 29 | coverage:
|
21 |
| - pytest --cov=src/ --cov-report=term-missing --cov-report=html --disable-warnings |
| 30 | + pipenv run pytest --cov=src/ --cov-report=term-missing --cov-report=html --disable-warnings |
22 | 31 | open htmlcov/index.html || xdg-open htmlcov/index.html
|
23 | 32 |
|
24 | 33 | ## Packages for both Python 2 and 3 for PyPi.
|
25 |
| -.PHONY: packaging |
26 |
| -packaging: |
27 |
| - pipenv --rm |
28 |
| - rm Pipfile.lock |
29 |
| - pipenv --three install --dev |
| 34 | +.PHONY: dist |
| 35 | +dist: mostlyclean |
| 36 | + -pipenv --rm |
| 37 | + pipenv --three install --dev --skip-lock |
30 | 38 | pipenv run python setup.py sdist bdist_wheel
|
31 | 39 | pipenv --rm
|
32 |
| - rm Pipfile.lock |
33 |
| - pipenv --two install --dev |
| 40 | + pipenv --two install --dev --skip-lock |
34 | 41 | pipenv run python setup.py sdist bdist_wheel
|
35 | 42 | pipenv --rm
|
36 |
| - rm Pipfile.lock |
| 43 | + pipenv --$(DEFAULT_PYTHON_VERSION) install --dev |
37 | 44 |
|
38 | 45 | ## Uploads packages to PyPi.
|
39 | 46 | .PHONY: upload
|
40 | 47 | upload:
|
41 |
| - pipenv run twine upload dist/* |
| 48 | + pipenv run twine upload --repository-url $(PYPI_URL) dist/* |
42 | 49 |
|
43 | 50 | ## Alias for packaging and upload together.
|
44 | 51 | .PHONY: pypi
|
45 |
| -pypi: packaging upload setup |
46 |
| - |
47 |
| -.DEFAULT: |
48 |
| - @$(MAKE) help |
| 52 | +pypi: dist upload |
49 | 53 |
|
50 | 54 | ## This help message.
|
51 | 55 | .PHONY: help
|
|
0 commit comments