mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 14:32:28 +03:00
Compile translation files on install
Solution based on https://stackoverflow.com/questions/40051076/compile-translation-files-when-calling-setup-py-install
This commit is contained in:
parent
dccfc2f712
commit
23a4135ccd
3 changed files with 41 additions and 24 deletions
|
@ -130,9 +130,9 @@ ubuntu_bionic_pip:
|
||||||
# setup venv to act as release build machine
|
# setup venv to act as release build machine
|
||||||
- python -m venv sdist-env
|
- python -m venv sdist-env
|
||||||
- . sdist-env/bin/activate
|
- . sdist-env/bin/activate
|
||||||
- ./setup.py compile_catalog sdist
|
- ./setup.py sdist
|
||||||
- deactivate
|
- deactivate
|
||||||
- tar tzf dist/fdroidserver-*.tar.gz | grep locale/de/LC_MESSAGES/fdroidserver.mo
|
- tar tzf dist/fdroidserver-*.tar.gz
|
||||||
# back to bare machine to act as user's install machine
|
# back to bare machine to act as user's install machine
|
||||||
- $pip install --upgrade pip setuptools wheel # make this go away: "error: invalid command 'bdist_wheel'"
|
- $pip install --upgrade pip setuptools wheel # make this go away: "error: invalid command 'bdist_wheel'"
|
||||||
- $pip install dist/fdroidserver-*.tar.gz
|
- $pip install dist/fdroidserver-*.tar.gz
|
||||||
|
@ -141,7 +141,7 @@ ubuntu_bionic_pip:
|
||||||
- fdroid=`which fdroid` ./tests/run-tests
|
- fdroid=`which fdroid` ./tests/run-tests
|
||||||
|
|
||||||
|
|
||||||
# test install process on a bleeding edge distro with pip
|
# test installation process on a bleeding edge distro with pip
|
||||||
arch_pip_install:
|
arch_pip_install:
|
||||||
image: archlinux
|
image: archlinux
|
||||||
only:
|
only:
|
||||||
|
@ -272,7 +272,7 @@ fedora_latest:
|
||||||
unzip
|
unzip
|
||||||
wget
|
wget
|
||||||
which
|
which
|
||||||
- ./setup.py compile_catalog sdist
|
- ./setup.py sdist
|
||||||
- useradd -m -c "test account" --password "fakepassword" testuser
|
- useradd -m -c "test account" --password "fakepassword" testuser
|
||||||
- su testuser --login --command "cd `pwd`; $pip install --user dist/fdroidserver-*.tar.gz"
|
- su testuser --login --command "cd `pwd`; $pip install --user dist/fdroidserver-*.tar.gz"
|
||||||
- test -e ~testuser/.local/share/locale/de/LC_MESSAGES/fdroidserver.mo
|
- test -e ~testuser/.local/share/locale/de/LC_MESSAGES/fdroidserver.mo
|
||||||
|
|
36
MANIFEST.in
36
MANIFEST.in
|
@ -20,24 +20,24 @@ include examples/public-read-only-s3-bucket-policy.json
|
||||||
include examples/template.yml
|
include examples/template.yml
|
||||||
include gradlew-fdroid
|
include gradlew-fdroid
|
||||||
include LICENSE
|
include LICENSE
|
||||||
include locale/bo/LC_MESSAGES/fdroidserver.mo
|
include locale/bo/LC_MESSAGES/fdroidserver.po
|
||||||
include locale/de/LC_MESSAGES/fdroidserver.mo
|
include locale/de/LC_MESSAGES/fdroidserver.po
|
||||||
include locale/es/LC_MESSAGES/fdroidserver.mo
|
include locale/es/LC_MESSAGES/fdroidserver.po
|
||||||
include locale/fr/LC_MESSAGES/fdroidserver.mo
|
include locale/fr/LC_MESSAGES/fdroidserver.po
|
||||||
include locale/hu/LC_MESSAGES/fdroidserver.mo
|
include locale/hu/LC_MESSAGES/fdroidserver.po
|
||||||
include locale/it/LC_MESSAGES/fdroidserver.mo
|
include locale/it/LC_MESSAGES/fdroidserver.po
|
||||||
include locale/ko/LC_MESSAGES/fdroidserver.mo
|
include locale/ko/LC_MESSAGES/fdroidserver.po
|
||||||
include locale/nb_NO/LC_MESSAGES/fdroidserver.mo
|
include locale/nb_NO/LC_MESSAGES/fdroidserver.po
|
||||||
include locale/pl/LC_MESSAGES/fdroidserver.mo
|
include locale/pl/LC_MESSAGES/fdroidserver.po
|
||||||
include locale/pt/LC_MESSAGES/fdroidserver.mo
|
include locale/pt/LC_MESSAGES/fdroidserver.po
|
||||||
include locale/pt_BR/LC_MESSAGES/fdroidserver.mo
|
include locale/pt_BR/LC_MESSAGES/fdroidserver.po
|
||||||
include locale/pt_PT/LC_MESSAGES/fdroidserver.mo
|
include locale/pt_PT/LC_MESSAGES/fdroidserver.po
|
||||||
include locale/ru/LC_MESSAGES/fdroidserver.mo
|
include locale/ru/LC_MESSAGES/fdroidserver.po
|
||||||
include locale/sq/LC_MESSAGES/fdroidserver.mo
|
include locale/sq/LC_MESSAGES/fdroidserver.po
|
||||||
include locale/tr/LC_MESSAGES/fdroidserver.mo
|
include locale/tr/LC_MESSAGES/fdroidserver.po
|
||||||
include locale/uk/LC_MESSAGES/fdroidserver.mo
|
include locale/uk/LC_MESSAGES/fdroidserver.po
|
||||||
include locale/zh_Hans/LC_MESSAGES/fdroidserver.mo
|
include locale/zh_Hans/LC_MESSAGES/fdroidserver.po
|
||||||
include locale/zh_Hant/LC_MESSAGES/fdroidserver.mo
|
include locale/zh_Hant/LC_MESSAGES/fdroidserver.po
|
||||||
include makebuildserver
|
include makebuildserver
|
||||||
include README.md
|
include README.md
|
||||||
include tests/androguard_test.py
|
include tests/androguard_test.py
|
||||||
|
|
21
setup.py
21
setup.py
|
@ -7,6 +7,8 @@ import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from setuptools.command.install import install
|
||||||
|
|
||||||
|
|
||||||
class VersionCheckCommand(Command):
|
class VersionCheckCommand(Command):
|
||||||
"""Make sure git tag and version match before uploading"""
|
"""Make sure git tag and version match before uploading"""
|
||||||
|
@ -28,6 +30,17 @@ class VersionCheckCommand(Command):
|
||||||
print('Upload using: twine upload --sign dist/fdroidserver-%s.tar.gz' % version)
|
print('Upload using: twine upload --sign dist/fdroidserver-%s.tar.gz' % version)
|
||||||
|
|
||||||
|
|
||||||
|
class InstallWithCompile(install):
|
||||||
|
def run(self):
|
||||||
|
from babel.messages.frontend import compile_catalog
|
||||||
|
compiler = compile_catalog(self.distribution)
|
||||||
|
option_dict = self.distribution.get_option_dict('compile_catalog')
|
||||||
|
compiler.domain = [option_dict['domain'][1]]
|
||||||
|
compiler.directory = option_dict['directory'][1]
|
||||||
|
compiler.run()
|
||||||
|
super().run()
|
||||||
|
|
||||||
|
|
||||||
def get_data_files():
|
def get_data_files():
|
||||||
# workaround issue on OSX or --user installs, where sys.prefix is not an installable location
|
# 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):
|
if os.access(sys.prefix, os.W_OK | os.X_OK):
|
||||||
|
@ -43,7 +56,8 @@ def get_data_files():
|
||||||
['buildserver/config.buildserver.yml', ]
|
['buildserver/config.buildserver.yml', ]
|
||||||
+ re.findall(r'include (examples/.*)', data)))
|
+ 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):
|
for f in re.findall(r'include (locale/[a-z][a-z][a-zA-Z_]*/LC_MESSAGES/fdroidserver\.)po', data):
|
||||||
|
f += 'mo'
|
||||||
d = os.path.join(data_prefix, 'share', os.path.dirname(f))
|
d = os.path.join(data_prefix, 'share', os.path.dirname(f))
|
||||||
data_files.append((d, [f, ]))
|
data_files.append((d, [f, ]))
|
||||||
return data_files
|
return data_files
|
||||||
|
@ -68,7 +82,10 @@ setup(name='fdroidserver',
|
||||||
},
|
},
|
||||||
data_files=get_data_files(),
|
data_files=get_data_files(),
|
||||||
python_requires='>=3.5',
|
python_requires='>=3.5',
|
||||||
cmdclass={'versioncheck': VersionCheckCommand},
|
cmdclass={
|
||||||
|
'versioncheck': VersionCheckCommand,
|
||||||
|
'install': InstallWithCompile,
|
||||||
|
},
|
||||||
setup_requires=[
|
setup_requires=[
|
||||||
'babel',
|
'babel',
|
||||||
],
|
],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue