diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:56:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:56:50 +0000 |
commit | 6637322c8ab1c5ff80a2b6ca59c9ba1d40aeba2c (patch) | |
tree | 04e41667e9eae835f5d88bda4f6d3f5c2664de01 /setup.py | |
parent | Initial commit. (diff) | |
download | sphinx-rtd-theme-6637322c8ab1c5ff80a2b6ca59c9ba1d40aeba2c.tar.xz sphinx-rtd-theme-6637322c8ab1c5ff80a2b6ca59c9ba1d40aeba2c.zip |
Adding upstream version 2.0.0+dfsg.upstream/2.0.0+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..f11bbc8 --- /dev/null +++ b/setup.py @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- + +import distutils.cmd +import os +import subprocess +from io import open + +from setuptools import setup + + +class WebpackBuildCommand(distutils.cmd.Command): + + description = "Generate static assets" + + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + if not 'CI' in os.environ and not 'TOX_ENV_NAME' in os.environ: + subprocess.run(['npm', 'install'], check=True) + subprocess.run(['node_modules/.bin/webpack', '--config', 'webpack.prod.js'], check=True) + + +class WebpackDevelopCommand(distutils.cmd.Command): + + description = "Run Webpack dev server" + + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + subprocess.run( + ["node_modules/.bin/webpack-dev-server", "--open", "--config", "webpack.dev.js"], + check=True + ) + + +class UpdateTranslationsCommand(distutils.cmd.Command): + + description = "Run all localization commands" + + user_options = [] + sub_commands = [ + ('extract_messages', None), + ('update_catalog', None), + ('transifex', None), + ('compile_catalog', None), + ] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + for cmd_name in self.get_sub_commands(): + self.run_command(cmd_name) + + +class TransifexCommand(distutils.cmd.Command): + + description = "Update translation files through Transifex" + + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + subprocess.run(['tx', 'push', '--source'], check=True) + subprocess.run(['tx', 'pull', '--mode', 'onlyreviewed', '-f', '-a'], check=True) + + +setup( + version='2.0.0', + cmdclass={ + 'update_translations': UpdateTranslationsCommand, + 'transifex': TransifexCommand, + 'build_assets': WebpackBuildCommand, + 'watch': WebpackDevelopCommand, + }, +) |