Commit 60cf2d31 authored by PJ Eby's avatar PJ Eby

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)

--HG--
branch : setuptools-0.6
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4060066
parent 7c4938d5
...@@ -2620,6 +2620,11 @@ Release Notes/Change History ...@@ -2620,6 +2620,11 @@ Release Notes/Change History
* Minor changes for Jython compatibility * 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 0.6c7
* Fixed ``distutils.filelist.findall()`` crashing on broken symlinks, and * Fixed ``distutils.filelist.findall()`` crashing on broken symlinks, and
``egg_info`` command failing on new, uncommitted SVN directories. ``egg_info`` command failing on new, uncommitted SVN directories.
......
...@@ -3,7 +3,7 @@ from distutils.util import convert_path ...@@ -3,7 +3,7 @@ from distutils.util import convert_path
from pkg_resources import Distribution, PathMetadata, normalize_path from pkg_resources import Distribution, PathMetadata, normalize_path
from distutils import log from distutils import log
from distutils.errors import * from distutils.errors import *
import sys, os, setuptools import sys, os, setuptools, glob
class develop(easy_install): class develop(easy_install):
"""Set up package for development""" """Set up package for development"""
...@@ -32,7 +32,7 @@ class develop(easy_install): ...@@ -32,7 +32,7 @@ class develop(easy_install):
self.egg_path = None self.egg_path = None
easy_install.initialize_options(self) easy_install.initialize_options(self)
self.setup_path = None self.setup_path = None
self.always_copy_from = '.' # always copy eggs installed in curdir
...@@ -48,9 +48,11 @@ class develop(easy_install): ...@@ -48,9 +48,11 @@ class develop(easy_install):
) )
self.args = [ei.egg_name] self.args = [ei.egg_name]
easy_install.finalize_options(self) 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_link = os.path.join(self.install_dir, ei.egg_name+'.egg-link')
self.egg_base = ei.egg_base self.egg_base = ei.egg_base
if self.egg_path is None: if self.egg_path is None:
self.egg_path = os.path.abspath(ei.egg_base) self.egg_path = os.path.abspath(ei.egg_base)
...@@ -60,7 +62,6 @@ class develop(easy_install): ...@@ -60,7 +62,6 @@ class develop(easy_install):
"--egg-path must be a relative path from the install" "--egg-path must be a relative path from the install"
" directory to "+target " directory to "+target
) )
# Make a distribution for the package's source # Make a distribution for the package's source
self.dist = Distribution( self.dist = Distribution(
...@@ -79,7 +80,6 @@ class develop(easy_install): ...@@ -79,7 +80,6 @@ class develop(easy_install):
"Can't get a consistent path to setup script from" "Can't get a consistent path to setup script from"
" installation directory", p, normalize_path(os.curdir)) " installation directory", p, normalize_path(os.curdir))
def install_for_development(self): def install_for_development(self):
# Ensure metadata is up-to-date # Ensure metadata is up-to-date
self.run_command('egg_info') self.run_command('egg_info')
......
...@@ -94,7 +94,7 @@ class easy_install(Command): ...@@ -94,7 +94,7 @@ class easy_install(Command):
# Options not specifiable via command line # Options not specifiable via command line
self.package_index = None self.package_index = None
self.pth_file = None self.pth_file = self.always_copy_from = None
self.delete_conflicting = None self.delete_conflicting = None
self.ignore_conflicts_at_my_risk = None self.ignore_conflicts_at_my_risk = None
self.site_dirs = None self.site_dirs = None
...@@ -455,6 +455,11 @@ Please make the appropriate changes for your system and try again. ...@@ -455,6 +455,11 @@ Please make the appropriate changes for your system and try again.
install_needed = install_needed or self.always_copy install_needed = install_needed or self.always_copy
install_needed = install_needed or os.path.dirname(download) == tmpdir install_needed = install_needed or os.path.dirname(download) == tmpdir
install_needed = install_needed or not download.endswith('.egg') 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: if spec and not install_needed:
# at this point, we know it's a local .egg, we just don't know if # at this point, we know it's a local .egg, we just don't know if
...@@ -485,11 +490,6 @@ Please make the appropriate changes for your system and try again. ...@@ -485,11 +490,6 @@ Please make the appropriate changes for your system and try again.
def process_distribution(self, requirement, dist, deps=True, *info): def process_distribution(self, requirement, dist, deps=True, *info):
self.update_pth(dist) self.update_pth(dist)
self.package_index.add(dist) self.package_index.add(dist)
...@@ -527,7 +527,7 @@ Please make the appropriate changes for your system and try again. ...@@ -527,7 +527,7 @@ Please make the appropriate changes for your system and try again.
"Installed distribution %s conflicts with requirement %s" "Installed distribution %s conflicts with requirement %s"
% e.args % 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 # Force all the relevant distros to be copied or activated
for dist in distros: for dist in distros:
if dist.key not in self.installed_projects: if dist.key not in self.installed_projects:
......
import setuptools, sys import setuptools, sys, glob
from distutils.command.install import install as _install from distutils.command.install import install as _install
from distutils.errors import DistutilsArgError from distutils.errors import DistutilsArgError
...@@ -88,6 +88,10 @@ class install(_install): ...@@ -88,6 +88,10 @@ class install(_install):
self.distribution, args="x", root=self.root, record=self.record, self.distribution, args="x", root=self.root, record=self.record,
) )
cmd.ensure_finalized() # finalize before bdist_egg munges install cmd 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') self.run_command('bdist_egg')
args = [self.distribution.get_command_obj('bdist_egg').egg_output] args = [self.distribution.get_command_obj('bdist_egg').egg_output]
...@@ -115,9 +119,5 @@ class install(_install): ...@@ -115,9 +119,5 @@ class install(_install):
# #
...@@ -107,6 +107,8 @@ class test(Command): ...@@ -107,6 +107,8 @@ class test(Command):
def run(self): def run(self):
if self.distribution.install_requires:
self.distribution.fetch_build_eggs(self.distribution.install_requires)
if self.distribution.tests_require: if self.distribution.tests_require:
self.distribution.fetch_build_eggs(self.distribution.tests_require) self.distribution.fetch_build_eggs(self.distribution.tests_require)
...@@ -119,8 +121,6 @@ class test(Command): ...@@ -119,8 +121,6 @@ class test(Command):
self.with_project_on_sys_path(self.run_tests) self.with_project_on_sys_path(self.run_tests)
def run_tests(self): def run_tests(self):
import unittest import unittest
loader_ep = EntryPoint.parse("x="+self.test_loader) loader_ep = EntryPoint.parse("x="+self.test_loader)
......
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