# HG changeset patch # User RhodeCode Admin # Date 2023-05-18 13:09:25 # Node ID e8c454cf65a2a8813ea94b889befb437f315e98f # Parent bb0b5a8e5b9bcf2515fe8aeb5d13230f1e3408b9 project: switched completly to pyproject.toml diff --git a/pyproject.toml b/pyproject.toml --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,35 @@ +[build-system] +requires = ["setuptools>=61.0.0", "wheel"] +build-backend = "setuptools.build_meta" + [project] name = "rhodecode-vcsserver" -description = "" +description = "Version Control System Server for RhodeCode" +authors = [ + {name = "RhodeCode GmbH", email = "support@rhodecode.com"}, +] + +license = {text = "GPL V3"} requires-python = ">=3.10" -version = "5.0.0" +dynamic = ["version", "readme"] +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 = "vcsserver.http_main:main" + +[tool.setuptools] +packages = ["vcsserver"] + +[tool.setuptools.dynamic] +readme = {file = ["README.rst"], content-type = "text/rst"} +version = {file = "vcsserver/VERSION"} [tool.ruff] select = [ diff --git a/setup.py b/setup.py deleted file mode 100644 --- a/setup.py +++ /dev/null @@ -1,163 +0,0 @@ -# -*- coding: utf-8 -*- - -# RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2019 RodeCode GmbH -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# 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 General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -# Import early to make sure things are patched up properly -from setuptools import setup, find_packages - -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__ = 'GPL V3' -__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 = [] -install_requirements = _get_requirements( - 'requirements.txt', exclude=['setuptools']) -test_requirements = _get_requirements( - 'requirements_test.txt', extras=['configobj']) - - -def get_version(): - version = pkgutil.get_data('vcsserver', 'VERSION') - return version.decode().strip() - - -# additional files that goes into package itself -package_data = { - '': ['*.txt', '*.rst'], - 'configs': ['*.ini'], - 'vcsserver': ['VERSION'], -} - -description = 'Version Control System Server' -keywords = ' '.join(['Version Control System']) - -# 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-vcsserver', - 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', - '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', - ], - entry_points={ - 'paste.app_factory': ['main=vcsserver.http_main:main'] - }, -) diff --git a/vcsserver/__init__.py b/vcsserver/__init__.py --- a/vcsserver/__init__.py +++ b/vcsserver/__init__.py @@ -18,7 +18,7 @@ import pkgutil -__version__ = pkgutil.get_data('vcsserver', 'VERSION').strip() +__version__ = pkgutil.get_data('vcsserver', 'VERSION').strip().decode() # link to config for pyramid CONFIG = {} diff --git a/vcsserver/http_main.py b/vcsserver/http_main.py --- a/vcsserver/http_main.py +++ b/vcsserver/http_main.py @@ -464,7 +464,7 @@ class HTTPApplication(object): def status_view(self, request): import vcsserver - return {'status': 'OK', 'vcsserver_version': safe_str(vcsserver.__version__), + return {'status': 'OK', 'vcsserver_version': vcsserver.__version__, 'pid': os.getpid()} def service_view(self, request): @@ -492,7 +492,7 @@ class HTTPApplication(object): resp = { 'id': payload.get('id'), 'result': dict( - version=safe_str(vcsserver.__version__), + version=vcsserver.__version__, config=server_config, app_config=app_config, environ=environ, diff --git a/vcsserver/tests/test_install_hooks.py b/vcsserver/tests/test_install_hooks.py --- a/vcsserver/tests/test_install_hooks.py +++ b/vcsserver/tests/test_install_hooks.py @@ -72,7 +72,7 @@ class BaseInstallHooks(object): content = hook_file.read() expected_env = '#!{}'.format(executable) - expected_rc_version = "\nRC_HOOK_VER = '{}'\n".format(safe_str(vcsserver.__version__)) + expected_rc_version = "\nRC_HOOK_VER = '{}'\n".format(vcsserver.__version__) assert content.strip().startswith(expected_env) assert expected_rc_version in content diff --git a/vcsserver/tweens/request_wrapper.py b/vcsserver/tweens/request_wrapper.py --- a/vcsserver/tweens/request_wrapper.py +++ b/vcsserver/tweens/request_wrapper.py @@ -65,7 +65,7 @@ class RequestWrapperTween(object): repo_name = call_context.get('X-RC-Repo-Name', '') count = request.request_count() - _ver_ = ascii_str(vcsserver.__version__) + _ver_ = vcsserver.__version__ _path = safe_str(get_access_path(request.environ)) ip = '127.0.0.1'