# HG changeset patch # User RhodeCode Admin # Date 2024-10-22 07:11:42 # Node ID b7348fbb7ccf9d757189501653c6819571f0246e # Parent 96d5eb70d6c9b85e2342270177388c72f25f45ae core: setuptools, switched from deprecated setup.py to pyproject.toml diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 --- a/.bumpversion.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[bumpversion] -current_version = 5.4.0 -message = release: Bump version {current_version} to {new_version} - -[bumpversion:file:rhodecode/VERSION] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,135 @@ +[build-system] +requires = ["setuptools>=61.0.0", "wheel", "pastescript"] +build-backend = "setuptools.build_meta" + +[project] +name = "rhodecode-enterprise-ce" +description = "Enterprise Source Code Management Platform" +authors = [ + {name = "RhodeCode GmbH", email = "support@rhodecode.com"}, +] +keywords = [ + 'rhodecode', 'mercurial', 'git', 'svn', + 'code review', + 'repo groups', 'ldap', 'repository management', 'hgweb', + 'hgwebdir', 'gitweb', 'serving hgweb', +] +license = {text = "GPL V3"} +requires-python = ">=3.10" +dynamic = ["version", "readme", "dependencies", "optional-dependencies"] +classifiers = [ + 'Development Status :: 6 - Mature', + 'Intended Audience :: Developers', + 'Operating System :: OS Independent', + 'Topic :: Software Development :: Version Control', + 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', + 'Programming Language :: Python :: 3.10', +] + +[project.entry-points."paste.app_factory"] +main = "rhodecode.config.middleware:make_pyramid_app" + +[project.entry-points."pyramid.pshell_runner"] +ipython = "rhodecode.lib.pyramid_shell:ipython_shell_runner" + +[project.entry-points."beaker.backends"] +memorylru_base="rhodecode.lib.memory_lru_dict:MemoryLRUNamespaceManagerBase" +memorylru_debug="rhodecode.lib.memory_lru_dict:MemoryLRUNamespaceManagerDebug" + +[project.scripts] + +rc-setup-app = "rhodecode.lib.rc_commands.setup_rc:main" +rc-upgrade-db = "rhodecode.lib.rc_commands.upgrade_db:main" +rc-ishell = "rhodecode.lib.rc_commands.ishell:main" +rc-add-artifact = "rhodecode.lib.rc_commands.add_artifact:main" +rc-migrate-artifact = "rhodecode.lib.rc_commands.migrate_artifact:main" +rc-ssh-wrapper = "rhodecode.apps.ssh_support.lib.ssh_wrapper_v1:main" +rc-ssh-wrapper-v2 = "rhodecode.apps.ssh_support.lib.ssh_wrapper_v2:main" + +[tool.setuptools] +packages = ["rhodecode"] +include-package-data = true + +[tools.setuptools.package-data] +"" = ['*.txt', '*.rst'] +"configs" = ['*.ini'] +"rhodecode" = ['VERSION', 'i18n/*/LC_MESSAGES/*.mo', ] + +[tool.setuptools.exclude-package-data] +"rhodecode" = ["__pycache__"] + +[tool.setuptools.dynamic] +readme = {file = ["README.rst"], content-type = "text/rst"} +version = {file = "rhodecode/VERSION"} +dependencies = {file = ["requirements.txt"]} +optional-dependencies.tests = {file = ["requirements_test.txt"]} + +[tool.ruff] + +select = [ + # Pyflakes + "F", + # Pycodestyle + "E", + "W", + # isort + "I001" +] + +ignore = [ + "E501", # line too long, handled by black +] + +# Same as Black. +line-length = 120 + +[tool.ruff.isort] + +known-first-party = ["rhodecode"] + +[tool.ruff.format] + +# Like Black, use double quotes for strings. +quote-style = "double" + +# Like Black, indent with spaces, rather than tabs. +indent-style = "space" + +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false + +# Like Black, automatically detect the appropriate line ending. +line-ending = "auto" + + +[tool.bumpversion] +current_version = "5.4.0" +parse = "(?P\\d+)\\.(?P\\d+)\\.(?P\\d+)" +serialize = ["{major}.{minor}.{patch}"] +search = "{current_version}" +replace = "{new_version}" +regex = false +ignore_missing_version = false +ignore_missing_files = false +tag = false +sign_tags = false +tag_name = "v{new_version}" +tag_message = "release(version-bump): {current_version} → {new_version}" +allow_dirty = false +commit = false +message = "release(version-bump): {current_version} → {new_version}" +commit_args = "" +setup_hooks = [] +pre_commit_hooks = [] +post_commit_hooks = [] + + +# message_extractors={ +# 'rhodecode': [ +# ('**.py', 'python', None), +# ('**.js', 'javascript', None), +# ('templates/**.mako', 'mako', {'input_encoding': 'utf-8'}), +# ('templates/**.html', 'mako', {'input_encoding': 'utf-8'}), +# ('public/**', 'ignore', None), +# ] +# }, diff --git a/setup.py b/setup.py deleted file mode 100644 --- a/setup.py +++ /dev/null @@ -1,201 +0,0 @@ -# Copyright (C) 2010-2023 RhodeCode GmbH -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License, version 3 -# (only), as published by the Free Software Foundation. -# -# This program 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 -# GNU General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -# This program is dual-licensed. If you wish to learn more about the -# RhodeCode Enterprise Edition, including its added features, Support services, -# and proprietary license terms, please see https://rhodecode.com/licenses/ - -# Import early to make sure things are patched up properly -from setuptools import setup, find_packages, Extension - -import os -import re -import sys -import pkgutil -import platform -import codecs - -import pip - -pip_major_version = int(pip.__version__.split(".")[0]) -if pip_major_version >= 20: - from pip._internal.req import parse_requirements - from pip._internal.network.session import PipSession -elif pip_major_version >= 10: - from pip._internal.req import parse_requirements - from pip._internal.download import PipSession -else: - from pip.req import parse_requirements - from pip.download import PipSession - - -def get_package_name(req_object): - package_name = None - try: - from pip._internal.req.constructors import install_req_from_parsed_requirement - except ImportError: - install_req_from_parsed_requirement = None - - # In 20.1 of pip, the requirements object changed - if hasattr(req_object, 'req'): - package_name = req_object.req.name - - if package_name is None: - if install_req_from_parsed_requirement: - package = install_req_from_parsed_requirement(req_object) - package_name = package.req.name - - if package_name is None: - # fallback for older pip - package_name = re.split('===|<=|!=|==|>=|~=|<|>', req_object.requirement)[0] - - return package_name - - -if sys.version_info < (3, 10): - raise Exception('RhodeCode requires Python 3.10 or later') - -here = os.path.abspath(os.path.dirname(__file__)) - -# defines current platform -__platform__ = platform.system() -__license__ = 'AGPLv3, and Commercial License' -__author__ = 'RhodeCode GmbH' -__url__ = 'https://code.rhodecode.com' -is_windows = __platform__ in ('Windows',) - - -def _get_requirements(req_filename, exclude=None, extras=None): - extras = extras or [] - exclude = exclude or [] - - try: - parsed = parse_requirements( - os.path.join(here, req_filename), session=PipSession()) - except TypeError: - # try pip < 6.0.0, that doesn't support session - parsed = parse_requirements(os.path.join(here, req_filename)) - - requirements = [] - for int_req in parsed: - req_name = get_package_name(int_req) - if req_name not in exclude: - requirements.append(req_name) - return requirements + extras - - -# requirements extract -setup_requirements = ['PasteScript'] -install_requirements = _get_requirements( - 'requirements.txt', exclude=['setuptools', 'entrypoints']) -test_requirements = _get_requirements( - 'requirements_test.txt') - - -def get_version(): - here = os.path.abspath(os.path.dirname(__file__)) - ver_file = os.path.join(here, "rhodecode", "VERSION") - with open(ver_file, "rt") as f: - version = f.read().strip() - - return version - - -# additional files that goes into package itself -package_data = { - '': ['*.txt', '*.rst'], - 'configs': ['*.ini'], - 'rhodecode': ['VERSION', 'i18n/*/LC_MESSAGES/*.mo', ], -} - -description = 'Source Code Management Platform' -keywords = ' '.join([ - 'rhodecode', 'mercurial', 'git', 'svn', - 'code review', - 'repo groups', 'ldap', 'repository management', 'hgweb', - 'hgwebdir', 'gitweb', 'serving hgweb', -]) - - -# README/DESCRIPTION generation -readme_file = 'README.rst' -changelog_file = 'CHANGES.rst' -try: - long_description = codecs.open(readme_file).read() + '\n\n' + \ - codecs.open(changelog_file).read() -except IOError as err: - sys.stderr.write( - "[WARNING] Cannot find file specified as long_description (%s)\n " - "or changelog (%s) skipping that file" % (readme_file, changelog_file)) - long_description = description - - -setup( - name='rhodecode-enterprise-ce', - version=get_version(), - description=description, - long_description=long_description, - keywords=keywords, - license=__license__, - author=__author__, - author_email='support@rhodecode.com', - url=__url__, - setup_requires=setup_requirements, - install_requires=install_requirements, - tests_require=test_requirements, - zip_safe=False, - packages=find_packages(exclude=["docs", "tests*"]), - package_data=package_data, - include_package_data=True, - classifiers=[ - 'Development Status :: 6 - Mature', - 'Environment :: Web Environment', - 'Intended Audience :: Developers', - 'Operating System :: OS Independent', - 'Topic :: Software Development :: Version Control', - 'License :: OSI Approved :: Affero GNU General Public License v3 or later (AGPLv3+)', - 'Programming Language :: Python :: 3.10', - ], - message_extractors={ - 'rhodecode': [ - ('**.py', 'python', None), - ('**.js', 'javascript', None), - ('templates/**.mako', 'mako', {'input_encoding': 'utf-8'}), - ('templates/**.html', 'mako', {'input_encoding': 'utf-8'}), - ('public/**', 'ignore', None), - ] - }, - - entry_points={ - 'paste.app_factory': [ - 'main=rhodecode.config.middleware:make_pyramid_app', - ], - 'pyramid.pshell_runner': [ - 'ipython = rhodecode.lib.pyramid_shell:ipython_shell_runner', - ], - 'console_scripts': [ - 'rc-setup-app=rhodecode.lib.rc_commands.setup_rc:main', - 'rc-upgrade-db=rhodecode.lib.rc_commands.upgrade_db:main', - 'rc-ishell=rhodecode.lib.rc_commands.ishell:main', - 'rc-add-artifact=rhodecode.lib.rc_commands.add_artifact:main', - 'rc-migrate-artifact=rhodecode.lib.rc_commands.migrate_artifact:main', - 'rc-ssh-wrapper=rhodecode.apps.ssh_support.lib.ssh_wrapper_v1:main', - 'rc-ssh-wrapper-v2=rhodecode.apps.ssh_support.lib.ssh_wrapper_v2:main', - ], - 'beaker.backends': [ - 'memorylru_base=rhodecode.lib.memory_lru_dict:MemoryLRUNamespaceManagerBase', - 'memorylru_debug=rhodecode.lib.memory_lru_dict:MemoryLRUNamespaceManagerDebug' - ] - }, -)