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

pull basestring from six.string_types - py2 gets basestring, py3 gets str #721

Merged
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
4 changes: 4 additions & 0 deletions src/rez/bind/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -16,6 +17,9 @@
import sys


basestring = six.string_types[0]


def log(msg):
if config.debug("bind_modules"):
print_debug(msg)
Expand Down
4 changes: 4 additions & 0 deletions src/rez/cli/forward.py
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
3 changes: 3 additions & 0 deletions src/rez/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import copy


basestring = six.string_types[0]


# -----------------------------------------------------------------------------
# Schema Implementations
# -----------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions src/rez/developer_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
4 changes: 4 additions & 0 deletions src/rez/package_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions src/rez/package_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions src/rez/package_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
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
import os.path
import sys


basestring = six.string_types[0]


class PackageHelp(object):
"""Object for extracting and viewing help for a package.

Expand Down
4 changes: 4 additions & 0 deletions src/rez/package_maker__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down
4 changes: 4 additions & 0 deletions src/rez/package_py_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions src/rez/package_resources_.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
from hashlib import sha1


basestring = six.string_types[0]


# package attributes created at release time
package_release_keys = (
"timestamp",
Expand Down
4 changes: 4 additions & 0 deletions src/rez/package_serialise.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/rez/package_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
3 changes: 3 additions & 0 deletions src/rez/packages_.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
# ------------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions src/rez/plugin_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions src/rez/resolved_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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."""
Expand Down
4 changes: 4 additions & 0 deletions src/rez/rex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]


#===============================================================================
Expand Down
4 changes: 4 additions & 0 deletions src/rez/shells.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/rez/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@
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
import shutil
import sys


basestring = six.string_types[0]


class Suite(object):
"""A collection of contexts.

Expand Down
4 changes: 4 additions & 0 deletions src/rez/tests/test_resources_.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions src/rez/tests/test_shells.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/rez/utils/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 4 additions & 2 deletions src/rez/utils/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import stat
import platform

from rez.vendor.six import six


class TempDirs(object):
"""Tempdir manager.
Expand Down Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions src/rez/utils/graph_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions src/rez/utils/memcached.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/rez/utils/schema.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/rezgui/widgets/ContextSettingsWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
4 changes: 4 additions & 0 deletions src/rezplugins/build_system/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@
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
import sys
import os


basestring = six.string_types[0]


class RezCMakeError(BuildSystemError):
pass

Expand Down
4 changes: 4 additions & 0 deletions src/rezplugins/build_system/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
Loading