diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-06-15 11:09:58 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-06-15 11:09:58 +0200 |
commit | 7d75fb36def0d1d3b487db9926dfa9f24f1e788e (patch) | |
tree | e31eda43cab2f0fb158f0f917689f4a2743f0037 /setup.py | |
parent | b9f67e9dec21c7ea09d8c138ae5b11b179d84c24 (diff) | |
parent | 22c722bf59e59246f47491c7229b17f9ef783614 (diff) | |
download | hydrilla-builder-7d75fb36def0d1d3b487db9926dfa9f24f1e788e.tar.gz hydrilla-builder-7d75fb36def0d1d3b487db9926dfa9f24f1e788e.zip |
Update upstream source from tag 'upstream/1.1_beta1'
Update to upstream version '1.1~beta1'
with Debian dir 1e26108ec9cb2f9b4e35e048ea8f73345a415680
Diffstat (limited to 'setup.py')
-rwxr-xr-x | setup.py | 37 |
1 files changed, 33 insertions, 4 deletions
@@ -8,13 +8,42 @@ import setuptools from setuptools.command.build_py import build_py +from setuptools.command.sdist import sdist + +from pathlib import Path + +here = Path(__file__).resolve().parent class CustomBuildCommand(build_py): - ''' - The build command but runs babel before build. - ''' + """The build command but runs babel before build.""" def run(self, *args, **kwargs): + """Wrapper around build_py's original run() method.""" self.run_command('compile_catalog') + + super().run(*args, **kwargs) + +class CustomSdistCommand(sdist): + """ + The sdist command but prevents compiled message catalogs from being included + in the archive. + """ + def run(self, *args, **kwargs): + """Wrapper around sdist's original run() method.""" + locales_dir = here / 'src/hydrilla/builder/locales' + locale_files = {} + + for path in locales_dir.rglob('*.mo'): + locale_files[path] = path.read_bytes() + + for path in locale_files: + path.unlink() + super().run(*args, **kwargs) -setuptools.setup(cmdclass={'build_py': CustomBuildCommand}) + for path, contents in locale_files.items(): + path.write_bytes(contents) + +setuptools.setup(cmdclass = { + 'build_py': CustomBuildCommand, + 'sdist': CustomSdistCommand +}) |