aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>2010-03-16 20:02:39 +0100
committerRonny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>2010-03-16 20:02:39 +0100
commit69da648099044a98f094b746c4d0295baf843ea2 (patch)
tree2ec89c3ef7aea39affe42c0737057b6d49fef4e8
parent0b3d2302b8b209c7bed8bdad6e1a6cff34889779 (diff)
parentff3ee4aa6c6800d813162c09a58c6265c4675701 (diff)
downloadexternal_python_setuptools-69da648099044a98f094b746c4d0295baf843ea2.tar.gz
external_python_setuptools-69da648099044a98f094b746c4d0295baf843ea2.tar.bz2
external_python_setuptools-69da648099044a98f094b746c4d0295baf843ea2.zip
merge with upstream
--HG-- branch : distribute extra : rebase_source : 2ad13527b742644596b32fcd8feac7276b4a477e
-rw-r--r--CHANGES.txt3
-rw-r--r--CONTRIBUTORS.txt1
-rwxr-xr-xREADME.txt18
-rw-r--r--docs/easy_install.txt5
-rwxr-xr-xsetup.py4
-rw-r--r--setuptools/__init__.py3
-rwxr-xr-xsetuptools/command/easy_install.py22
-rwxr-xr-xsetuptools/sandbox.py14
-rw-r--r--setuptools/tests/test_easy_install.py26
-rw-r--r--setuptools/tests/test_sandbox.py47
10 files changed, 112 insertions, 31 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index b16ad40f..803045b6 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -10,6 +10,9 @@ CHANGES
* Issue 15 and 48: Introduced a socket timeout of 15 seconds on url openings
* Added indexsidebar.html into MANIFEST.in
* Issue 108: Fixed TypeError with Python3.1
+* Issue 121: Fixed --help install command trying to actually install.
+* Issue 112: Added an os.makedirs so that Tarek's solution will work.
+* Issue 133: Added --no-find-links to easy_install
------
0.6.10
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index bc2b3fe7..da9e0219 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -10,6 +10,7 @@ Contributors
* Jannis Leidel
* Lennart Regebro
* Martin von Löwis
+* Noufal Ibrahim
* Philip Jenvey
* Reinout van Rees
* Tarek Ziadé
diff --git a/README.txt b/README.txt
index 8e78bc88..bd084770 100755
--- a/README.txt
+++ b/README.txt
@@ -68,9 +68,8 @@ Installation Instructions
Distribute is only released as a source distribution.
-It can be installed using easy_install or pip, and can be done so with the source
-tarball, the eggs distribution, or by using the ``distribute_setup.py`` script
-provided online.
+It can be installed using pip, and can be done so with the source tarball,
+or by using the ``distribute_setup.py`` script provided online.
``distribute_setup.py`` is the simplest and preferred way on all systems.
@@ -88,20 +87,13 @@ If your shell has the ``curl`` program you can do::
Notice this file is also provided in the source release.
-easy_install or pip
-===================
+pip
+===
Run easy_install or pip::
- $ easy_install -U distribute
$ pip install distribute
-If you want to install the latest dev version, you can also run::
-
- $ easy_install -U distribute==dev
-
-This will get the latest development version at: http://bitbucket.org/tarek/distribute/get/0.6-maintenance.zip#egg=distribute-dev
-
Source installation
===================
@@ -128,8 +120,6 @@ Distribute is installed in three steps:
Distribute can be removed like this:
-- run ``easy_install -m Distribute``. This will remove the Distribute reference
- from ``easy-install.pth``. Otherwise, edit the file and remove it yourself.
- remove the ``distribute*.egg`` file located in your site-packages directory
- remove the ``setuptools.pth`` file located in you site-packages directory
- remove the easy_install script located in you ``sys.prefix/bin`` directory
diff --git a/docs/easy_install.txt b/docs/easy_install.txt
index 3e39b811..a469bb55 100644
--- a/docs/easy_install.txt
+++ b/docs/easy_install.txt
@@ -768,6 +768,11 @@ Command-Line Options
package not being available locally, or due to the use of the ``--update``
or ``-U`` option.
+``--no-find-links`` Blocks the addition of any link. (New in Distribute 0.6.11)
+ This is useful if you want to avoid adding links defined in a project
+ easy_install is installing (wether it's a requested project or a
+ dependency.). When used, ``--find-links`` is ignored.
+
``--delete-conflicting, -D`` (Removed in 0.6a11)
(As of 0.6a11, this option is no longer necessary; please do not use it!)
diff --git a/setup.py b/setup.py
index b8612b5c..064c2afd 100755
--- a/setup.py
+++ b/setup.py
@@ -82,7 +82,9 @@ def _being_installed():
# Installed by buildout, don't mess with a global setuptools.
return False
# easy_install marker
- return 'install' in sys.argv[1:] or _easy_install_marker()
+ if "--help" in sys.argv[1:] or "-h" in sys.argv[1:]: # Don't bother doing anything if they're just asking for help
+ return False
+ return 'install' in sys.argv[1:] or _easy_install_marker()
if _being_installed():
from distribute_setup import _before_install
diff --git a/setuptools/__init__.py b/setuptools/__init__.py
index d03d0bf0..c8a631a0 100644
--- a/setuptools/__init__.py
+++ b/setuptools/__init__.py
@@ -19,7 +19,8 @@ __all__ = [
# a distribution with the same version.
#
# The distribute_setup script for instance, will check if this
-# attribute is present to decide wether to reinstall the package
+# attribute is present to decide whether to reinstall the package
+# or not.
_distribute = True
bootstrap_install_from = None
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 134f1b80..5d29550d 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -7,7 +7,8 @@ A tool for doing automatic download/extract/build of distutils-based Python
packages. For detailed documentation, see the accompanying EasyInstall.txt
file, or visit the `EasyInstall home page`__.
-__ http://peak.telecommunity.com/DevCenter/EasyInstall
+__ http://packages.python.org/distribute/easy_install.html
+
"""
import sys, os.path, zipimport, shutil, tempfile, zipfile, re, stat, random
from glob import glob
@@ -102,6 +103,8 @@ class easy_install(Command):
('allow-hosts=', 'H', "pattern(s) that hostnames must match"),
('local-snapshots-ok', 'l', "allow building eggs from local checkouts"),
('version', None, "print version information and exit"),
+ ('no-find-links', None,
+ "Don't load find-links defined in packages being installed")
]
boolean_options = [
'zip-ok', 'multi-version', 'exclude-scripts', 'upgrade', 'always-copy',
@@ -141,6 +144,7 @@ class easy_install(Command):
self.install_platbase = None
self.install_userbase = site.USER_BASE
self.install_usersite = site.USER_SITE
+ self.no_find_links = None
# Options not specifiable via command line
self.package_index = None
@@ -217,6 +221,9 @@ class easy_install(Command):
if self.script_dir is None:
self.script_dir = self.install_dir
+ if self.no_find_links is None:
+ self.no_find_links = False
+
# Let install_dir get set by install_lib command, which in turn
# gets its info from the install command, and takes into account
# --prefix and --home and all that other crud.
@@ -272,7 +279,8 @@ class easy_install(Command):
self.find_links = []
if self.local_snapshots_ok:
self.package_index.scan_egg_links(self.shadow_path+sys.path)
- self.package_index.add_find_links(self.find_links)
+ if not self.no_find_links:
+ self.package_index.add_find_links(self.find_links)
self.set_undefined_options('install_lib', ('optimize','optimize'))
if not isinstance(self.optimize,int):
try:
@@ -318,7 +326,7 @@ class easy_install(Command):
'install_scripts', 'install_data',])
def run(self):
- if self.verbose<>self.distribution.verbose:
+ if self.verbose != self.distribution.verbose:
log.set_verbosity(self.verbose)
try:
for spec in self.args:
@@ -432,7 +440,7 @@ variable.
For information on other options, you may wish to consult the
documentation at:
- http://peak.telecommunity.com/EasyInstall.html
+ http://packages.python.org/distribute/easy_install.html
Please make the appropriate changes for your system and try again.
"""
@@ -450,6 +458,7 @@ Please make the appropriate changes for your system and try again.
ok_exists = os.path.exists(ok_file)
try:
if ok_exists: os.unlink(ok_file)
+ os.makedirs(os.path.dirname(ok_file))
f = open(pth_file,'w')
except (OSError,IOError):
self.cant_write_to_target()
@@ -621,7 +630,8 @@ Please make the appropriate changes for your system and try again.
self.install_egg_scripts(dist)
self.installed_projects[dist.key] = dist
log.info(self.installation_report(requirement, dist, *info))
- if dist.has_metadata('dependency_links.txt'):
+ if (dist.has_metadata('dependency_links.txt') and
+ not self.no_find_links):
self.package_index.add_find_links(
dist.get_metadata_lines('dependency_links.txt')
)
@@ -1174,7 +1184,7 @@ Here are some of your options for correcting the problem:
* You can set up the installation directory to support ".pth" files by
using one of the approaches described here:
- http://peak.telecommunity.com/EasyInstall.html#custom-installation-locations
+ http://packages.python.org/distribute/easy_install.html#custom-installation-locations
Please make the appropriate changes for your system and try again.""" % (
self.install_dir, os.environ.get('PYTHONPATH','')
diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index 502598ca..630d5792 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -154,6 +154,12 @@ class AbstractSandbox:
_EXCEPTIONS = [os.devnull,]
+try:
+ gen_py = os.path.dirname(__import__('win32com.gen_py', fromlist=['__name__']).__file__)
+ _EXCEPTIONS.append(gen_py)
+except ImportError:
+ pass
+
class DirectorySandbox(AbstractSandbox):
"""Restrict operations to a single subdirectory - pseudo-chroot"""
@@ -165,7 +171,7 @@ class DirectorySandbox(AbstractSandbox):
def __init__(self, sandbox, exceptions=_EXCEPTIONS):
self._sandbox = os.path.normcase(os.path.realpath(sandbox))
self._prefix = os.path.join(self._sandbox,'')
- self._exceptions = exceptions
+ self._exceptions = [os.path.normcase(os.path.realpath(path)) for path in exceptions]
AbstractSandbox.__init__(self)
def _violation(self, operation, *args, **kw):
@@ -190,12 +196,16 @@ class DirectorySandbox(AbstractSandbox):
try:
self._active = False
realpath = os.path.normcase(os.path.realpath(path))
- if (realpath in self._exceptions or realpath == self._sandbox
+ if (self._exempted(realpath) or realpath == self._sandbox
or realpath.startswith(self._prefix)):
return True
finally:
self._active = active
+ def _exempted(self, filepath):
+ exception_matches = map(filepath.startswith, self._exceptions)
+ return any(exception_matches)
+
def _remap_input(self,operation,path,*args,**kw):
"""Called for path inputs"""
if operation in self.write_ops and not self._ok(path):
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 071ba513..f2655d75 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -95,6 +95,31 @@ class TestEasyInstallTest(unittest.TestCase):
os.chdir(old_wd)
shutil.rmtree(dir)
+ def test_no_find_links(self):
+ # new option '--no-find-links', that blocks find-links added at
+ # the project level
+ dist = Distribution()
+ cmd = easy_install(dist)
+ cmd.check_pth_processing = lambda : True
+ cmd.no_find_links = True
+ cmd.find_links = ['link1', 'link2']
+ cmd.install_dir = os.path.join(tempfile.mkdtemp(), 'ok')
+ cmd.args = ['ok']
+ cmd.ensure_finalized()
+ self.assertEquals(cmd.package_index.scanned_urls, {})
+
+ # let's try without it (default behavior)
+ cmd = easy_install(dist)
+ cmd.check_pth_processing = lambda : True
+ cmd.find_links = ['link1', 'link2']
+ cmd.install_dir = os.path.join(tempfile.mkdtemp(), 'ok')
+ cmd.args = ['ok']
+ cmd.ensure_finalized()
+ keys = cmd.package_index.scanned_urls.keys()
+ keys.sort()
+ self.assertEquals(keys, ['link1', 'link2'])
+
+
class TestPTHFileWriter(unittest.TestCase):
def test_add_from_cwd_site_sets_dirty(self):
'''a pth file manager should set dirty
@@ -112,7 +137,6 @@ class TestPTHFileWriter(unittest.TestCase):
self.assertFalse(pth.dirty)
-
class TestUserInstallTest(unittest.TestCase):
def setUp(self):
diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py
index 1b0dc4ea..8b9e08e6 100644
--- a/setuptools/tests/test_sandbox.py
+++ b/setuptools/tests/test_sandbox.py
@@ -6,7 +6,20 @@ import shutil
import unittest
import tempfile
-from setuptools.sandbox import DirectorySandbox
+from setuptools.sandbox import DirectorySandbox, SandboxViolation
+
+def has_win32com():
+ """
+ Run this to determine if the local machine has win32com, and if it
+ does, include additional tests.
+ """
+ if not sys.platform.startswith('win32'):
+ return False
+ try:
+ mod = __import__('win32com')
+ except ImportError:
+ return False
+ return True
class TestSandbox(unittest.TestCase):
@@ -18,11 +31,33 @@ class TestSandbox(unittest.TestCase):
def test_devnull(self):
sandbox = DirectorySandbox(self.dir)
+ sandbox.run(self._file_writer(os.devnull))
- def _write():
- f = open(os.devnull, 'w')
+ @staticmethod
+ def _file_writer(path):
+ def do_write():
+ f = open(path, 'w')
f.write('xxx')
f.close()
-
- sandbox.run(_write)
-
+ return do_write
+
+
+ if has_win32com():
+ def test_win32com(self):
+ """
+ win32com should not be prevented from caching COM interfaces
+ in gen_py.
+ """
+ import win32com
+ gen_py = win32com.__gen_path__
+ target = os.path.join(gen_py, 'test_write')
+ sandbox = DirectorySandbox(self.dir)
+ try:
+ sandbox.run(self._file_writer(target))
+ except SandboxViolation:
+ self.fail("Could not create gen_py file due to SandboxViolation")
+ finally:
+ if os.path.exists(target): os.remove(target)
+
+if __name__ == '__main__':
+ unittest.main()