[Python-checkins] r51935 - in sandbox/branches/setuptools-0.6: EasyInstall.txt api_tests.txt easy_install.py pkg_resources.py setup.py setuptools/command/__init__.py setuptools/command/easy_install.py setuptools/dist.py setuptools/tests/__init__.py
phillip.eby
python-checkins at python.org
Wed Sep 20 22:48:21 CEST 2006
Author: phillip.eby
Date: Wed Sep 20 22:48:18 2006
New Revision: 51935
Modified:
sandbox/branches/setuptools-0.6/EasyInstall.txt
sandbox/branches/setuptools-0.6/api_tests.txt
sandbox/branches/setuptools-0.6/easy_install.py
sandbox/branches/setuptools-0.6/pkg_resources.py
sandbox/branches/setuptools-0.6/setup.py
sandbox/branches/setuptools-0.6/setuptools/command/__init__.py
sandbox/branches/setuptools-0.6/setuptools/command/easy_install.py
sandbox/branches/setuptools-0.6/setuptools/dist.py
sandbox/branches/setuptools-0.6/setuptools/tests/__init__.py
Log:
Backport all known 2.5-compatibility fixes
Modified: sandbox/branches/setuptools-0.6/EasyInstall.txt
==============================================================================
--- sandbox/branches/setuptools-0.6/EasyInstall.txt (original)
+++ sandbox/branches/setuptools-0.6/EasyInstall.txt Wed Sep 20 22:48:18 2006
@@ -331,6 +331,10 @@
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``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1190,6 +1194,11 @@
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.)
Modified: sandbox/branches/setuptools-0.6/api_tests.txt
==============================================================================
--- sandbox/branches/setuptools-0.6/api_tests.txt (original)
+++ sandbox/branches/setuptools-0.6/api_tests.txt Wed Sep 20 22:48:18 2006
@@ -274,13 +274,13 @@
>>> 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(...)})
Modified: sandbox/branches/setuptools-0.6/easy_install.py
==============================================================================
--- sandbox/branches/setuptools-0.6/easy_install.py (original)
+++ sandbox/branches/setuptools-0.6/easy_install.py Wed Sep 20 22:48:18 2006
@@ -1,15 +1,5 @@
-#!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()
Modified: sandbox/branches/setuptools-0.6/pkg_resources.py
==============================================================================
--- sandbox/branches/setuptools-0.6/pkg_resources.py (original)
+++ sandbox/branches/setuptools-0.6/pkg_resources.py Wed Sep 20 22:48:18 2006
@@ -58,7 +58,7 @@
# 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',
@@ -82,6 +82,7 @@
]
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"""
@@ -91,7 +92,6 @@
class UnknownExtra(ResolutionError):
"""Distribution doesn't have an "extra feature" of the given name"""
-
_provider_factories = {}
PY_MAJOR = sys.version[:3]
EGG_DIST = 3
@@ -823,7 +823,7 @@
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
@@ -878,7 +878,7 @@
ensure_directory(target_path)
except:
self.extraction_error()
-
+
self.cached_files[target_path] = 1
return target_path
@@ -1264,11 +1264,11 @@
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
Modified: sandbox/branches/setuptools-0.6/setup.py
==============================================================================
--- sandbox/branches/setuptools-0.6/setup.py (original)
+++ sandbox/branches/setuptools-0.6/setup.py Wed Sep 20 22:48:18 2006
@@ -23,8 +23,6 @@
from setuptools import setup, find_packages
import sys
scripts = []
-if sys.platform != "win32":
- scripts = ["easy_install.py"] # for backward compatibility only
setup(
name="setuptools",
@@ -38,13 +36,12 @@
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 = {
@@ -80,12 +77,15 @@
"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"]
},
Modified: sandbox/branches/setuptools-0.6/setuptools/command/__init__.py
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools/command/__init__.py (original)
+++ sandbox/branches/setuptools-0.6/setuptools/command/__init__.py Wed Sep 20 22:48:18 2006
@@ -5,6 +5,10 @@
'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
@@ -12,4 +16,4 @@
bdist.format_command['egg'] = ('bdist_egg', "Python .egg file")
bdist.format_commands.append('egg')
-del bdist
+del bdist, sys
Modified: sandbox/branches/setuptools-0.6/setuptools/command/easy_install.py
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools/command/easy_install.py (original)
+++ sandbox/branches/setuptools-0.6/setuptools/command/easy_install.py Wed Sep 20 22:48:18 2006
@@ -1588,6 +1588,7 @@
with_ei_usage(lambda:
setup(
script_args = ['-q','easy_install', '-v']+argv,
+ script_name = sys.argv[0] or 'easy_install',
distclass=DistributionWithoutHelpCommands, **kw
)
)
@@ -1596,4 +1597,3 @@
-
Modified: sandbox/branches/setuptools-0.6/setuptools/dist.py
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools/dist.py (original)
+++ sandbox/branches/setuptools-0.6/setuptools/dist.py Wed Sep 20 22:48:18 2006
@@ -1,4 +1,4 @@
-__all__ = ['Distribution', 'Feature']
+__all__ = ['Distribution']
from distutils.core import Distribution as _Distribution
from setuptools.depends import Require
@@ -207,7 +207,7 @@
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)
@@ -676,10 +676,10 @@
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
@@ -704,34 +704,34 @@
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
@@ -754,7 +754,7 @@
dist.include(**self.extras)
- for f in self.requires:
+ for f in self.require_features:
dist.include_feature(f)
Modified: sandbox/branches/setuptools-0.6/setuptools/tests/__init__.py
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools/tests/__init__.py (original)
+++ sandbox/branches/setuptools-0.6/setuptools/tests/__init__.py Wed Sep 20 22:48:18 2006
@@ -255,7 +255,7 @@
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'],
),
@@ -281,7 +281,7 @@
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):
@@ -320,7 +320,7 @@
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
More information about the Python-checkins
mailing list