diff --git a/src/rez/bind/_utils.py b/src/rez/bind/_utils.py index fe315dd4d..aefe6484c 100644 --- a/src/rez/bind/_utils.py +++ b/src/rez/bind/_utils.py @@ -8,6 +8,7 @@ from rez.util import which from rez.utils.system import popen from rez.utils.logging_ import print_debug +from rez.vendor.six import six from pipes import quote import subprocess import os.path @@ -16,6 +17,9 @@ import sys +basestring = six.string_types[0] + + def log(msg): if config.debug("bind_modules"): print_debug(msg) diff --git a/src/rez/cli/forward.py b/src/rez/cli/forward.py index 18bd93885..ac6c515eb 100644 --- a/src/rez/cli/forward.py +++ b/src/rez/cli/forward.py @@ -1,9 +1,13 @@ """See util.create_forwarding_script().""" import argparse +from rez.vendor.six import six __doc__ = argparse.SUPPRESS +basestring = six.string_types[0] + + def setup_parser(parser, completions=False): parser.add_argument("YAML", type=str) parser.add_argument("ARG", type=str, nargs=argparse.REMAINDER) diff --git a/src/rez/config.py b/src/rez/config.py index 1ae029b44..894408139 100644 --- a/src/rez/config.py +++ b/src/rez/config.py @@ -21,6 +21,9 @@ import copy +basestring = six.string_types[0] + + # ----------------------------------------------------------------------------- # Schema Implementations # ----------------------------------------------------------------------------- diff --git a/src/rez/developer_package.py b/src/rez/developer_package.py index 53242ca47..a14145a86 100644 --- a/src/rez/developer_package.py +++ b/src/rez/developer_package.py @@ -7,11 +7,15 @@ from rez.utils.sourcecode import SourceCode from rez.utils.logging_ import print_info, print_error from rez.vendor.enum import Enum +from rez.vendor.six import six from inspect import isfunction import os.path import stat +basestring = six.string_types[0] + + class PreprocessMode(Enum): """Defines when a package preprocess will be executed. """ diff --git a/src/rez/package_copy.py b/src/rez/package_copy.py index 78c71bcbc..e020c3af2 100644 --- a/src/rez/package_copy.py +++ b/src/rez/package_copy.py @@ -13,6 +13,10 @@ from rez.utils.logging_ import print_info, print_warning from rez.utils.filesystem import replacing_symlink, replacing_copy, \ safe_makedirs, additive_copytree, make_path_writable, get_existing_path +from rez.vendor.six import six + + +basestring = six.string_types[0] def copy_package(package, dest_repository, variants=None, shallow=False, diff --git a/src/rez/package_filter.py b/src/rez/package_filter.py index b2a790079..a97d74f55 100644 --- a/src/rez/package_filter.py +++ b/src/rez/package_filter.py @@ -2,12 +2,16 @@ from rez.exceptions import ConfigurationError 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 hashlib import sha1 import fnmatch import re +basestring = six.string_types[0] + + class PackageFilterBase(object): def excludes(self, package): """Determine if the filter excludes the given package. diff --git a/src/rez/package_help.py b/src/rez/package_help.py index 50c0186be..5ff01b2b8 100644 --- a/src/rez/package_help.py +++ b/src/rez/package_help.py @@ -6,6 +6,7 @@ from rez.utils.system import popen from rez.utils.backcompat import convert_old_command_expansions from rez.utils.scope import scoped_formatter +from rez.vendor.six import six from rez.system import system import subprocess import webbrowser @@ -13,6 +14,9 @@ import sys +basestring = six.string_types[0] + + class PackageHelp(object): """Object for extracting and viewing help for a package. diff --git a/src/rez/package_maker__.py b/src/rez/package_maker__.py index dd80dd402..13288e421 100644 --- a/src/rez/package_maker__.py +++ b/src/rez/package_maker__.py @@ -11,11 +11,15 @@ from rez.packages_ import Package 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 contextlib import contextmanager import os +basestring = six.string_types[0] + + # this schema will automatically harden request strings like 'python-*'; see # the 'expand_requires' function for more info. # diff --git a/src/rez/package_py_utils.py b/src/rez/package_py_utils.py index 207591cd4..8ef487613 100644 --- a/src/rez/package_py_utils.py +++ b/src/rez/package_py_utils.py @@ -9,6 +9,10 @@ # these imports just forward the symbols into this module's namespace from rez.utils.system import popen from rez.exceptions import InvalidPackageError +from rez.vendor.six import six + + +basestring = six.string_types[0] def expand_requirement(request, paths=None): diff --git a/src/rez/package_resources_.py b/src/rez/package_resources_.py index 97451d5da..61e32a59a 100644 --- a/src/rez/package_resources_.py +++ b/src/rez/package_resources_.py @@ -17,6 +17,9 @@ from hashlib import sha1 +basestring = six.string_types[0] + + # package attributes created at release time package_release_keys = ( "timestamp", diff --git a/src/rez/package_serialise.py b/src/rez/package_serialise.py index ce8ffdfe6..f350cb117 100644 --- a/src/rez/package_serialise.py +++ b/src/rez/package_serialise.py @@ -11,6 +11,10 @@ from rez.utils.schema import Required from rez.utils.yaml import dump_yaml from pprint import pformat +from rez.vendor.six import six + + +basestring = six.string_types[0] # preferred order of keys in a package definition file diff --git a/src/rez/package_test.py b/src/rez/package_test.py index a19e59c8a..e2c5b6a6a 100644 --- a/src/rez/package_test.py +++ b/src/rez/package_test.py @@ -3,12 +3,16 @@ from rez.packages_ import get_latest_package_from_string, Variant from rez.exceptions import PackageNotFoundError, PackageTestError from rez.utils.colorize import heading, Printer +from rez.vendor.six import six from pipes import quote import subprocess import time import sys +basestring = six.string_types[0] + + class PackageTestRunner(object): """Object for running a package's tests. diff --git a/src/rez/packages_.py b/src/rez/packages_.py index 0e14d7a2e..2e17d5022 100644 --- a/src/rez/packages_.py +++ b/src/rez/packages_.py @@ -12,11 +12,14 @@ from rez.exceptions import PackageFamilyNotFoundError, ResourceError from rez.vendor.version.version import VersionRange from rez.vendor.version.requirement import VersionedObject +from rez.vendor.six import six from rez.serialise import FileFormat from rez.config import config import sys +basestring = six.string_types[0] + # ------------------------------------------------------------------------------ # package-related classes # ------------------------------------------------------------------------------ diff --git a/src/rez/plugin_managers.py b/src/rez/plugin_managers.py index 4860f1743..56891688f 100644 --- a/src/rez/plugin_managers.py +++ b/src/rez/plugin_managers.py @@ -6,11 +6,15 @@ from rez.utils.schema import dict_to_schema from rez.utils.data_utils import LazySingleton, cached_property, deep_update from rez.utils.logging_ import print_debug, print_warning +from rez.vendor.six import six from rez.exceptions import RezPluginError import os.path import sys +basestring = six.string_types[0] + + # modified from pkgutil standard library: # this function is called from the __init__.py files of each plugin type inside # the 'rezplugins' package. diff --git a/src/rez/resolved_context.py b/src/rez/resolved_context.py index f3d9a4434..4456f5e2f 100644 --- a/src/rez/resolved_context.py +++ b/src/rez/resolved_context.py @@ -23,6 +23,7 @@ from rez.shells import create_shell from rez.exceptions import ResolvedContextError, PackageCommandError, RezError from rez.utils.graph_utils import write_dot, write_compacted, read_graph_from_string +from rez.vendor.six import six from rez.vendor.version.version import VersionRange from rez.vendor.enum import Enum from rez.vendor import yaml @@ -42,6 +43,9 @@ import os.path +basestring = six.string_types[0] + + class RezToolsVisibility(Enum): """Determines if/how rez cli tools are added back to PATH within a resolved environment.""" diff --git a/src/rez/rex.py b/src/rez/rex.py index 95f41bf20..db7e9a5e1 100644 --- a/src/rez/rex.py +++ b/src/rez/rex.py @@ -18,6 +18,10 @@ from rez.utils.data_utils import AttrDictWrapper from rez.utils.formatting import expandvars from rez.vendor.enum import Enum +from rez.vendor.six import six + + +basestring = six.string_types[0] #=============================================================================== diff --git a/src/rez/shells.py b/src/rez/shells.py index df696d7c3..9bae5992a 100644 --- a/src/rez/shells.py +++ b/src/rez/shells.py @@ -10,12 +10,16 @@ from rez.exceptions import RezSystemError from rez.rex import EscapedString from rez.config import config +from rez.vendor.six import six import subprocess import os import os.path import pipes +basestring = six.string_types[0] + + def get_shell_types(): """Returns the available shell types: bash, tcsh etc.""" from rez.plugin_managers import plugin_manager diff --git a/src/rez/suite.py b/src/rez/suite.py index 9e84e9e20..6c65d9b00 100644 --- a/src/rez/suite.py +++ b/src/rez/suite.py @@ -9,6 +9,7 @@ from rez.vendor import yaml from rez.vendor.yaml.error import YAMLError from rez.utils.yaml import dump_yaml +from rez.vendor.six import six from collections import defaultdict import os import os.path @@ -16,6 +17,9 @@ import sys +basestring = six.string_types[0] + + class Suite(object): """A collection of contexts. diff --git a/src/rez/tests/test_resources_.py b/src/rez/tests/test_resources_.py index 97fda4978..c016f2a38 100644 --- a/src/rez/tests/test_resources_.py +++ b/src/rez/tests/test_resources_.py @@ -9,6 +9,10 @@ from rez.exceptions import ResourceError import unittest from rez.vendor.schema.schema import Schema, Use, And, Optional +from rez.vendor.six import six + + +basestring = six.string_types[0] class PetResourceError(Exception): diff --git a/src/rez/tests/test_shells.py b/src/rez/tests/test_shells.py index 1e4a9dd6a..1b2c394d7 100644 --- a/src/rez/tests/test_shells.py +++ b/src/rez/tests/test_shells.py @@ -13,6 +13,7 @@ from rez.util import which from rez.bind import hello_world from rez.utils.platform_ import platform_ +from rez.vendor.six import six import subprocess import tempfile import inspect diff --git a/src/rez/utils/data_utils.py b/src/rez/utils/data_utils.py index f57d1e741..92b2e1be8 100644 --- a/src/rez/utils/data_utils.py +++ b/src/rez/utils/data_utils.py @@ -5,6 +5,10 @@ from rez.exceptions import RexError from collections import MutableMapping from threading import Lock +from rez.vendor.six import six + + +basestring = six.string_types[0] class ModifyList(object): diff --git a/src/rez/utils/filesystem.py b/src/rez/utils/filesystem.py index 338b609be..b7a386dd4 100644 --- a/src/rez/utils/filesystem.py +++ b/src/rez/utils/filesystem.py @@ -18,6 +18,8 @@ import stat import platform +from rez.vendor.six import six + class TempDirs(object): """Tempdir manager. @@ -477,10 +479,10 @@ def encode_filesystem_name(input_str): As an example, the string "Foo_Bar (fun).txt" would get encoded as: _foo___bar_020_028fun_029.txt """ - if isinstance(input_str, str): + if isinstance(input_str, six.string_types): input_str = unicode(input_str) elif not isinstance(input_str, unicode): - raise TypeError("input_str must be a basestring") + raise TypeError("input_str must be a %s" % six.string_types[0].__name__) as_is = u'abcdefghijklmnopqrstuvwxyz0123456789.-' uppercase = u'ABCDEFGHIJKLMNOPQRSTUVWXYZ' diff --git a/src/rez/utils/graph_utils.py b/src/rez/utils/graph_utils.py index eed17c2ea..416a2d93c 100644 --- a/src/rez/utils/graph_utils.py +++ b/src/rez/utils/graph_utils.py @@ -17,6 +17,10 @@ from rez.vendor.pygraph.readwrite.dot import read as read_dot from rez.vendor.pygraph.algorithms.accessibility import accessibility from rez.vendor.pygraph.classes.digraph import digraph +from rez.vendor.six import six + + +basestring = six.string_types[0] def read_graph_from_string(txt): diff --git a/src/rez/utils/memcached.py b/src/rez/utils/memcached.py index f1b86ba59..79e3f87ba 100644 --- a/src/rez/utils/memcached.py +++ b/src/rez/utils/memcached.py @@ -8,6 +8,9 @@ from inspect import getargspec, isgeneratorfunction from hashlib import md5 from uuid import uuid4 +from rez.vendor.six import six + +basestring = six.string_types[0] # this version should be changed if and when the caching interface changes diff --git a/src/rez/utils/schema.py b/src/rez/utils/schema.py index be694203a..b6af6c3e7 100644 --- a/src/rez/utils/schema.py +++ b/src/rez/utils/schema.py @@ -1,9 +1,13 @@ """ Utilities for working with dict-based schemas. """ +from rez.vendor.six import six from rez.vendor.schema.schema import Schema, Optional, Use, And +basestring = six.string_types[0] + + # an alias which just so happens to be the same number of characters as # 'Optional' so that our schema are easier to read Required = Schema diff --git a/src/rezgui/widgets/ContextSettingsWidget.py b/src/rezgui/widgets/ContextSettingsWidget.py index 935f14d14..adca7837c 100644 --- a/src/rezgui/widgets/ContextSettingsWidget.py +++ b/src/rezgui/widgets/ContextSettingsWidget.py @@ -4,11 +4,15 @@ from rezgui.models.ContextModel import ContextModel from rez.config import config from rez.vendor import yaml +from rez.vendor.six import six from rez.vendor.yaml.error import YAMLError from rez.vendor.schema.schema import Schema, SchemaError, Or, And, Use from functools import partial +basestring = six.string_types[0] + + class ContextSettingsWidget(QtGui.QWidget, ContextViewMixin): titles = { diff --git a/src/rezplugins/build_system/cmake.py b/src/rezplugins/build_system/cmake.py index 57080898c..fe8dd8978 100644 --- a/src/rezplugins/build_system/cmake.py +++ b/src/rezplugins/build_system/cmake.py @@ -13,6 +13,7 @@ from rez.config import config from rez.backport.shutilwhich import which from rez.vendor.schema.schema import Or +from rez.vendor.six import six from rez.shells import create_shell import functools import os.path @@ -20,6 +21,9 @@ import os +basestring = six.string_types[0] + + class RezCMakeError(BuildSystemError): pass diff --git a/src/rezplugins/build_system/custom.py b/src/rezplugins/build_system/custom.py index 83207e07c..c3ca1d21c 100644 --- a/src/rezplugins/build_system/custom.py +++ b/src/rezplugins/build_system/custom.py @@ -14,9 +14,13 @@ from rez.exceptions import PackageMetadataError from rez.utils.colorize import heading, Printer from rez.utils.logging_ import print_warning +from rez.vendor.six import six from rez.config import config +basestring = six.string_types[0] + + class CustomBuildSystem(BuildSystem): """This build system runs the 'build_command' defined in a package.py. diff --git a/src/rezplugins/package_repository/filesystem.py b/src/rezplugins/package_repository/filesystem.py index f68461176..6b1a3b92b 100644 --- a/src/rezplugins/package_repository/filesystem.py +++ b/src/rezplugins/package_repository/filesystem.py @@ -27,9 +27,13 @@ from rez.config import config from rez.backport.lru_cache import lru_cache from rez.vendor.schema.schema import Schema, Optional, And, Use, Or +from rez.vendor.six import six from rez.vendor.version.version import Version, VersionRange +basestring = six.string_types[0] + + debug_print = config.debug_printer("resources") diff --git a/src/rezplugins/release_hook/amqp.py b/src/rezplugins/release_hook/amqp.py index e6116b761..1baaa5813 100644 --- a/src/rezplugins/release_hook/amqp.py +++ b/src/rezplugins/release_hook/amqp.py @@ -6,9 +6,13 @@ from rez.release_hook import ReleaseHook from rez.utils.logging_ import print_error, print_debug from rez.utils.amqp import publish_message +from rez.vendor.six import six from rez.config import config +basestring = six.string_types[0] + + class AmqpReleaseHook(ReleaseHook): """ Publishes a message to the broker. diff --git a/src/rezplugins/release_hook/command.py b/src/rezplugins/release_hook/command.py index f73b72a6a..59644af01 100644 --- a/src/rezplugins/release_hook/command.py +++ b/src/rezplugins/release_hook/command.py @@ -16,9 +16,13 @@ from rez.utils.scope import scoped_formatter from rez.utils.formatting import expandvars from rez.vendor.schema.schema import Schema, Or, Optional, Use, And +from rez.vendor.six import six from rez.util import which +basestring = six.string_types[0] + + class CommandReleaseHook(ReleaseHook): commands_schema = Schema( diff --git a/src/rezplugins/release_hook/emailer.py b/src/rezplugins/release_hook/emailer.py index 94c0fc975..7e5a4237d 100644 --- a/src/rezplugins/release_hook/emailer.py +++ b/src/rezplugins/release_hook/emailer.py @@ -10,11 +10,15 @@ from rez.utils.yaml import load_yaml from rez.utils.scope import scoped_formatter from rez.vendor.schema.schema import Or +from rez.vendor.six import six import os.path import smtplib import sys +basestring = six.string_types[0] + + class EmailReleaseHook(ReleaseHook): schema_dict = { diff --git a/src/rezplugins/shell/cmd.py b/src/rezplugins/shell/cmd.py index 4a9d07d43..4134db046 100644 --- a/src/rezplugins/shell/cmd.py +++ b/src/rezplugins/shell/cmd.py @@ -8,12 +8,16 @@ from rez.utils.system import popen from rez.utils.platform_ import platform_ from rez.util import shlex_join +from rez.vendor.six import six from functools import partial import os import re import subprocess +basestring = six.string_types[0] + + class CMD(Shell): # For reference, the ss64 web page provides useful documentation on builtin # commands for the Windows Command Prompt (cmd). It can be found here :