[Python-checkins] r60066 - in sandbox/branches/setuptools-0.6: setuptools.txt setuptools/command/develop.py setuptools/command/easy_install.py setuptools/command/install.py setuptools/command/test.py

phillip.eby python-checkins at python.org
Sat Jan 19 03:55:04 CET 2008


Author: phillip.eby
Date: Sat Jan 19 03:55:03 2008
New Revision: 60066

Modified:
   sandbox/branches/setuptools-0.6/setuptools.txt
   sandbox/branches/setuptools-0.6/setuptools/command/develop.py
   sandbox/branches/setuptools-0.6/setuptools/command/easy_install.py
   sandbox/branches/setuptools-0.6/setuptools/command/install.py
   sandbox/branches/setuptools-0.6/setuptools/command/test.py
Log:
Fix interactions between the various "require" options,
so that downloads aren't repeated and needed eggs are
always installed, even if they were downloaded to the
setup directory already.  (backport from trunk)


Modified: sandbox/branches/setuptools-0.6/setuptools.txt
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools.txt	(original)
+++ sandbox/branches/setuptools-0.6/setuptools.txt	Sat Jan 19 03:55:03 2008
@@ -2620,6 +2620,11 @@
 
  * Minor changes for Jython compatibility
 
+ * Fixed not installing eggs in ``install_requires`` if they were also used for
+   ``setup_requires`` or ``tests_require``.
+
+ * Fixed not fetching eggs in ``install_requires`` when running tests.
+
 0.6c7
  * Fixed ``distutils.filelist.findall()`` crashing on broken symlinks, and 
    ``egg_info`` command failing on new, uncommitted SVN directories.

Modified: sandbox/branches/setuptools-0.6/setuptools/command/develop.py
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools/command/develop.py	(original)
+++ sandbox/branches/setuptools-0.6/setuptools/command/develop.py	Sat Jan 19 03:55:03 2008
@@ -3,7 +3,7 @@
 from pkg_resources import Distribution, PathMetadata, normalize_path
 from distutils import log
 from distutils.errors import *
-import sys, os, setuptools
+import sys, os, setuptools, glob
 
 class develop(easy_install):
     """Set up package for development"""
@@ -32,7 +32,7 @@
         self.egg_path = None
         easy_install.initialize_options(self)
         self.setup_path = None
-
+        self.always_copy_from = '.'   # always copy eggs installed in curdir
 
 
 
@@ -48,9 +48,11 @@
             )
         self.args = [ei.egg_name]       
         easy_install.finalize_options(self)
+        # pick up setup-dir .egg files only: no .egg-info
+        self.package_index.scan(glob.glob('*.egg'))
+
         self.egg_link = os.path.join(self.install_dir, ei.egg_name+'.egg-link')
         self.egg_base = ei.egg_base
-
         if self.egg_path is None:
             self.egg_path = os.path.abspath(ei.egg_base)
 
@@ -60,7 +62,6 @@
                 "--egg-path must be a relative path from the install"
                 " directory to "+target
         )
-
         
         # Make a distribution for the package's source
         self.dist = Distribution(
@@ -79,7 +80,6 @@
                 "Can't get a consistent path to setup script from"
                 " installation directory", p, normalize_path(os.curdir))
 
-
     def install_for_development(self):
         # Ensure metadata is up-to-date
         self.run_command('egg_info')

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	Sat Jan 19 03:55:03 2008
@@ -94,7 +94,7 @@
 
         # Options not specifiable via command line
         self.package_index = None
-        self.pth_file = None
+        self.pth_file = self.always_copy_from = None
         self.delete_conflicting = None
         self.ignore_conflicts_at_my_risk = None
         self.site_dirs = None
@@ -455,6 +455,11 @@
         install_needed = install_needed or self.always_copy
         install_needed = install_needed or os.path.dirname(download) == tmpdir
         install_needed = install_needed or not download.endswith('.egg')
+        install_needed = install_needed or (
+            self.always_copy_from is not None and
+            os.path.dirname(normalize_path(download)) ==
+            normalize_path(self.always_copy_from)
+        )
 
         if spec and not install_needed:
             # at this point, we know it's a local .egg, we just don't know if
@@ -485,11 +490,6 @@
 
 
 
-
-
-
-
-
     def process_distribution(self, requirement, dist, deps=True, *info):
         self.update_pth(dist)
         self.package_index.add(dist)
@@ -527,7 +527,7 @@
                 "Installed distribution %s conflicts with requirement %s"
                 % e.args
             )
-        if self.always_copy:
+        if self.always_copy or self.always_copy_from:
             # Force all the relevant distros to be copied or activated
             for dist in distros:
                 if dist.key not in self.installed_projects:

Modified: sandbox/branches/setuptools-0.6/setuptools/command/install.py
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools/command/install.py	(original)
+++ sandbox/branches/setuptools-0.6/setuptools/command/install.py	Sat Jan 19 03:55:03 2008
@@ -1,4 +1,4 @@
-import setuptools, sys
+import setuptools, sys, glob
 from distutils.command.install import install as _install
 from distutils.errors import DistutilsArgError
 
@@ -88,6 +88,10 @@
             self.distribution, args="x", root=self.root, record=self.record,
         )
         cmd.ensure_finalized()  # finalize before bdist_egg munges install cmd
+        cmd.always_copy_from = '.'  # make sure local-dir eggs get installed
+
+        # pick up setup-dir .egg files only: no .egg-info
+        cmd.package_index.scan(glob.glob('*.egg'))
 
         self.run_command('bdist_egg')
         args = [self.distribution.get_command_obj('bdist_egg').egg_output]
@@ -116,8 +120,4 @@
 
 
 
-
-
-
-
 #

Modified: sandbox/branches/setuptools-0.6/setuptools/command/test.py
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools/command/test.py	(original)
+++ sandbox/branches/setuptools-0.6/setuptools/command/test.py	Sat Jan 19 03:55:03 2008
@@ -107,6 +107,8 @@
 
 
     def run(self):
+        if self.distribution.install_requires:
+            self.distribution.fetch_build_eggs(self.distribution.install_requires)
         if self.distribution.tests_require:
             self.distribution.fetch_build_eggs(self.distribution.tests_require)
 
@@ -119,8 +121,6 @@
                 self.with_project_on_sys_path(self.run_tests)
 
 
-
-
     def run_tests(self):
         import unittest
         loader_ep = EntryPoint.parse("x="+self.test_loader)


More information about the Python-checkins mailing list