Mercurial > kallithea
view scripts/make-release @ 7846:d68b77e4e4ab
tg2: move routing mapper initialization from RootController class definition time to instantiation time
Things happened to work before, despite unfortunate code executation at import
time. TurboGears 2.4 changed something, so actual serving works, but pytest
fails with:
collecting ...
...
data/env/lib/python2.7/site-packages/_pytest/config/__init__.py:463: in _importconftest
raise ConftestImportFailure(conftestpath, sys.exc_info())
E ConftestImportFailure: (local('.../kallithea/tests/conftest.py'), (<type 'exceptions.KeyError'>, KeyError('paths',), <traceback object at 0x7fb6679030e0>))
or more useful, if raising the real exception instead of obfuscating with ConftestImportFailure:
...
kallithea/tests/conftest.py:15: in <module>
from kallithea.controllers.root import RootController
kallithea/controllers/root.py:29: in <module>
class RootController(RoutedController, BaseController):
kallithea/controllers/root.py:31: in RootController
mapper = make_map(config)
kallithea/config/routing.py:32: in make_map
rmap = Mapper(directory=config['paths']['controllers'],
data/env/lib/python2.7/site-packages/tg/configuration/tgconfig.py:28: in __getitem__
return self.config_proxy.current_conf()[key]
E KeyError: 'paths'
_importconftest <_pytest.config.PytestPluginManager object at 0x7f20c770a3d0> .../conftest.py
In this example, in RootController, the global config object is at this time just:
{'debug': False, 'package': None, 'i18n.lang': None, 'tg.strict_tmpl_context': True, 'tg.app_globals': None}
Solved by moving the mapper initialization to __init__.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Wed, 28 Aug 2019 12:07:37 +0200 |
parents | d9e37f7fd35b |
children | 22321950133a |
line wrap: on
line source
#!/bin/bash set -e set -x cleanup() { echo "Removing venv $venv" rm -rf "$venv" } echo "Checking that you are NOT inside a virtualenv" [ -z "$VIRTUAL_ENV" ] venv=$(mktemp -d --tmpdir kallithea-release-XXXXX) trap cleanup EXIT echo "Setting up a fresh virtualenv in $venv" virtualenv -p python2 "$venv" . "$venv/bin/activate" echo "Install/verify tools needed for building and uploading stuff" pip install --upgrade -e . -r dev_requirements.txt twine echo "Cleanup and update copyrights ... and clean checkout" scripts/run-all-cleanup scripts/update-copyrights.py hg up -cr . echo "Make release build from clean checkout in build/" rm -rf build dist hg archive build cd build echo "Check that each entry in MANIFEST.in match something" sed -e 's/[^ ]*[ ]*\([^ ]*\).*/\1/g' MANIFEST.in | xargs ls -lad echo "Build dist" python2 setup.py compile_catalog python2 setup.py sdist echo "Verify VERSION from kallithea/__init__.py" namerel=$(cd dist && echo Kallithea-*.tar.gz) namerel=${namerel%.tar.gz} version=${namerel#Kallithea-} ls -l $(pwd)/dist/$namerel.tar.gz echo "Releasing Kallithea $version in directory $namerel" echo "Verify dist file content" diff -u <((hg mani | grep -v '^\.hg') | LANG=C sort) <(tar tf dist/Kallithea-$version.tar.gz | sed "s|^$namerel/||" | grep . | grep -v '^kallithea/i18n/.*/LC_MESSAGES/kallithea.mo$\|^Kallithea.egg-info/\|^PKG-INFO$\|/$' | LANG=C sort) echo "Verify docs build" python2 setup.py build_sphinx # the results are not actually used, but we want to make sure it builds echo "Shortlog for inclusion in the release announcement" scripts/shortlog.py "only('.', branch('stable') & tagged() & public() & not '.')" cat - << EOT Now, make sure * all tests are passing * release note is ready * announcement is ready * source has been pushed to https://kallithea-scm.org/repos/kallithea EOT echo "Verify current revision is tagged for $version" hg log -r "'$version'&." | grep . echo -n "Enter \"pypi\" to upload Kallithea $version to pypi: " read answer [ "$answer" = "pypi" ] echo "Rebuild readthedocs for docs.kallithea-scm.org" xdg-open https://readthedocs.org/projects/kallithea/ curl -X POST http://readthedocs.org/build/kallithea xdg-open https://readthedocs.org/builds/kallithea/ xdg-open http://docs.kallithea-scm.org/en/latest/ # or whatever the branch is twine upload dist/* xdg-open https://pypi.python.org/pypi/Kallithea