Anonymous avatar Anonymous committed 4523fb6

Backport all known 2.5-compatibility fixes

Comments (0)

Files changed (9)

 2.4, you can use the ``easy_install-2.3`` or ``easy_install-2.4`` scripts to
 install packages for Python 2.3 or 2.4, respectively.
 
+Also, if you're working with Python version 2.4 or higher, you can run Python
+with ``-m easy_install`` to run that particular Python version's
+``easy_install`` command.
+
 
 Restricting Downloads with ``--allow-hosts``
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Release Notes/Change History
 ============================
 
+0.6c3
+ * You once again use "python -m easy_install" with Python 2.4 and above.
+
+ * Python 2.5 compatibility fixes added.
+
 0.6c2
  * Windows script wrappers now support quoted arguments and arguments
    containing spaces.  (Patch contributed by Jim Fulton.)
 
     >>> ws.add(foo12)   # this will conflict with Foo 1.4
     >>> ws.find_plugins(plugins)
-    ([JustATest 0.99, Foo 1.2 (f12)], {Foo 1.4 (f14): <...VersionConflict...>})
+    ([JustATest 0.99, Foo 1.2 (f12)], {Foo 1.4 (f14): VersionConflict(...)})
 
 But if you disallow fallbacks, the failed plugin will be skipped instead of
 trying older versions::
 
     >>> ws.find_plugins(plugins, fallback=False)
-    ([JustATest 0.99], {Foo 1.4 (f14): <...VersionConflict...>})
+    ([JustATest 0.99], {Foo 1.4 (f14): VersionConflict(...)})
 
 
 
-#!python
-"""\
-This script/module exists for backward compatibility only!  It will go away
-entirely in 0.7.  Please start using the 'easy_install' script or .exe instead
-of using 'python -m easy_install' or running 'easy_install.py' directly.
-"""
+"""Run the EasyInstall command"""
 
 if __name__ == '__main__':
-    import sys
-    print >>sys.stderr, \
-        "Please use the 'easy_install' script or executable instead."
-    print >>sys.stderr, \
-        "(i.e., don't include the '.py' extension and don't use 'python -m')"
-    sys.exit(2)
-
+    from setuptools.command.easy_install import main
+    main()
     # Exceptions
     'ResolutionError','VersionConflict','DistributionNotFound','UnknownExtra',
     'ExtractionError',
-    
+
     # Parsing functions and string utilities
     'parse_requirements', 'parse_version', 'safe_name', 'safe_version',
     'get_platform', 'compatible_platforms', 'yield_lines', 'split_sections',
 ]
 class ResolutionError(Exception):
     """Abstract base for dependency resolution errors"""
+    def __repr__(self): return self.__class__.__name__+repr(self.args)
 
 class VersionConflict(ResolutionError):
     """An already-installed version conflicts with the requested version"""
 
 class UnknownExtra(ResolutionError):
     """Distribution doesn't have an "extra feature" of the given name"""
-
 _provider_factories = {}
 PY_MAJOR = sys.version[:3]
 EGG_DIST    = 3
 
         old_exc = sys.exc_info()[1]
         cache_path = self.extraction_path or get_default_cache()
