Skip to content

Feat/add support for python 3.12+ #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/installation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
method: ['install' ,'pip']

include:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
strategy:
matrix:
os: ['macos-latest', 'ubuntu-latest', 'windows-latest']
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
include:
- os: macos-latest
shells: 'sh,csh,bash,tcsh,zsh,pwsh'
Expand Down
48 changes: 22 additions & 26 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,55 +33,51 @@ def find_files(pattern, path=None, root="rez"):
for root, _, files in os.walk(path_):
files = [x for x in files if fnmatch.fnmatch(x, pattern)]
files = [os.path.join(root, x) for x in files]
paths += [x[len(basepath):].lstrip(os.path.sep) for x in files]
paths += [x[len(basepath) :].lstrip(os.path.sep) for x in files]

return paths


this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, 'README.md')) as f:
with open(os.path.join(this_directory, "README.md")) as f:
long_description = f.read()


setup(
name="rez",
version=_rez_version,
description=("A cross-platform packaging system that can build and "
"install multiple version of packages, and dynamically "
"configure resolved environments at runtime."),
description=(
"A cross-platform packaging system that can build and "
"install multiple version of packages, and dynamically "
"configure resolved environments at runtime."
),
keywords="package resolve version build install software management",
long_description=long_description,
long_description_content_type='text/markdown',
long_description_content_type="text/markdown",
url="https://github.com/AcademySoftwareFoundation/rez",
author="Allan Johns",
author_email="[email protected]",
maintainer="Contributors to the rez project",
maintainer_email="[email protected]",
license="Apache-2.0",
license_files=["LICENSE"],
entry_points={
"console_scripts": get_specifications().values()
},
entry_points={"console_scripts": get_specifications().values()},
include_package_data=False,
zip_safe=False,
package_dir={'': 'src'},
packages=find_packages('src', exclude=["build_utils",
"build_utils.*",
"tests"]),
package_dir={"": "src"},
packages=find_packages("src", exclude=["build_utils", "build_utils.*", "tests"]),
package_data={
'rez':
['utils/logging.conf'] +
['README*'] +
find_files('*', 'completion') +
find_files('*', 'data') +
find_files('*.exe', 'vendor/distlib'),
'rezplugins':
find_files('*.cmake', 'build_system', root='rezplugins') +
find_files('*', 'build_system/template_files', root='rezplugins'),
'rezgui':
find_files('rezguiconfig', root='rezgui') +
find_files('*', 'icons', root='rezgui')
"rez": ["utils/logging.conf"]
+ ["README*"]
+ find_files("*", "completion")
+ find_files("*", "data")
+ find_files("*.exe", "vendor/distlib"),
"rezplugins": find_files("*.cmake", "build_system", root="rezplugins")
+ find_files("*", "build_system/template_files", root="rezplugins"),
"rezgui": find_files("rezguiconfig", root="rezgui")
+ find_files("*", "icons", root="rezgui"),
},
install_requires=["setuptools"],
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: Apache Software License",
Expand All @@ -94,7 +90,7 @@ def find_files(pattern, path=None, root="rez"):
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Software Development",
"Topic :: System :: Software Distribution"
"Topic :: System :: Software Distribution",
],
python_requires=">=3.7",
)
47 changes: 32 additions & 15 deletions src/rez/cli/selftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Copyright Contributors to the Rez Project


'''
"""
Run unit tests. Use pytest if available.
'''
"""

import os
import sys
Expand All @@ -15,29 +15,36 @@

try:
import pytest # noqa

use_pytest = True
except ImportError:
use_pytest = False


cli_dir = os.path.dirname(inspect.getfile(inspect.currentframe()))
src_rez_dir = os.path.dirname(cli_dir)
tests_dir = os.path.join(src_rez_dir, 'tests')
tests_dir = os.path.join(src_rez_dir, "tests")

all_module_tests = []


def setup_parser(parser, completions=False):
parser.add_argument(
"tests", metavar="NAMED_TEST", default=[], nargs="*",
"tests",
metavar="NAMED_TEST",
default=[],
nargs="*",
help="a specific test module/class/method to run; may be repeated "
"multiple times; if no tests are given, through this or other flags, "
"all tests are run")
"all tests are run",
)
parser.add_argument(
"-s", "--only-shell", metavar="SHELL",
"-s",
"--only-shell",
metavar="SHELL",
help="limit shell-dependent tests to the specified shell. Note: This "
"flag shadowed pytest '–capture=no' shorthand '-s', so the long "
"name must be used for disabling stdout/err capturing in pytest."
"flag shadowed pytest '–capture=no' shorthand '-s', so the long "
"name must be used for disabling stdout/err capturing in pytest.",
)
parser.add_argument(
"--keep-tmpdirs", action="store_true", help="Keep temporary directories."
Expand All @@ -46,7 +53,7 @@ def setup_parser(parser, completions=False):
# make an Action that will append the appropriate test to the "--test" arg
class AddTestModuleAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
name = option_string.lstrip('-')
name = option_string.lstrip("-")
if getattr(namespace, "module_tests", None) is None:
namespace.module_tests = []
namespace.module_tests.append(name)
Expand All @@ -56,20 +63,28 @@ def __call__(self, parser, namespace, values, option_string=None):
prefix = "test_"
for importer, name, ispkg in iter_modules([tests_dir]):
if not ispkg and name.startswith(prefix):
module = importer.find_module(name).load_module(name)
module = importer.find_spec(name).loader.load_module(name)
name_ = name[len(prefix):]
all_module_tests.append(name_)
tests.append((name_, module))

# create argparse entry for each module's unit test
for name, module in sorted(tests):
if not module.__doc__:
raise RuntimeError("Module {0!r} doesn't have a docstring. Please add one.".format(module.__file__))
raise RuntimeError(
"Module {0!r} doesn't have a docstring. Please add one.".format(
module.__file__
)
)

parser.add_argument(
"--%s" % name, action=AddTestModuleAction, nargs=0,
dest="module_tests", default=[],
help=module.__doc__.strip().rstrip('.'))
"--%s" % name,
action=AddTestModuleAction,
nargs=0,
dest="module_tests",
default=[],
help=module.__doc__.strip().rstrip("."),
)


def command(opts, parser, extra_arg_groups=None):
Expand Down Expand Up @@ -132,7 +147,9 @@ def run_pytest(module_tests, tests, verbosity, extra_arg_groups):
if specifier:
test_specifications.append(specifier)

module_tests = [os.path.join(tests_dir, f"test_{x}.py") for x in sorted(module_tests)]
module_tests = [
os.path.join(tests_dir, f"test_{x}.py") for x in sorted(module_tests)
]
tests = module_tests + test_specifications

argv = tests[:]
Expand Down
Loading
Loading