aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2012-04-07 13:54:55 -0400
committerJason R. Coombs <jaraco@jaraco.com>2012-04-07 13:54:55 -0400
commitb69e447ae3f241994882f08c91e905fbdd2b619f (patch)
treea5e629fd1d33d332a6d4ff200926f3c3f9f97fb1
parent6f830000f642af576434c52c7d229584ee0fdbd1 (diff)
parentcf4a89429a762473c9ec2fdad424a0f11076a5b4 (diff)
downloadexternal_python_setuptools-b69e447ae3f241994882f08c91e905fbdd2b619f.tar.gz
external_python_setuptools-b69e447ae3f241994882f08c91e905fbdd2b619f.tar.bz2
external_python_setuptools-b69e447ae3f241994882f08c91e905fbdd2b619f.zip
Merged fix for issue 227. All tests pass on Python 2.7.
--HG-- branch : distribute extra : rebase_source : f219d7fe842fb516c599ae0259748c90edeea2c5
-rw-r--r--CHANGES.txt3
-rwxr-xr-xsetuptools/command/easy_install.py28
2 files changed, 31 insertions, 0 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 3895b0a3..5e918760 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -7,6 +7,9 @@ CHANGES
------
* Issue #183: Symlinked files are now extracted from source distributions.
+* Issue #227: Easy_install fetch parameters are now passed during the
+ installation of a source distribution; now fulfillment of setup_requires
+ dependencies will honor the parameters passed to easy_install.
------
0.6.25
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index a51d88f5..dfd9f7ff 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -21,6 +21,7 @@ from distutils.sysconfig import get_python_lib, get_config_vars
from distutils.errors import DistutilsArgError, DistutilsOptionError, \
DistutilsError, DistutilsPlatformError
from distutils.command.install import INSTALL_SCHEMES, SCHEME_KEYS
+from setuptools.command import setopt
from setuptools.archive_util import unpack_archive
from setuptools.package_index import PackageIndex
from setuptools.package_index import URL_SCHEME
@@ -1082,11 +1083,14 @@ See the setuptools documentation for the "develop" command for more info.
def build_and_install(self, setup_script, setup_base):
args = ['bdist_egg', '--dist-dir']
+
dist_dir = tempfile.mkdtemp(
prefix='egg-dist-tmp-', dir=os.path.dirname(setup_script)
)
try:
+ self._set_fetcher_options(os.path.dirname(setup_script))
args.append(dist_dir)
+
self.run_setup(setup_script, setup_base, args)
all_eggs = Environment([dist_dir])
eggs = []
@@ -1101,6 +1105,30 @@ See the setuptools documentation for the "develop" command for more info.
rmtree(dist_dir)
log.set_verbosity(self.verbose) # restore our log verbosity
+ def _set_fetcher_options(self, base):
+ """
+ When easy_install is about to run bdist_egg on a source dist, that
+ source dist might have 'setup_requires' directives, requiring
+ additional fetching. Ensure the fetcher options given to easy_install
+ are available to that command as well.
+ """
+ # find the fetch options from easy_install and write them out
+ # to the setup.cfg file.
+ ei_opts = self.distribution.get_option_dict('easy_install').copy()
+ fetch_directives = (
+ 'find_links', 'site_dirs', 'index_url', 'optimize',
+ 'site_dirs', 'allow_hosts',
+ )
+ fetch_options = {}
+ for key, val in ei_opts.iteritems():
+ if key not in fetch_directives: continue
+ fetch_options[key.replace('_', '-')] = val[1]
+ # create a settings dictionary suitable for `edit_config`
+ settings = dict(easy_install=fetch_options)
+ cfg_filename = os.path.join(base, 'setup.cfg')
+ setopt.edit_config(cfg_filename, settings)
+
+
def update_pth(self,dist):
if self.pth_file is None:
return