Skip to content
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

Rename rez.vendor.version to rez.version and define a public API for rez.version #1534

Merged
2 changes: 1 addition & 1 deletion docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ Python API
rez.system
rez.util
rez.utils
rez.vendor.version
rez.version
rez.wrapper
4 changes: 3 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
# TODO: Remove once we unvendor enum.
("py:class", "rez.solver._Common"),
("py:class", "_thread._local"),
("py:class", "rez.utils.platform_._UnixPlatform")
("py:class", "rez.utils.platform_._UnixPlatform"),
("py:class", "rez.version._util._Common"),
("py:class", "rez.version._version._Comparable"),
]

nitpick_ignore_regex = [
Expand Down
4 changes: 2 additions & 2 deletions docs/source/package_commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ Following is a list of the objects and functions available.
if "foo.cli" in ephemerals:
info("Foo cli option is being specified!")

.. py:function:: ephemerals.get_range(name: str, range_: str) -> ~rez.vendor.version.version.VersionRange
.. py:function:: ephemerals.get_range(name: str, range_: str) -> ~rez.version.VersionRange

Use ``get_range`` to test with the :func:`intersects` function.
Here, we enable ``foo``'s commandline tools by default, unless explicitly disabled via
Expand Down Expand Up @@ -539,7 +539,7 @@ Following is a list of the objects and functions available.

info("floob version is %s" % resolve.floob.version)

.. py:function:: intersects(range1: str | ~rez.vendor.version.version.VersionRange | ~rez.rex_bindings.VariantBinding | ~rez.rex_bindings.VersionBinding, range2: str) -> bool
.. py:function:: intersects(range1: str | ~rez.version.VersionRange | ~rez.rex_bindings.VariantBinding | ~rez.rex_bindings.VersionBinding, range2: str) -> bool

A boolean function that returns True if the version or version range of the given
object, intersects with the given version range. Valid objects to query include:
Expand Down
1 change: 0 additions & 1 deletion src/build_utils/license/apply_copyright
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ find ./src/rez/bind -name '*.py' > .lic.tmp
find ./src/rez/cli -name '*.py' >> .lic.tmp
find ./src/rez/tests -name '*.py' >> .lic.tmp
find ./src/rez/utils -name '*.py' >> .lic.tmp
find ./src/rez/vendor/version -name '*.py' >> .lic.tmp
find ./src/rez/bind -name '*.py' >> .lic.tmp
find ./src/rezgui -name '*.py' >> .lic.tmp
find ./src/rezplugins -name '*.py' >> .lic.tmp
Expand Down
2 changes: 1 addition & 1 deletion src/rez/bind/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Utility functions for bind modules.
"""
from __future__ import absolute_import
from rez.vendor.version.version import Version
from rez.version import Version
from rez.exceptions import RezBindError
from rez.config import config
from rez.util import which
Expand Down
2 changes: 1 addition & 1 deletion src/rez/bind/arch.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""
from __future__ import absolute_import
from rez.package_maker import make_package
from rez.vendor.version.version import Version
from rez.version import Version
from rez.bind._utils import check_version
from rez.system import system

Expand Down
2 changes: 1 addition & 1 deletion src/rez/bind/hello_world.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from __future__ import absolute_import, print_function

from rez.package_maker import make_package
from rez.vendor.version.version import Version
from rez.version import Version
from rez.utils.lint_helper import env
from rez.utils.execution import create_executable_script, ExecutableScriptMode
from rez.bind._utils import make_dirs, check_version
Expand Down
2 changes: 1 addition & 1 deletion src/rez/bind/os.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""
from __future__ import absolute_import
from rez.package_maker import make_package
from rez.vendor.version.version import Version
from rez.version import Version
from rez.bind._utils import check_version
from rez.system import system

Expand Down
2 changes: 1 addition & 1 deletion src/rez/bind/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""
from __future__ import absolute_import
from rez.package_maker import make_package
from rez.vendor.version.version import Version
from rez.version import Version
from rez.bind._utils import check_version
from rez.system import system

Expand Down
2 changes: 1 addition & 1 deletion src/rez/bind/rezgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from rez.package_maker import make_package
from rez.bind._utils import check_version, make_dirs
from rez.system import system
from rez.vendor.version.version import Version
from rez.version import Version
from rez.utils.lint_helper import env
from rez.utils.execution import create_executable_script
import shutil
Expand Down
2 changes: 1 addition & 1 deletion src/rez/cli/mv.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def list_repos_containing_pkg(pkg_name, pkg_version):


def command(opts, parser, extra_arg_groups=None):
from rez.vendor.version.requirement import VersionedObject
from rez.version import VersionedObject
from rez.packages import get_package_from_repository
from rez.package_move import move_package
import sys
Expand Down
2 changes: 1 addition & 1 deletion src/rez/cli/pkg-ignore.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def list_repos_containing_pkg(pkg_name, pkg_version):

def command(opts, parser, extra_arg_groups=None):
from rez.package_repository import package_repository_manager
from rez.vendor.version.requirement import VersionedObject
from rez.version import VersionedObject
import sys

obj = VersionedObject(opts.PKG)
Expand Down
4 changes: 2 additions & 2 deletions src/rez/cli/rm.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def setup_parser(parser, completions=False):


def remove_package(opts, parser):
from rez.vendor.version.requirement import VersionedObject
from rez.version import VersionedObject
from rez.package_remove import remove_package

if opts.dry_run:
Expand All @@ -55,7 +55,7 @@ def remove_package(opts, parser):


def remove_package_family(opts, parser, force=False):
from rez.vendor.version.requirement import VersionedObject
from rez.version import VersionedObject
from rez.package_remove import remove_package_family
from rez.exceptions import PackageRepositoryError

Expand Down
3 changes: 3 additions & 0 deletions src/rez/cli/selftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ def __call__(self, parser, namespace, values, option_string=None):

# 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__))

parser.add_argument(
"--%s" % name, action=AddTestModuleAction, nargs=0,
dest="module_tests", default=[],
Expand Down
2 changes: 1 addition & 1 deletion src/rez/package_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from rez.config import config
from rez.utils.data_utils import cached_property, cached_class_property
from rez.vendor.six import six
from rez.vendor.version.requirement import VersionedObject, Requirement
from rez.version import VersionedObject, Requirement
from hashlib import sha1
import fnmatch
import re
Expand Down
2 changes: 1 addition & 1 deletion src/rez/package_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from rez.package_py_utils import expand_requirement
from rez.vendor.schema.schema import Schema, Optional, Or, Use, And
from rez.vendor.six import six
from rez.vendor.version.version import Version
from rez.version import Version
from contextlib import contextmanager
import os

Expand Down
2 changes: 1 addition & 1 deletion src/rez/package_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from rez.config import config
from rez.utils.data_utils import cached_class_property
from rez.vendor.version.version import Version
from rez.version import Version


class PackageOrder(object):
Expand Down
4 changes: 2 additions & 2 deletions src/rez/package_py_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def expand_requirement(request, paths=None):
if '*' not in request:
return request

from rez.vendor.version.version import VersionRange
from rez.vendor.version.requirement import Requirement
from rez.version import VersionRange
from rez.version import Requirement
from rez.packages import get_latest_package
from uuid import uuid4

Expand Down
2 changes: 1 addition & 1 deletion src/rez/package_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


from rez.package_repository import package_repository_manager
from rez.vendor.version.version import Version
from rez.version import Version
from rez.utils.logging_ import print_info
from rez.vendor.six import six
from rez.config import config
Expand Down
2 changes: 1 addition & 1 deletion src/rez/package_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from rez.utils.formatting import PackageRequest
from rez.exceptions import PackageMetadataError, ResourceError
from rez.config import config, Config, create_config
from rez.vendor.version.version import Version
from rez.version import Version
from rez.vendor.schema.schema import Schema, SchemaError, Optional, Or, And, Use
from rez.vendor.six import six

Expand Down
2 changes: 1 addition & 1 deletion src/rez/package_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from rez.config import config

from rez.vendor.version.requirement import Requirement
from rez.version import Requirement


def get_reverse_dependency_tree(package_name, depth=None, paths=None,
Expand Down
2 changes: 1 addition & 1 deletion src/rez/package_serialise.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from rez.serialise import FileFormat
from rez.package_resources import help_schema, late_bound
from rez.vendor.schema.schema import Schema, Optional, And, Or, Use
from rez.vendor.version.version import Version
from rez.version import Version
from rez.utils.schema import extensible_schema_dict
from rez.utils.sourcecode import SourceCode
from rez.utils.formatting import PackageRequest, indent, \
Expand Down
2 changes: 1 addition & 1 deletion src/rez/package_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from rez.utils.colorize import heading, Printer
from rez.utils.logging_ import print_info, print_warning, print_error
from rez.vendor.six import six
from rez.vendor.version.requirement import Requirement, RequirementList
from rez.version import Requirement, RequirementList
from rez.utils.py23 import quote
import time
import sys
Expand Down
4 changes: 2 additions & 2 deletions src/rez/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
from rez.utils.schema import schema_keys
from rez.utils.resources import ResourceHandle, ResourceWrapper
from rez.exceptions import PackageFamilyNotFoundError, ResourceError
from rez.vendor.version.version import Version, VersionRange
from rez.vendor.version.requirement import VersionedObject
from rez.version import Version, VersionRange
from rez.version import VersionedObject
from rez.vendor.six import six
from rez.serialise import FileFormat
from rez.config import config
Expand Down
2 changes: 1 addition & 1 deletion src/rez/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from __future__ import print_function, absolute_import

from rez.packages import get_latest_package
from rez.vendor.version.version import Version
from rez.version import Version
from rez.vendor.distlib.database import DistributionPath
from rez.vendor.enum.enum import Enum
from rez.vendor.packaging.version import Version as PackagingVersion
Expand Down
4 changes: 2 additions & 2 deletions src/rez/resolved_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
read_graph_from_string
from rez.utils.resolve_graph import failure_detail_from_graph
from rez.vendor.six import six
from rez.vendor.version.version import VersionRange
from rez.vendor.version.requirement import Requirement
from rez.version import VersionRange
from rez.version import Requirement
from rez.vendor.enum import Enum
from rez.vendor import yaml
from rez.utils import json
Expand Down
2 changes: 1 addition & 1 deletion src/rez/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from rez.utils.logging_ import log_duration
from rez.config import config
from rez.vendor.enum import Enum
from rez.vendor.version.requirement import Requirement
from rez.version import Requirement
from contextlib import contextmanager
from hashlib import sha1

Expand Down
4 changes: 2 additions & 2 deletions src/rez/rex_bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
unnecessary data from Rex, and provide APIs that will not change.
"""
from rez.vendor.six import six
from rez.vendor.version.version import VersionRange
from rez.vendor.version.requirement import Requirement
from rez.version import VersionRange
from rez.version import Requirement


basestring = six.string_types[0]
Expand Down
5 changes: 2 additions & 3 deletions src/rez/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
from rez.vendor.pygraph.algorithms.accessibility import accessibility
from rez.exceptions import PackageNotFoundError, ResolveError, \
PackageFamilyNotFoundError, RezSystemError
from rez.vendor.version.version import VersionRange
from rez.vendor.version.requirement import VersionedObject, Requirement, \
RequirementList
from rez.version import VersionRange
from rez.version import VersionedObject, Requirement, RequirementList
from rez.vendor.enum import Enum
from contextlib import contextmanager
from itertools import product, chain
Expand Down
2 changes: 1 addition & 1 deletion src/rez/tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""
test package commands
"""
from rez.vendor.version.requirement import VersionedObject
from rez.version import VersionedObject
from rez.rex import Comment, EnvAction, Shebang, Setenv, Alias, Appendenv
from rez.resolved_context import ResolvedContext
from rez.utils.filesystem import canonical_path
Expand Down
2 changes: 1 addition & 1 deletion src/rez/tests/test_copy_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from rez.resolved_context import ResolvedContext
from rez.packages import get_latest_package
from rez.package_copy import copy_package
from rez.vendor.version.version import VersionRange
from rez.version import VersionRange
from rez.tests.util import TestBase, TempdirMixin


Expand Down
2 changes: 1 addition & 1 deletion src/rez/tests/test_package_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""
from rez.tests.util import TestBase
from rez.packages import iter_packages
from rez.vendor.version.requirement import Requirement
from rez.version import Requirement
from rez.package_filter import PackageFilter, PackageFilterList, GlobRule, \
RegexRule, RangeRule, TimestampRule

Expand Down
4 changes: 2 additions & 2 deletions src/rez/tests/test_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from rez.utils.formatting import PackageRequest
from rez.utils.sourcecode import SourceCode
import unittest
from rez.vendor.version.version import Version
from rez.vendor.version.util import VersionError
from rez.version import Version
from rez.version import VersionError
from rez.utils.filesystem import canonical_path
import shutil
import os.path
Expand Down
2 changes: 1 addition & 1 deletion src/rez/tests/test_packages_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
TimestampPackageOrder, SortedOrder, PackageOrderList, from_pod
from rez.packages import iter_packages
from rez.tests.util import TestBase, TempdirMixin
from rez.vendor.version.version import Version
from rez.version import Version


class _BaseTestPackagesOrder(TestBase, TempdirMixin):
Expand Down
4 changes: 2 additions & 2 deletions src/rez/tests/test_pip_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

import rez.vendor.packaging.version
import rez.vendor.distlib.database
from rez.vendor.version.version import VersionRange
from rez.vendor.version.requirement import Requirement
from rez.version import VersionRange
from rez.version import Requirement
from rez.vendor.packaging.requirements import Requirement as packaging_Requirement
from rez.vendor.packaging.specifiers import SpecifierSet
from rez.exceptions import PackageRequestError
Expand Down
4 changes: 2 additions & 2 deletions src/rez/tests/test_rex.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from rez.exceptions import RexError, RexUndefinedVariableError
from rez.config import config
import unittest
from rez.vendor.version.version import Version
from rez.vendor.version.requirement import Requirement
from rez.version import Version
from rez.version import Requirement
from rez.tests.util import TestBase
from rez.utils.backcompat import convert_old_commands
from rez.package_repository import package_repository_manager
Expand Down
2 changes: 1 addition & 1 deletion src/rez/tests/test_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from __future__ import print_function

import rez.exceptions
from rez.vendor.version.requirement import Requirement
from rez.version import Requirement
from rez.solver import Solver, Cycle, SolverStatus
from rez.config import config
import unittest
Expand Down
Loading
Loading