diff options
| author | ?ric Araujo <merwok@netwok.org> | 2010-06-26 01:43:30 +0200 |
|---|---|---|
| committer | ?ric Araujo <merwok@netwok.org> | 2010-06-26 01:43:30 +0200 |
| commit | bdc0c044f10ee2d74581799c4f1aed4f89bdec47 (patch) | |
| tree | 703ece9347374e9eacaa853f081556717275a5f6 /src | |
| parent | ac68a8c17be2d6c1db1ecdcf9b6e10d287ed1c76 (diff) | |
| download | disutils2-bdc0c044f10ee2d74581799c4f1aed4f89bdec47.tar.gz | |
Make all classes new-style classes.
This will make 3.x migration easier (we will catch incompatibilities
sooner thanks to python2.6 -3, e.g. the __hash__ deprecation warning),
it allows us to use properties, super and other niceties, and new-style
classes are instantiated faster.
Diffstat (limited to 'src')
| -rw-r--r-- | src/distutils2/_backport/pkgutil.py | 10 | ||||
| -rw-r--r-- | src/distutils2/_backport/tarfile.py | 10 | ||||
| -rw-r--r-- | src/distutils2/command/cmd.py | 2 | ||||
| -rw-r--r-- | src/distutils2/compiler/ccompiler.py | 2 | ||||
| -rw-r--r-- | src/distutils2/compiler/msvc9compiler.py | 4 | ||||
| -rw-r--r-- | src/distutils2/compiler/msvccompiler.py | 2 | ||||
| -rw-r--r-- | src/distutils2/extension.py | 2 | ||||
| -rw-r--r-- | src/distutils2/fancy_getopt.py | 4 | ||||
| -rw-r--r-- | src/distutils2/log.py | 2 | ||||
| -rwxr-xr-x | src/distutils2/mkpkg.py | 2 | ||||
| -rw-r--r-- | src/distutils2/tests/__init__.py | 2 |
11 files changed, 24 insertions, 18 deletions
diff --git a/src/distutils2/_backport/pkgutil.py b/src/distutils2/_backport/pkgutil.py index 99f54ae..b033082 100644 --- a/src/distutils2/_backport/pkgutil.py +++ b/src/distutils2/_backport/pkgutil.py @@ -179,7 +179,7 @@ def iter_importer_modules(importer, prefix=''): iter_importer_modules = simplegeneric(iter_importer_modules) -class ImpImporter: +class ImpImporter(object): """:pep:`302` Importer that wraps Python's "classic" import algorithm ``ImpImporter(dirname)`` produces a :pep:`302` importer that searches that @@ -242,7 +242,7 @@ class ImpImporter: yield prefix + modname, ispkg -class ImpLoader: +class ImpLoader(object): """:pep:`302` Loader that wraps Python's "classic" import algorithm """ code = source = None @@ -732,6 +732,9 @@ class Distribution(object): def __eq__(self, other): return isinstance(other, Distribution) and self.path == other.path + # See http://docs.python.org/reference/datamodel#object.__hash__ + __hash__ = object.__hash__ + class EggInfoDistribution(object): """Created with the *path* of the ``.egg-info`` directory or file provided @@ -847,6 +850,9 @@ class EggInfoDistribution(object): return isinstance(other, EggInfoDistribution) and \ self.path == other.path + # See http://docs.python.org/reference/datamodel#object.__hash__ + __hash__ = object.__hash__ + def _normalize_dist_name(name): """Returns a normalized name from the given *name*. diff --git a/src/distutils2/_backport/tarfile.py b/src/distutils2/_backport/tarfile.py index 5399846..ab0a14b 100644 --- a/src/distutils2/_backport/tarfile.py +++ b/src/distutils2/_backport/tarfile.py @@ -370,7 +370,7 @@ class SubsequentHeaderError(HeaderError): #--------------------------- # internal stream interface #--------------------------- -class _LowLevelFile: +class _LowLevelFile(object): """Low-level file object. Supports reading and writing. It is used instead of a regular file object for streaming access. @@ -394,7 +394,7 @@ class _LowLevelFile: def write(self, s): os.write(self.fd, s) -class _Stream: +class _Stream(object): """Class that serves as an adapter between TarFile and a stream-like object. The stream-like object only needs to have a read() or write() method and is accessed @@ -2423,7 +2423,7 @@ class TarFile(object): print >> sys.stderr, msg # class TarFile -class TarIter: +class TarIter(object): """Iterator Class. for tarinfo in TarFile(...): @@ -2460,7 +2460,7 @@ class TarIter: return tarinfo # Helper classes for sparse file support -class _section: +class _section(object): """Base class for _data and _hole. """ def __init__(self, offset, size): @@ -2507,7 +2507,7 @@ class _ringbuffer(list): #--------------------------------------------- TAR_PLAIN = 0 # zipfile.ZIP_STORED TAR_GZIPPED = 8 # zipfile.ZIP_DEFLATED -class TarFileCompat: +class TarFileCompat(object): """TarFile class compatible with standard module zipfile's ZipFile class. """ diff --git a/src/distutils2/command/cmd.py b/src/distutils2/command/cmd.py index e94263b..57ffdb8 100644 --- a/src/distutils2/command/cmd.py +++ b/src/distutils2/command/cmd.py @@ -19,7 +19,7 @@ try: except ImportError: from distutils2._backport.shutil import make_archive -class Command: +class Command(object): """Abstract base class for defining command classes, the "worker bees" of the Distutils. A useful analogy for command classes is to think of them as subroutines with local variables called "options". The options diff --git a/src/distutils2/compiler/ccompiler.py b/src/distutils2/compiler/ccompiler.py index 025febd..5fdf0ee 100644 --- a/src/distutils2/compiler/ccompiler.py +++ b/src/distutils2/compiler/ccompiler.py @@ -76,7 +76,7 @@ def customize_compiler(compiler): compiler.shared_lib_extension = so_ext -class CCompiler: +class CCompiler(object): """Abstract base class to define the interface that must be implemented by real compiler classes. Also has some utility methods used by several compiler classes. diff --git a/src/distutils2/compiler/msvc9compiler.py b/src/distutils2/compiler/msvc9compiler.py index 9f98d60..72cc0de 100644 --- a/src/distutils2/compiler/msvc9compiler.py +++ b/src/distutils2/compiler/msvc9compiler.py @@ -50,7 +50,7 @@ PLAT_TO_VCVARS = { 'win-ia64' : 'ia64', } -class Reg: +class Reg(object): """Helper class to read values from the registry """ @@ -112,7 +112,7 @@ class Reg: return s convert_mbcs = staticmethod(convert_mbcs) -class MacroExpander: +class MacroExpander(object): def __init__(self, version): self.macros = {} diff --git a/src/distutils2/compiler/msvccompiler.py b/src/distutils2/compiler/msvccompiler.py index 46f8517..da5954c 100644 --- a/src/distutils2/compiler/msvccompiler.py +++ b/src/distutils2/compiler/msvccompiler.py @@ -104,7 +104,7 @@ def convert_mbcs(s): pass return s -class MacroExpander: +class MacroExpander(object): def __init__(self, version): self.macros = {} diff --git a/src/distutils2/extension.py b/src/distutils2/extension.py index 430b919..2308ac2 100644 --- a/src/distutils2/extension.py +++ b/src/distutils2/extension.py @@ -23,7 +23,7 @@ except ImportError: # import that large-ish module (indirectly, through distutils.core) in # order to do anything. -class Extension: +class Extension(object): """Just a collection of attributes that describes an extension module and everything needed to build it (hopefully in a portable way, but there are hooks that let you be as unportable as you need). diff --git a/src/distutils2/fancy_getopt.py b/src/distutils2/fancy_getopt.py index 1382b24..e0ac736 100644 --- a/src/distutils2/fancy_getopt.py +++ b/src/distutils2/fancy_getopt.py @@ -30,7 +30,7 @@ neg_alias_re = re.compile("^(%s)=!(%s)$" % (longopt_pat, longopt_pat)) # (for use as attributes of some object). longopt_xlate = string.maketrans('-', '_') -class FancyGetopt: +class FancyGetopt(object): """Wrapper around the standard 'getopt()' module that provides some handy extra functionality: * short and long options are tied together @@ -473,7 +473,7 @@ def translate_longopt(opt): return string.translate(opt, longopt_xlate) -class OptionDummy: +class OptionDummy(object): """Dummy class just used as a place to hold command-line option values as instance attributes.""" diff --git a/src/distutils2/log.py b/src/distutils2/log.py index 7588570..1f92464 100644 --- a/src/distutils2/log.py +++ b/src/distutils2/log.py @@ -11,7 +11,7 @@ FATAL = 5 import sys -class Log: +class Log(object): def __init__(self, threshold=WARN): self.threshold = threshold diff --git a/src/distutils2/mkpkg.py b/src/distutils2/mkpkg.py index 42ea7fe..7fc3b2e 100755 --- a/src/distutils2/mkpkg.py +++ b/src/distutils2/mkpkg.py @@ -675,7 +675,7 @@ def buildTroveDict(troveList): troveDict = buildTroveDict(troveList) -class SetupClass: +class SetupClass(object): def __init__(self): self.config = None self.classifierDict = {} diff --git a/src/distutils2/tests/__init__.py b/src/distutils2/tests/__init__.py index f5b4b1e..8a8d187 100644 --- a/src/distutils2/tests/__init__.py +++ b/src/distutils2/tests/__init__.py @@ -45,7 +45,7 @@ class TestFailed(Error): """Test failed.""" -class BasicTestRunner: +class BasicTestRunner(object): def run(self, test): result = unittest.TestResult() test(result) |
