- dash
- pylint
- pep8
+ - python3-babel
- python3-dev
- python3-pip
- python3-ruamel.yaml
[aliases]
-release = register sdist upload --sign
+release = register compile_catalog sdist upload --sign
+
+# All this below is for Babel config. Ideally we would only use
+# Babel, but it is still missing some key features that gettext gives
+# us. So for now, this Babel setup is just to make it easy for Python
+# people who are used to it. Babel is missing:
+#
+# * properly tagging various Python formats in the comments
+# * --add-location=file
+# * --join-existing
+# * --sort-output on update
+#
+# So for now the canonical way to update the template and translation
+# files is: `make -C locale`
+
+[extract_messages]
+keywords = _
+charset = UTF-8
+sort_output = true
+no_location = true
+add-comments = true
+output_file = locale/fdroidserver.pot
+msgid-bugs-address = https://gitlab.com/fdroid/fdroidserver/issues
+
+[update_catalog]
+output_dir = locale
+input_file = locale/fdroidserver.pot
+
+[init_catalog]
+input_file = locale/fdroidserver.pot
+output_dir = locale
+
+[compile_catalog]
+domain = fdroidserver
+directory = locale
from setuptools import setup
import os
+import re
import shutil
import sys
-# workaround issue on OSX or --user installs, where sys.prefix is not an installable location
-if os.access(sys.prefix, os.W_OK | os.X_OK):
- data_prefix = sys.prefix
-else:
- data_prefix = '.'
+
+def get_data_files():
+ # workaround issue on OSX or --user installs, where sys.prefix is not an installable location
+ if os.access(sys.prefix, os.W_OK | os.X_OK):
+ data_prefix = sys.prefix
+ else:
+ data_prefix = '.'
+
+ data_files = []
+ with open('MANIFEST.in') as fp:
+ data = fp.read()
+
+ data_files.append((data_prefix + '/share/doc/fdroidserver/examples',
+ ['buildserver/config.buildserver.py', ]
+ + re.findall(r'include (examples/.*)', data)))
+
+ for f in re.findall(r'include (locale/[a-z][a-z][a-zA-Z_]*/LC_MESSAGES/fdroidserver.mo)', data):
+ d = os.path.join(data_prefix, 'share', os.path.dirname(f))
+ data_files.append((d, [f, ]))
+ return data_files
+
# PyPI accepts reST not Markdown
if os.path.exists('README.md'):
license='AGPL-3.0',
packages=['fdroidserver', 'fdroidserver.asynchronousfilereader'],
scripts=['fdroid', 'fd-commit', 'makebuildserver'],
- data_files=[
- (data_prefix + '/share/doc/fdroidserver/examples',
- ['buildserver/config.buildserver.py',
- 'examples/config.py',
- 'examples/fdroid-icon.png',
- 'examples/makebuildserver.config.py',
- 'examples/opensc-fdroid.cfg',
- 'examples/public-read-only-s3-bucket-policy.json',
- 'examples/template.yml']),
- ],
+ data_files=get_data_files(),
python_requires='>=3.4',
install_requires=[
'clint',
#------------------------------------------------------------------------------#
# test building the source tarball, then installing it
cd $WORKSPACE
-python3 setup.py sdist
+python3 setup.py compile_catalog sdist
+
+# make sure translation files got compiled and included
+tar tzf dist/fdroidserver-*.tar.gz | grep locale/de/LC_MESSAGES/fdroidserver.mo
rm -rf $WORKSPACE/env
$pyvenv $WORKSPACE/env
pip3 install --quiet setuptools==33.1.1
pip3 install --quiet dist/fdroidserver-*.tar.gz
+# make sure translation files were installed
+test -e $WORKSPACE/env/share/locale/de/LC_MESSAGES/fdroidserver.mo
+
# run tests in new pip+pyvenv install
fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests $apksource
$pyvenv $WORKSPACE/env
. $WORKSPACE/env/bin/activate
# workaround https://github.com/pypa/setuptools/issues/937
-pip3 install --quiet setuptools==33.1.1
+pip3 install --quiet setuptools==33.1.1 Babel
pip3 install --quiet -e $WORKSPACE
-python3 setup.py install
+python3 setup.py compile_catalog install
+
+# make sure translation files were installed
+test -e $WORKSPACE/env/share/locale/de/LC_MESSAGES/fdroidserver.mo
# run tests in new pip+pyvenv install
fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests $apksource