-        
+
         err = ExtractionError("""Can't extract file(s) to egg cache
 
 The following error occurred while trying to extract file(s) to the Python egg
             ensure_directory(target_path)
         except:
             self.extraction_error()
-           
+
         self.cached_files[target_path] = 1
         return target_path
 
 
             try:
                 rename(tmpnam, real_path)
-                
-            except os.error:               
+
+            except os.error:
                 if os.path.isfile(real_path):
                     stat = os.stat(real_path)
-                    
+
                     if stat.st_size==size and stat.st_mtime==timestamp:
                         # size and stamp match, somebody did it just ahead of
                         # us, so we're done
 from setuptools import setup, find_packages
 import sys
 scripts = []
-if sys.platform != "win32":
-    scripts = ["easy_install.py"]   # for backward compatibility only
 
 setup(
     name="setuptools",
     keywords = "CPAN PyPI distutils eggs package management",
     url = "http://peak.telecommunity.com/DevCenter/setuptools",
     test_suite = 'setuptools.tests',
-    
     packages = find_packages(),
     package_data = {'setuptools':['*.exe']},
 
     py_modules = ['pkg_resources', 'easy_install', 'site'],
 
-    zip_safe = False,   # We want 'python -m easy_install' to work, for now :(
+    zip_safe = (sys.version>="2.5"),   # <2.5 needs unzipped for -m to work
 
     entry_points = {
 
             "dependency_links.txt = setuptools.command.egg_info:overwrite_arg",
         ],
 
+
+
+
         "console_scripts": [
              "easy_install = setuptools.command.easy_install:main",
              "easy_install-%s = setuptools.command.easy_install:main"
                 % sys.version[:3]
             ],
-            
+
         "setuptools.file_finders":
             ["svn_cvs = setuptools.command.sdist:_default_revctrl"]
         },

setuptools/command/__init__.py

     'register',
 ]
 
+import sys
+if sys.version>='2.5':
+    # In Python 2.5 and above, distutils includes its own upload command
+    __all__.remove('upload')
 
 from distutils.command.bdist import bdist
 
     bdist.format_command['egg'] = ('bdist_egg', "Python .egg file")
     bdist.format_commands.append('egg')
 
-del bdist
+del bdist, sys

setuptools/command/easy_install.py

     with_ei_usage(lambda:
         setup(
             script_args = ['-q','easy_install', '-v']+argv,
+            script_name = sys.argv[0] or 'easy_install',
             distclass=DistributionWithoutHelpCommands, **kw
         )
     )
 
 
 
-

setuptools/dist.py

-__all__ = ['Distribution', 'Feature']
+__all__ = ['Distribution']
 
 from distutils.core import Distribution as _Distribution
 from setuptools.depends import Require
         have_package_data = hasattr(self, "package_data")
         if not have_package_data:
             self.package_data = {}
-        self.requires = []  # XXX
+        self.require_features = []
         self.features = {}
         self.dist_files = []
         self.patch_missing_pkg_info(attrs)
          based on 'availabile', 'standard', and whether any other feature
          requires it.  The default setting is 'True'.
 
-      'requires' -- a string or sequence of strings naming features that should
-         also be included if this feature is included.  Defaults to empty list.
-         May also contain 'Require' objects that should be added/removed from
-         the distribution.
+      'require_features' -- a string or sequence of strings naming features
+         that should also be included if this feature is included.  Defaults to
+         empty list.  May also contain 'Require' objects that should be
+         added/removed from the distribution.
 
       'remove' -- a string or list of strings naming packages to be removed
          from the distribution if this feature is *not* included.  If the
     Aside from the methods, the only feature attributes that distributions look
     at are 'description' and 'optional'.
     """
-
     def __init__(self, description, standard=False, available=True,
-        optional=True, requires=(), remove=(), **extras
+        optional=True, require_features=(), remove=(), **extras
     ):
 
         self.description = description
         self.standard = standard
         self.available = available
         self.optional = optional
-        if isinstance(requires,(str,Require)):
-            requires = requires,
+        if isinstance(require_features,(str,Require)):
+            require_features = require_features,
 
-        self.requires = [r for r in requires if isinstance(r,str)]
-        er = [r for r in requires if not isinstance(r,str)]
-        if er: extras['requires'] = er
+        self.require_features = [
+            r for r in require_features if isinstance(r,str)
+        ]
+        er = [r for r in require_features if not isinstance(r,str)]
+        if er: extras['require_features'] = er
 
         if isinstance(remove,str):
             remove = remove,
         self.remove = remove
         self.extras = extras
 
-        if not remove and not requires and not extras:
+        if not remove and not require_features and not extras:
             raise DistutilsSetupError(
-                "Feature %s: must define 'requires', 'remove', or at least one"
+                "Feature %s: must define 'require_features', 'remove', or at least one"
                 " of 'packages', 'py_modules', etc."
             )
 
-
     def include_by_default(self):
         """Should this feature be included by default?"""
         return self.available and self.standard
 
         dist.include(**self.extras)
 
-        for f in self.requires:
+        for f in self.require_features:
             dist.include_feature(f)
 
 

setuptools/tests/__init__.py

         self.req = Require('Distutils','1.0.3','distutils')
         self.dist = makeSetup(
             features={
-                'foo': Feature("foo",standard=True,requires=['baz',self.req]),
+                'foo': Feature("foo",standard=True,require_features=['baz',self.req]),
                 'bar': Feature("bar",  standard=True, packages=['pkg.bar'],
                                py_modules=['bar_et'], remove=['bar.ext'],
                        ),
         self.failUnless(
             Feature("test",standard=True,remove='x').include_by_default()
         )
-        # Feature must have either kwargs, removes, or requires
+        # Feature must have either kwargs, removes, or require_features
         self.assertRaises(DistutilsSetupError, Feature, "test")
 
     def testAvailability(self):
         self.failUnless('scripts/baz_it' in dist.scripts)
         self.failUnless(('libfoo','foo/foofoo.c') in dist.libraries)
         self.assertEqual(dist.ext_modules,[])
-        self.assertEqual(dist.requires, [self.req])
+        self.assertEqual(dist.require_features, [self.req])
 
         # If we ask for bar, it should fail because we explicitly disabled
         # it on the command line
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.