diff options
Diffstat (limited to 'setup.py')
-rwxr-xr-x | setup.py | 88 |
1 files changed, 12 insertions, 76 deletions
@@ -1,84 +1,20 @@ #!/usr/bin/env python3 - # SPDX-License-Identifier: CC0-1.0 -# Setup script -# -# This file is part of Hydrilla -# -# Copyright (C) 2021 Wojtek Kosior +# Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org> # -# This file is free software: you can redistribute it with or without -# modification under the terms of the CC0 1.0 Universal License as -# published by the Creative Commons Corporation. -# -# This file is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# CC0 1.0 Universal License for more details. - -from setuptools import setup, find_packages -import sys -import pathlib - -def files_find(package_path, subpath, rglob): - package_path = pathlib.Path(package_path) - for path in (package_path / subpath).rglob(rglob): - if not path.is_dir(): - yield str(path.relative_to(package_path)) +# Available under the terms of Creative Commons Zero v1.0 Universal. -settings = {} -settings['app_package_name'] = 'hydrilla' -settings['project_root'] = pathlib.Path(__file__).resolve().parent -packages_root = settings['project_root'] / 'src' -main_package_dir = packages_root / settings['app_package_name'] -test_dir = packages_root / 'test' -settings['locales_dir'] = main_package_dir / 'server' / 'locales' -settings['config_path'] = test_dir / 'development_config.json' +import setuptools -sys.path.insert(0, str(packages_root)) -import hydrilla_dev_helper +from setuptools.command.build_py import build_py -helper = hydrilla_dev_helper.Helper(**settings) +class CustomBuildCommand(build_py): + ''' + The build command but runs babel before build. + ''' + def run(self, *args, **kwargs): + self.run_command('compile_catalog') + super().run(*args, **kwargs) -setup( - name=settings['app_package_name'], - description='Hydrilla repository server', -# long_description='...', -# long_description_content_type='text/plain', - url='https://hydrillabugs.koszko.org', - author='Wojtek Kosior', - author_email='koszko@koszko.org', - classifiers=[ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'Environment :: Web Environment', - 'Framework :: Flask', - 'Topic :: Internet :: WWW/HTTP :: WSGI', - 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)', - 'Natural Language :: English', - 'Programming Language :: Python :: 3 :: Only' - ], - package_dir={'': 'src'}, - packages=find_packages(where='src', exclude=['test']), - include_package_data=True, - zip_safe=False, - install_requires=['flask'], - extras_require={ - 'test': ['pytest', 'hydrilla_builder'], - 'setup': ['setuptools_scm'] - }, - package_data={ - 'hydrilla': ['config.json', *map(str, helper.locale_files_relative()), - *files_find(main_package_dir, 'templates', '*.html')], - 'test': [*files_find(packages_root / 'test', 'example_content', '*'), - 'development_config.json'] - }, - cmdclass=helper.commands() - # project_urls={ - # 'Bug Reports': 'https://', - # 'Funding': 'https://', - # 'Say Thanks!': 'http://', - # 'Source': 'https://', - # }, -) +setuptools.setup(cmdclass={'build_py': CustomBuildCommand}) |