Commit 3bf8c4fa authored by PJ Eby's avatar PJ Eby

Backport all known 2.5-compatibility fixes

--HG--
branch : setuptools-0.6
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4051935
parent 7e0489e5
......@@ -331,6 +331,10 @@ used to install it. Thus, if you install EasyInstall for both Python 2.3 and
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 @@ displayed MD5 info (broken onto two lines for readability)::
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.)
......
......@@ -274,13 +274,13 @@ exception instance for each unloadable plugin::
>>> 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()
......@@ -82,6 +82,7 @@ __all__ = [
]
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 DistributionNotFound(ResolutionError):
class UnknownExtra(ResolutionError):
"""Distribution doesn't have an "extra feature" of the given name"""
_provider_factories = {}
PY_MAJOR = sys.version[:3]
EGG_DIST = 3
......
......@@ -23,8 +23,6 @@ VERSION = "0.6c3"
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 @@ setup(
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,6 +77,9 @@ setup(
"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"
......
......@@ -5,6 +5,10 @@ __all__ = [
'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 @@ if 'egg' not in bdist.format_commands:
bdist.format_command['egg'] = ('bdist_egg', "Python .egg file")
bdist.format_commands.append('egg')
del bdist
del bdist, sys
......@@ -1588,6 +1588,7 @@ usage: %(script)s [options] requirement_or_url ...
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 @@ usage: %(script)s [options] requirement_or_url ...
__all__ = ['Distribution', 'Feature']
__all__ = ['Distribution']
from distutils.core import Distribution as _Distribution
from setuptools.depends import Require
......@@ -207,7 +207,7 @@ class Distribution(_Distribution):
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 @@ class Feature:
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 @@ class Feature:
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 @@ class Feature:
dist.include(**self.extras)
for f in self.requires:
for f in self.require_features:
dist.include_feature(f)
......
......@@ -255,7 +255,7 @@ class FeatureTests(TestCase):
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 @@ class FeatureTests(TestCase):
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 @@ class FeatureTests(TestCase):
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment