2016-07-06 19:43:56 +02:00
.PHONY : build dist docs
2021-06-19 17:21:48 +02:00
VERSION = ` python3 setup.py -V`
2015-12-17 14:44:06 +01:00
2022-10-17 20:25:42 +02:00
WHL_FILES := $( wildcard dist/*.whl)
WHL_ASC := $( WHL_FILES:= .asc)
DIST_FILE := $( wildcard dist/*.tar.gz)
DIST_ASC := $( DIST_FILE:= .asc)
2015-12-12 14:28:19 +01:00
build :
2021-06-19 17:21:48 +02:00
python3 setup.py build
2015-12-12 14:28:19 +01:00
2016-06-29 08:43:11 +02:00
install : dist
2021-06-19 17:21:48 +02:00
pip3 -V
pip3 install --no-cache-dir --no-deps --upgrade --force-reinstall --find-links ./dist/django-cas-server-${ VERSION } .tar.gz django-cas-server
2016-06-29 08:43:11 +02:00
uninstall :
2021-06-19 17:21:48 +02:00
pip3 uninstall django-cas-server || true
2015-12-12 14:28:19 +01:00
2015-12-18 11:35:18 +01:00
clean_pyc :
2015-12-12 14:28:19 +01:00
find ./ -name '*.pyc' -delete
find ./ -name __pycache__ -delete
2015-12-18 11:35:18 +01:00
clean_build :
2015-12-12 14:28:19 +01:00
rm -rf build django_cas_server.egg-info dist
2015-12-18 11:35:18 +01:00
clean_tox :
2016-07-03 19:46:52 +02:00
rm -rf .tox tox_logs
2015-12-18 11:35:18 +01:00
clean_test_venv :
rm -rf test_venv
2016-06-29 09:05:45 +02:00
clean_coverage :
rm -rf coverage.xml .coverage htmlcov
clean_tild_backup :
find ./ -name '*~' -delete
2016-07-06 19:43:56 +02:00
clean_docs :
2016-07-20 18:28:23 +02:00
rm -rf docs/_build/ docs/django.inv
2016-07-10 11:48:43 +02:00
clean_eggs :
rm -rf .eggs/
2016-06-29 08:22:52 +02:00
2016-06-29 09:05:45 +02:00
clean : clean_pyc clean_build clean_coverage clean_tild_backup
2016-06-29 08:22:52 +02:00
2016-07-10 11:48:43 +02:00
clean_all : clean clean_tox clean_test_venv clean_docs clean_eggs
2015-12-17 14:44:06 +01:00
2015-12-12 14:28:19 +01:00
dist :
2021-06-19 17:21:48 +02:00
python3 setup.py sdist
2022-10-17 20:25:42 +02:00
python3 setup.py bdist_wheel
2015-12-17 14:44:06 +01:00
2016-06-29 08:22:52 +02:00
test_venv/bin/python :
2018-04-29 20:10:01 +02:00
python3 -m venv test_venv
2021-06-19 17:21:48 +02:00
test_venv/bin/pip install -U --requirement requirements-dev.txt 'Django>=3.2,<3.3'
2015-12-17 14:44:06 +01:00
2016-06-29 08:22:52 +02:00
test_venv/cas/manage.py : test_venv
2015-12-17 14:44:06 +01:00
mkdir -p test_venv/cas
test_venv/bin/django-admin startproject cas test_venv/cas
2016-06-19 13:18:32 +02:00
ln -s ../../cas_server test_venv/cas/cas_server
2016-07-24 01:49:03 +02:00
sed -i "s/'django.contrib.staticfiles',/'django.contrib.staticfiles',\n 'cas_server',/" test_venv/cas/cas/settings.py
2015-12-17 14:44:06 +01:00
sed -i "s/'django.middleware.clickjacking.XFrameOptionsMiddleware',/'django.middleware.clickjacking.XFrameOptionsMiddleware',\n 'django.middleware.locale.LocaleMiddleware',/" test_venv/cas/cas/settings.py
sed -i 's/from django.conf.urls import url/from django.conf.urls import url, include/' test_venv/cas/cas/urls.py
sed -i "s@url(r'^admin/', admin.site.urls),@url(r'^admin/', admin.site.urls),\n url(r'^', include('cas_server.urls', namespace='cas_server')),@" test_venv/cas/cas/urls.py
2015-12-17 19:04:41 +01:00
test_venv/bin/python test_venv/cas/manage.py migrate
test_venv/bin/python test_venv/cas/manage.py createsuperuser
2015-12-17 14:44:06 +01:00
2016-06-29 08:22:52 +02:00
test_venv : test_venv /bin /python
test_project : test_venv /cas /manage .py
2016-06-19 13:18:32 +02:00
@echo "##############################################################"
@echo " A test django project was created in $( realpath test_venv/cas) "
2016-06-30 00:23:15 +02:00
run_server : test_project
2015-12-17 19:04:41 +01:00
test_venv/bin/python test_venv/cas/manage.py runserver
2016-06-25 11:26:56 +02:00
2016-06-30 00:23:15 +02:00
run_tests : test_venv
2021-06-19 17:21:48 +02:00
python3 setup.py check --restructuredtext --stric
2016-09-09 14:25:43 +02:00
test_venv/bin/py.test -rw -x --cov= cas_server --cov-report html --cov-report term
2016-06-30 00:23:15 +02:00
rm htmlcov/coverage_html.js # I am really pissed off by those keybord shortcuts
2016-07-06 19:43:56 +02:00
test_venv/bin/sphinx-build : test_venv
test_venv/bin/pip install Sphinx sphinx_rtd_theme
2016-07-23 18:41:46 +02:00
docs : test_venv /bin /sphinx -build
2016-07-20 18:28:23 +02:00
bash -c "source test_venv/bin/activate; cd docs; make html"
2016-07-23 18:46:36 +02:00
2022-10-17 20:25:42 +02:00
sign_release : $( WHL_ASC ) $( DIST_ASC )
dist/%.asc :
gpg --detach-sign -a $( @:.asc= )
test_venv/bin/twine : test_venv
test_venv/bin/pip install twine
publish_pypi_release : test_venv test_venv /bin /twine dist sign_release
test_venv/bin/twine upload --sign dist/*