| 1 |
.PHONY: build dist docs |
| 2 |
VERSION=`python3 setup.py -V` |
| 3 |
|
| 4 |
WHL_FILES := $(wildcard dist/*.whl) |
| 5 |
WHL_ASC := $(WHL_FILES:=.asc) |
| 6 |
DIST_FILE := $(wildcard dist/*.tar.gz) |
| 7 |
DIST_ASC := $(DIST_FILE:=.asc) |
| 8 |
|
| 9 |
build: |
| 10 |
python3 setup.py build |
| 11 |
|
| 12 |
install: dist |
| 13 |
pip3 -V |
| 14 |
pip3 install --no-cache-dir --no-deps --upgrade --force-reinstall --find-links ./dist/django-cas-server-${VERSION}.tar.gz django-cas-server |
| 15 |
|
| 16 |
uninstall: |
| 17 |
pip3 uninstall django-cas-server || true |
| 18 |
|
| 19 |
clean_pyc: |
| 20 |
find ./ -name '*.pyc' -delete |
| 21 |
find ./ -name __pycache__ -delete |
| 22 |
clean_build: |
| 23 |
rm -rf build django_cas_server.egg-info dist |
| 24 |
clean_tox: |
| 25 |
rm -rf .tox tox_logs |
| 26 |
clean_test_venv: |
| 27 |
rm -rf test_venv |
| 28 |
clean_coverage: |
| 29 |
rm -rf coverage.xml .coverage htmlcov |
| 30 |
clean_tild_backup: |
| 31 |
find ./ -name '*~' -delete |
| 32 |
clean_docs: |
| 33 |
rm -rf docs/_build/ docs/django.inv docs/python.inv |
| 34 |
clean_eggs: |
| 35 |
rm -rf .eggs/ |
| 36 |
|
| 37 |
clean: clean_pyc clean_build clean_coverage clean_tild_backup |
| 38 |
|
| 39 |
clean_all: clean clean_tox clean_test_venv clean_docs clean_eggs |
| 40 |
|
| 41 |
dist: |
| 42 |
python3 setup.py sdist |
| 43 |
python3 setup.py bdist_wheel |
| 44 |
|
| 45 |
test_venv/bin/python: |
| 46 |
python3 -m venv test_venv |
| 47 |
test_venv/bin/pip install -U --requirement requirements-dev.txt 'Django>=5.2,<5.3' |
| 48 |
|
| 49 |
test_venv/cas/manage.py: test_venv |
| 50 |
mkdir -p test_venv/cas |
| 51 |
test_venv/bin/django-admin startproject cas test_venv/cas |
| 52 |
ln -s ../../cas_server test_venv/cas/cas_server |
| 53 |
sed -i "s/'django.contrib.staticfiles',/'django.contrib.staticfiles',\n 'cas_server',/" test_venv/cas/cas/settings.py |
| 54 |
sed -i "s/'django.middleware.clickjacking.XFrameOptionsMiddleware',/'django.middleware.clickjacking.XFrameOptionsMiddleware',\n 'django.middleware.locale.LocaleMiddleware',/" test_venv/cas/cas/settings.py |
| 55 |
sed -i 's/from django.urls import path/from django.urls import path, include/' test_venv/cas/cas/urls.py |
| 56 |
sed -i "s@path('admin/', admin.site.urls),@path('admin/', admin.site.urls),\n path('', include('cas_server.urls', namespace='cas_server')),@" test_venv/cas/cas/urls.py |
| 57 |
test_venv/bin/python test_venv/cas/manage.py migrate |
| 58 |
test_venv/bin/python test_venv/cas/manage.py createsuperuser |
| 59 |
|
| 60 |
test_venv: test_venv/bin/python |
| 61 |
|
| 62 |
test_project: test_venv/cas/manage.py |
| 63 |
@echo "##############################################################" |
| 64 |
@echo "A test django project was created in $(realpath test_venv/cas)" |
| 65 |
|
| 66 |
run_server: test_project |
| 67 |
test_venv/bin/python test_venv/cas/manage.py runserver |
| 68 |
|
| 69 |
run_tests: test_venv |
| 70 |
python3 setup.py check --restructuredtext --stric |
| 71 |
test_venv/bin/py.test -rw -x --cov=cas_server --cov-report html --cov-report term |
| 72 |
rm htmlcov/coverage_html.js # I am really pissed off by those keybord shortcuts |
| 73 |
|
| 74 |
test_venv/bin/sphinx-build: test_venv |
| 75 |
test_venv/bin/pip install -r docs/requirements.txt |
| 76 |
|
| 77 |
docs: test_venv/bin/sphinx-build |
| 78 |
bash -c "source test_venv/bin/activate; cd docs; make html" |
| 79 |
|
| 80 |
sign_release: $(WHL_ASC) $(DIST_ASC) |
| 81 |
|
| 82 |
dist/%.asc: |
| 83 |
gpg --detach-sign -a $(@:.asc=) |
| 84 |
|
| 85 |
test_venv/bin/twine: test_venv |
| 86 |
test_venv/bin/pip install twine |
| 87 |
|
| 88 |
publish_pypi_release: test_venv test_venv/bin/twine dist sign_release |
| 89 |
test_venv/bin/twine upload --sign dist/* |