[Checkins] SVN: zc.buildout/branches/2/ removed awareness of multiple Python interpreters, making code simpler to test and getting rid of some tests with errors
Thomas Lotze
tl at gocept.com
Thu May 19 02:04:18 EDT 2011
Log message for revision 121721:
removed awareness of multiple Python interpreters, making code simpler to test and getting rid of some tests with errors
Changed:
U zc.buildout/branches/2/src/zc/buildout/buildout.py
U zc.buildout/branches/2/src/zc/buildout/buildout.txt
U zc.buildout/branches/2/src/zc/buildout/easy_install.py
U zc.buildout/branches/2/src/zc/buildout/testing.py
U zc.buildout/branches/2/src/zc/buildout/tests.py
D zc.buildout/branches/2/src/zc/buildout/testselectingpython.py
U zc.buildout/branches/2/src/zc/buildout/virtualenv.txt
U zc.buildout/branches/2/z3c.recipe.scripts_/src/z3c/recipe/scripts/README.txt
U zc.buildout/branches/2/z3c.recipe.scripts_/src/z3c/recipe/scripts/tests.py
U zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/README.txt
U zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/api.txt
U zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/custom.py
U zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/custom.txt
U zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/egg.py
D zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt
U zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/tests.py
-=-
Modified: zc.buildout/branches/2/src/zc/buildout/buildout.py
===================================================================
--- zc.buildout/branches/2/src/zc/buildout/buildout.py 2011-05-18 21:06:44 UTC (rev 121720)
+++ zc.buildout/branches/2/src/zc/buildout/buildout.py 2011-05-19 06:04:17 UTC (rev 121721)
@@ -140,7 +140,6 @@
'offline': 'false',
'parts-directory': 'parts',
'prefer-final': 'false',
- 'python': 'buildout',
'relative-paths': 'false',
'socket-timeout': '',
'unzip': 'false',
Modified: zc.buildout/branches/2/src/zc/buildout/buildout.txt
===================================================================
--- zc.buildout/branches/2/src/zc/buildout/buildout.txt 2011-05-18 21:06:44 UTC (rev 121720)
+++ zc.buildout/branches/2/src/zc/buildout/buildout.txt 2011-05-19 06:04:17 UTC (rev 121721)
@@ -774,8 +774,6 @@
DEFAULT_VALUE
prefer-final= false
DEFAULT_VALUE
- python= buildout
- DEFAULT_VALUE
relative-paths= false
DEFAULT_VALUE
socket-timeout=
@@ -2250,7 +2248,6 @@
parts =
parts-directory = /sample-buildout/parts
prefer-final = false
- python = buildout
relative-paths = false
socket-timeout =
unzip = false
@@ -2323,8 +2320,7 @@
instance.
executable
- The Python executable used to run the buildout. See the python
- option below.
+ The Python executable used to run the buildout.
include-site-packages
You can choose not to have the site-packages of the underlying Python
@@ -2353,16 +2349,6 @@
parts-directory
A working directory that parts can used to store data.
-python
- The name of a section containing information about the default
- Python interpreter. Recipes that need a installation
- typically have options to tell them which Python installation to
- use. By convention, if a section-specific option isn't used, the
- option is looked for in the buildout section. The option must
- point to a section with an executable option giving the path to a
- Python executable. By default, the buildout section defines the
- default Python as the Python used to run the buildout.
-
relative-paths
The paths generated by zc.buildout are absolute by default, and this
option is ``false``. However, if you set this value to be ``true``,
Modified: zc.buildout/branches/2/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/branches/2/src/zc/buildout/easy_install.py 2011-05-18 21:06:44 UTC (rev 121720)
+++ zc.buildout/branches/2/src/zc/buildout/easy_install.py 2011-05-19 06:04:17 UTC (rev 121721)
@@ -157,43 +157,11 @@
site_paths = [p for p in no_user_paths if p not in stdlib]
return (stdlib, site_paths)
-def _get_version_info(executable):
- cmd = [executable, '-Sc',
- 'import sys; print(repr(tuple(x for x in sys.version_info)))']
- _proc = subprocess.Popen(
- cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- stdout, stderr = _proc.communicate();
- if _proc.returncode:
- raise RuntimeError(
- 'error trying to get system packages:\n%s' % (stderr,))
- return eval(stdout.strip())
-
class IncompatibleVersionError(zc.buildout.UserError):
"""A specified version is incompatible with a given requirement.
"""
-_versions = {sys.executable: '%d.%d' % sys.version_info[:2]}
-def _get_version(executable):
- try:
- return _versions[executable]
- except KeyError:
- cmd = _safe_arg(executable) + ' -V'
- p = subprocess.Popen(cmd,
- shell=True,
- stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT,
- close_fds=not is_win32)
- i, o = (p.stdin, p.stdout)
- i.close()
- version = o.read().strip().decode()
- o.close()
- pystring, version = version.split()
- assert pystring == 'Python', pystring
- version = re.match('(\d[.]\d)([.].*\d)?$', version).group(1)
- _versions[executable] = version
- return version
FILE_SCHEME = re.compile('file://', re.I).match
@@ -224,9 +192,7 @@
if index_url is None:
index_url = default_index_url
index = AllowHostsPackageIndex(
- index_url, hosts=allow_hosts, search_path=path,
- python=_get_version(executable)
- )
+ index_url, hosts=allow_hosts, search_path=path)
if find_links:
index.add_find_links(find_links)
@@ -380,16 +346,13 @@
self._easy_install_cmd = _easy_install_preface + _easy_install_cmd
self._easy_install_cmd = _safe_arg(self._easy_install_cmd)
stdlib, self._site_packages = _get_system_paths(executable)
- version_info = _get_version_info(executable)
- if version_info == sys.version_info:
- # Maybe we can add the buildout and setuptools path. If we
- # are including site_packages, we only have to include the extra
- # bits here, so we don't duplicate. On the other hand, if we
- # are not including site_packages, we only want to include the
- # parts that are not in site_packages, so the code is the same.
- path.extend(
- set(buildout_and_setuptools_path).difference(
- self._site_packages))
+ # Maybe we can add the buildout and setuptools path. If we
+ # are including site_packages, we only have to include the extra
+ # bits here, so we don't duplicate. On the other hand, if we
+ # are not including site_packages, we only want to include the
+ # parts that are not in site_packages, so the code is the same.
+ path.extend(
+ set(buildout_and_setuptools_path).difference(self._site_packages))
if self._include_site_packages:
path.extend(self._site_packages)
if dest is not None and dest not in path:
@@ -398,8 +361,7 @@
if self._dest is None:
newest = False
self._newest = newest
- self._env = pkg_resources.Environment(path,
- python=_get_version(executable))
+ self._env = pkg_resources.Environment(path)
self._index = _get_index(executable, index, links, self._allow_hosts,
self._path)
@@ -529,10 +491,7 @@
return best_we_have, None
def _load_dist(self, dist):
- dists = pkg_resources.Environment(
- dist.location,
- python=_get_version(self._executable),
- )[dist.project_name]
+ dists = pkg_resources.Environment(dist.location)[dist.project_name]
assert len(dists) == 1
return dists[0]
@@ -576,10 +535,7 @@
*args)
dists = []
- env = pkg_resources.Environment(
- [tmp],
- python=_get_version(self._executable),
- )
+ env = pkg_resources.Environment([tmp])
for project in env:
dists.extend(env[project])
@@ -623,10 +579,7 @@
os.remove(newloc)
os.rename(d.location, newloc)
- [d] = pkg_resources.Environment(
- [newloc],
- python=_get_version(self._executable),
- )[d.project_name]
+ [d] = pkg_resources.Environment([newloc])[d.project_name]
result.append(d)
@@ -791,9 +744,7 @@
# distribution meta data to be read. Cloning isn't
# good enough.
dists = pkg_resources.Environment(
- [newloc],
- python=_get_version(self._executable),
- )[dist.project_name]
+ [newloc])[dist.project_name]
else:
# It's some other kind of dist. We'll let easy_install
# deal with it:
Modified: zc.buildout/branches/2/src/zc/buildout/testing.py
===================================================================
--- zc.buildout/branches/2/src/zc/buildout/testing.py 2011-05-18 21:06:44 UTC (rev 121720)
+++ zc.buildout/branches/2/src/zc/buildout/testing.py 2011-05-19 06:04:17 UTC (rev 121721)
@@ -162,9 +162,7 @@
for arg in args]
args.insert(0, '-q')
env = dict(os.environ)
- if executable == sys.executable:
- env['PYTHONPATH'] = setuptools_location
- # else pass an executable that has setuptools! See testselectingpython.py.
+ env['PYTHONPATH'] = setuptools_location
args.append(env)
here = os.getcwd()
Modified: zc.buildout/branches/2/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/branches/2/src/zc/buildout/tests.py 2011-05-18 21:06:44 UTC (rev 121720)
+++ zc.buildout/branches/2/src/zc/buildout/tests.py 2011-05-19 06:04:17 UTC (rev 121721)
@@ -24,7 +24,6 @@
import unittest
import zc.buildout.easy_install
import zc.buildout.testing
-import zc.buildout.testselectingpython
import zipfile
os_path_sep = os.path.sep
@@ -402,14 +401,11 @@
... [buildout]
... parts = eggs
... prefer-final = true
+ ... executable = %(py_path)s
... find-links = %(link_server)s
...
- ... [primed_python]
- ... executable = %(py_path)s
- ...
... [eggs]
... recipe = zc.recipe.egg:eggs
- ... python = primed_python
... eggs = bigdemo
... ''' % globals())
@@ -555,55 +551,6 @@
"""
-def make_sure__get_version_works_with_2_digit_python_versions():
- """
-
-This is a test of an internal function used by higher-level machinery.
-
-We'll start by creating a faux 'python' that executable that prints a
-2-digit version. This is a bit of a pain to do portably. :(
-
- >>> mkdir('demo')
- >>> write('demo', 'setup.py',
- ... '''
- ... from setuptools import setup
- ... setup(name='demo',
- ... entry_points = {'console_scripts': ['demo = demo:main']},
- ... )
- ... ''')
- >>> write('demo', 'demo.py',
- ... '''
- ... def main():
- ... print('Python 2.5')
- ... ''')
-
- >>> write('buildout.cfg',
- ... '''
- ... [buildout]
- ... develop = demo
- ... parts =
- ... ''')
-
- >>> run(join('bin', 'buildout'))
- Develop: '/sample-buildout/demo'
-
- >>> import zc.buildout.easy_install
- >>> ws = zc.buildout.easy_install.working_set(
- ... ['demo'], sys.executable, ['develop-eggs'])
- >>> bool(zc.buildout.easy_install.scripts(
- ... ['demo'], ws, sys.executable, 'bin'))
- True
-
- >>> run(join('bin', 'demo'))
- Python 2.5
-
-Now, finally, let's test _get_version:
-
- >>> print(zc.buildout.easy_install._get_version(join('bin', 'demo')))
- 2.5
-
- """
-
def create_sections_on_command_line():
"""
>>> write('buildout.cfg',
@@ -1898,14 +1845,11 @@
... '''
... [buildout]
... parts = eggs
+ ... executable = %(py_path)s
... find-links = %(link_server)s
...
- ... [primed_python]
- ... executable = %(py_path)s
- ...
... [eggs]
... recipe = z3c.recipe.scripts
- ... python = primed_python
... interpreter = py
... include-site-packages = true
... eggs = tellmy.version == 1.0
@@ -2022,14 +1966,11 @@
... '''
... [buildout]
... parts = eggs
+ ... executable = %(py_path)s
... find-links = %(sample_eggs)s
...
- ... [primed_python]
- ... executable = %(py_path)s
- ...
... [eggs]
... recipe = zc.recipe.egg:eggs
- ... python = primed_python
... eggs = tellmy.version == 1.1
... ''' % globals())
@@ -4173,10 +4114,6 @@
),
]
-
- if zc.buildout.testing.script_in_shebang:
- test_suite.append(zc.buildout.testselectingpython.test_suite())
-
# adding bootstrap.txt doctest to the suite
# only if bootstrap.py is present
bootstrap_py = os.path.join(
Deleted: zc.buildout/branches/2/src/zc/buildout/testselectingpython.py
===================================================================
--- zc.buildout/branches/2/src/zc/buildout/testselectingpython.py 2011-05-18 21:06:44 UTC (rev 121720)
+++ zc.buildout/branches/2/src/zc/buildout/testselectingpython.py 2011-05-19 06:04:17 UTC (rev 121721)
@@ -1,99 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 Zope Foundation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-from zope.testing import renormalizing
-from zc.buildout.easy_install import setuptools_key
-
-import os, re, subprocess, sys, textwrap, unittest, doctest
-import zc.buildout.tests
-import zc.buildout.testing
-
-
-if sys.version_info[:2] == (2, 5):
- other_version = "2.6"
-else:
- other_version = "2.5"
-
-__test__ = dict(
- test_selecting_python_via_easy_install=
- """\
-
-We can specify a specific Python executable.
-
- >>> dest = tmpdir('sample-install')
- >>> ws = zc.buildout.easy_install.install(
- ... ['demo'], dest, links=[link_server],
- ... index='http://www.python.org/pypi/',
- ... always_unzip=True, executable=other_executable)
-
- >>> ls(dest)
- d demo-0.3-py%(other_version)s.egg
- d demoneeded-1.1-py%(other_version)s.egg
-
-""" % dict(other_version=other_version)
- )
-
-def multi_python(test):
- other_executable = zc.buildout.testing.find_python(other_version)
- command = textwrap.dedent('''\
- try:
- import setuptools
- except ImportError:
- import sys
- sys.exit(1)
- ''')
- env = dict(os.environ)
- env.pop('PYTHONPATH', None)
- if subprocess.call([other_executable, '-c', command], env=env):
- # the other executable does not have setuptools. Get setuptools.
- # We will do this using the same tools we are testing, for better or
- # worse. Alternatively, we could try using bootstrap.
- executable_dir = test.globs['tmpdir']('executable_dir')
- executable_parts = os.path.join(executable_dir, 'parts')
- test.globs['mkdir'](executable_parts)
- ws = zc.buildout.easy_install.install(
- [setuptools_key], executable_dir,
- index='http://www.python.org/pypi/',
- always_unzip=True, executable=other_executable)
- zc.buildout.easy_install.sitepackage_safe_scripts(
- executable_dir, ws, other_executable, executable_parts,
- reqs=[setuptools_key], interpreter='py')
- original_executable = other_executable
- other_executable = os.path.join(executable_dir, 'py')
- assert not subprocess.call(
- [other_executable, '-c', command], env=env), (
- 'test set up failed')
- sample_eggs = test.globs['tmpdir']('sample_eggs')
- os.mkdir(os.path.join(sample_eggs, 'index'))
- test.globs['sample_eggs'] = sample_eggs
- zc.buildout.tests.create_sample_eggs(test, executable=other_executable)
- test.globs['other_executable'] = other_executable
-
-
-def setup(test):
- zc.buildout.testing.buildoutSetUp(test)
- multi_python(test)
- zc.buildout.tests.add_source_dist(test)
- test.globs['link_server'] = test.globs['start_server'](
- test.globs['sample_eggs'])
-
-
-def test_suite():
- return doctest.DocTestSuite(
- setUp=setup,
- tearDown=zc.buildout.testing.buildoutTearDown,
- checker=renormalizing.RENormalizing([
- (re.compile('setuptools-\S+-py%s.egg' % other_version),
- 'setuptools-V-py%s.egg' % other_version),
- ]),
- )
Modified: zc.buildout/branches/2/src/zc/buildout/virtualenv.txt
===================================================================
--- zc.buildout/branches/2/src/zc/buildout/virtualenv.txt 2011-05-18 21:06:44 UTC (rev 121720)
+++ zc.buildout/branches/2/src/zc/buildout/virtualenv.txt 2011-05-19 06:04:17 UTC (rev 121721)
@@ -194,15 +194,12 @@
... '''
... [buildout]
... parts = eggs
+ ... executable = %(py_path)s
... find-links = %(link_server)s
... include-site-packages = false
...
- ... [primed_python]
- ... executable = %(py_path)s
- ...
... [eggs]
... recipe = z3c.recipe.scripts
- ... python = primed_python
... interpreter = py
... eggs = demo
... ''' % globals())
Modified: zc.buildout/branches/2/z3c.recipe.scripts_/src/z3c/recipe/scripts/README.txt
===================================================================
--- zc.buildout/branches/2/z3c.recipe.scripts_/src/z3c/recipe/scripts/README.txt 2011-05-18 21:06:44 UTC (rev 121720)
+++ zc.buildout/branches/2/z3c.recipe.scripts_/src/z3c/recipe/scripts/README.txt 2011-05-19 06:04:17 UTC (rev 121721)
@@ -20,7 +20,6 @@
* eggs
* find-links
* index
-* python
* extra-paths
* entry-points
* scripts
@@ -345,14 +344,11 @@
... [buildout]
... parts = eggs
... eggs-directory = tmpeggs
+ ... executable = %(py_path)s
... find-links =
...
- ... [primed_python]
- ... executable = %(py_path)s
- ...
... [eggs]
... recipe = z3c.recipe.scripts
- ... python = primed_python
... eggs = demoneeded
... ''' % globals())
@@ -373,14 +369,11 @@
... [buildout]
... parts = eggs
... eggs-directory = tmpeggs
+ ... executable = %(py_path)s
... find-links =
...
- ... [primed_python]
- ... executable = %(py_path)s
- ...
... [eggs]
... recipe = z3c.recipe.scripts
- ... python = primed_python
... allowed-eggs-from-site-packages =
... eggs = demoneeded
... ''' % globals())
@@ -412,14 +405,11 @@
... [buildout]
... parts = eggs
... eggs-directory = tmpeggs
+ ... executable = %(py_path)s
... find-links =
...
- ... [primed_python]
- ... executable = %(py_path)s
- ...
... [eggs]
... recipe = z3c.recipe.scripts
- ... python = primed_python
... eggs = demoneeded
... ''' % globals())
@@ -436,14 +426,11 @@
... parts = eggs
... eggs-directory = tmpeggs
... allowed-eggs-from-site-packages =
+ ... executable = %(py_path)s
... find-links =
...
- ... [primed_python]
- ... executable = %(py_path)s
- ...
... [eggs]
... recipe = z3c.recipe.scripts
- ... python = primed_python
... eggs = demoneeded
... ''' % globals())
>>> run(buildout)
Modified: zc.buildout/branches/2/z3c.recipe.scripts_/src/z3c/recipe/scripts/tests.py
===================================================================
--- zc.buildout/branches/2/z3c.recipe.scripts_/src/z3c/recipe/scripts/tests.py 2011-05-18 21:06:44 UTC (rev 121720)
+++ zc.buildout/branches/2/z3c.recipe.scripts_/src/z3c/recipe/scripts/tests.py 2011-05-19 06:04:17 UTC (rev 121721)
@@ -14,7 +14,6 @@
import os, re, shutil, sys
import zc.buildout.tests
-import zc.buildout.testselectingpython
import zc.buildout.testing
import unittest, doctest
@@ -23,55 +22,11 @@
# We do not explicitly test the recipe support for the ``eggs``,
# ``find-links``, and ``index`` options because they are used for most or
# all of the examples. The README tests ``extends``,
-# ``include-site-customization`` and ``name``. That leaves ``python``,
+# ``include-site-customization`` and ``name``. That leaves
# ``extra-paths``, ``initialization``, ``relative-paths``, and
# ``include-site-packages``.
-def supports_python_option():
- """
-This simply shows that the ``python`` option can specify another section to
-find the ``executable``. (The ``python`` option defaults to looking in the
-``buildout`` section.) We do this by creating a custom Python that will have
-some initialization that we can look for.
- >>> py_path, site_packages_path = make_py(initialization='''
- ... import os
- ... os.environ['zc.buildout'] = 'foo bar baz shazam'
- ... ''')
-
- >>> write(sample_buildout, 'buildout.cfg',
- ... '''
- ... [buildout]
- ... parts = py
- ...
- ... [custom_python]
- ... executable = %(py_path)s
- ...
- ... [py]
- ... recipe = z3c.recipe.scripts:interpreter
- ... exec-sitecustomize = true
- ... eggs = demo<0.3
- ... find-links = %(server)s
- ... index = %(server)s/index
- ... python = custom_python
- ... ''' % dict(server=link_server, py_path=py_path))
-
- >>> run(buildout)
- Installing py.
- Getting distribution for 'demo<0.3'.
- Got demo 0.2.
- Getting distribution for 'demoneeded'.
- Got demoneeded 1.2c1.
- Generated interpreter '/sample-buildout/bin/py'.
-
- >>> run(join(sample_buildout, 'bin', 'py') +
- ... ''' -c "import os; print(os.environ['zc.buildout'])"''')
- foo bar baz shazam
-"""
-
-if not zc.buildout.testing.script_in_shebang:
- del supports_python_option
-
def interpreter_recipe_supports_extra_paths_option():
"""
This shows that specifying extra-paths will affect sys.path.
@@ -156,8 +111,6 @@
... '''
... [buildout]
... parts = py
- ...
- ... [custom_python]
... executable = %(py_path)s
...
... [py]
@@ -169,7 +122,6 @@
... eggs = demo<0.3
... find-links = %(server)s
... index = %(server)s/index
- ... python = custom_python
... ''' % dict(server=link_server, py_path=py_path))
>>> run(buildout)
@@ -269,14 +221,11 @@
... '''
... [buildout]
... parts = eggs
+ ... executable = %(py_path)s
... find-links =
...
- ... [primed_python]
- ... executable = %(py_path)s
- ...
... [eggs]
... recipe = z3c.recipe.scripts
- ... python = primed_python
... include-site-packages = true
... eggs = demoneeded
... ''' % globals())
@@ -292,15 +241,12 @@
... '''
... [buildout]
... parts = eggs
+ ... executable = %(py_path)s
... find-links =
...
- ... [primed_python]
- ... executable = %(py_path)s
- ...
... [eggs]
... recipe = z3c.recipe.scripts
... include-site-packages = false
- ... python = primed_python
... eggs = demoneeded
... ''' % globals())
>>> run(buildout)
@@ -354,16 +300,13 @@
... '''
... [buildout]
... parts = eggs
+ ... executable = %(py_path)s
... find-links =
...
- ... [primed_python]
- ... executable = %(py_path)s
- ...
... [eggs]
... recipe = z3c.recipe.scripts
... include-site-packages = true
... allowed-eggs-from-site-packages = *
- ... python = primed_python
... eggs = demoneeded
... ''' % globals())
@@ -378,17 +321,14 @@
... '''
... [buildout]
... parts = eggs
+ ... executable = %(py_path)s
... find-links =
...
- ... [primed_python]
- ... executable = %(py_path)s
- ...
... [eggs]
... recipe = z3c.recipe.scripts
... include-site-packages = true
... allowed-eggs-from-site-packages = other
... demoneeded
- ... python = primed_python
... eggs = demoneeded
... ''' % globals())
@@ -413,11 +353,6 @@
zc.buildout.testing.install_develop('zc.recipe.egg', test)
zc.buildout.testing.install_develop('z3c.recipe.scripts', test)
-def setUpSelecting(test):
- zc.buildout.testselectingpython.setup(test)
- zc.buildout.testing.install_develop('zc.recipe.egg', test)
- zc.buildout.testing.install_develop('z3c.recipe.scripts', test)
-
def test_suite():
suite = unittest.TestSuite((
doctest.DocTestSuite(
Modified: zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/README.txt
===================================================================
--- zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/README.txt 2011-05-18 21:06:44 UTC (rev 121720)
+++ zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/README.txt 2011-05-19 06:04:17 UTC (rev 121721)
@@ -23,12 +23,6 @@
we'll just point to an empty directory on our link server. This
will make our examples run a little bit faster.
-python
- The name of a section to get the Python executable from.
- If not specified, then the buildout python option is used. The
- Python executable is found in the executable option of the named
- section.
-
We have a link server that has a number of distributions:
>>> print_(get(link_server))
Modified: zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/api.txt
===================================================================
--- zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/api.txt 2011-05-18 21:06:44 UTC (rev 121720)
+++ zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/api.txt 2011-05-19 06:04:17 UTC (rev 121721)
@@ -117,7 +117,6 @@
extras = other
find-links = http://localhost:27071/
index = http://localhost:27071/index
- python = buildout
recipe = sample
If we use the extra-paths option:
Modified: zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/custom.py
===================================================================
--- zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/custom.py 2011-05-18 21:06:44 UTC (rev 121720)
+++ zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/custom.py 2011-05-19 06:04:17 UTC (rev 121721)
@@ -29,8 +29,7 @@
options['_d'] = buildout['buildout']['develop-eggs-directory']
- python = options.get('python', buildout['buildout']['python'])
- options['executable'] = buildout[python]['executable']
+ options['executable'] = buildout['buildout']['executable']
self.build_ext = build_ext(buildout, options)
Modified: zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/custom.txt
===================================================================
--- zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/custom.txt 2011-05-18 21:06:44 UTC (rev 121720)
+++ zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/custom.txt 2011-05-19 06:04:17 UTC (rev 121721)
@@ -76,12 +76,6 @@
we'll just point to an empty directory on our link server. This
will make our examples run a little bit faster.
-python
- The name of a section to get the Python executable from.
- If not specified, then the buildout python option is used. The
- Python executable is found in the executable option of the named
- section.
-
environment
The name of a section with additional environment variables. The
environment variables are set before the egg is built.
@@ -506,12 +500,6 @@
swig-opts
List of SWIG command line options
-python
- The name of a section to get the Python executable from.
- If not specified, then the buildout python option is used. The
- Python executable is found in the executable option of the named
- section.
-
To illustrate this, we'll use a directory containing the extdemo
example from the earlier section:
Modified: zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/egg.py
===================================================================
--- zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/egg.py 2011-05-18 21:06:44 UTC (rev 121720)
+++ zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/egg.py 2011-05-19 06:04:17 UTC (rev 121721)
@@ -62,8 +62,7 @@
options['develop-eggs-directory'] = b_options['develop-eggs-directory']
options['_d'] = options['develop-eggs-directory'] # backward compat.
- python = options.setdefault('python', b_options['python'])
- options['executable'] = buildout[python]['executable']
+ options['executable'] = buildout['buildout']['executable']
def working_set(self, extra=()):
"""Separate method to just get the working set
Deleted: zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt
===================================================================
--- zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt 2011-05-18 21:06:44 UTC (rev 121720)
+++ zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt 2011-05-19 06:04:17 UTC (rev 121721)
@@ -1,140 +0,0 @@
-Controlling which Python to use
--------------------------------
-
-The following assumes that you have Python 2.5 installed.
-
-We can specify the python to use by specifying the name of a section
-to read the Python executable from. The default is the section
-defined by the python buildout option.
-
-We have a link server:
-
- >>> print_(get(link_server))
- <html><body>
- <a href="bigdemo-0.1-py2.5.egg">bigdemo-0.1-py2.5.egg</a><br>
- <a href="demo-0.1-py2.5.egg">demo-0.1-py2.5.egg</a><br>
- <a href="demo-0.2-py2.5.egg">demo-0.2-py2.5.egg</a><br>
- <a href="demo-0.3-py2.5.egg">demo-0.3-py2.5.egg</a><br>
- <a href="demo-0.4c1-py2.5.egg">demo-0.4c1-py2.5.egg</a><br>
- <a href="demoneeded-1.0.zip">demoneeded-1.0.zip</a><br>
- <a href="demoneeded-1.1.zip">demoneeded-1.1.zip</a><br>
- <a href="demoneeded-1.2c1.zip">demoneeded-1.2c1.zip</a><br>
- <a href="extdemo-1.4.zip">extdemo-1.4.zip</a><br>
- <a href="index/">index/</a><br>
- <a href="other-1.0-py2.5.egg">other-1.0-py2.5.egg</a><br>
- </body></html>
-
-We have a sample buildout. Let's update its configuration file to
-install the demo package using Python 2.5.
-
- >>> write(sample_buildout, 'buildout.cfg',
- ... """
- ... [buildout]
- ... parts = demo
- ... eggs-directory = eggs
- ... index = http://www.python.org/pypi/
- ...
- ... [python2.5]
- ... executable = %(python24)s
- ...
- ... [demo]
- ... recipe = zc.recipe.egg
- ... eggs = demo <0.3
- ... find-links = %(server)s
- ... python = python2.5
- ... interpreter = py-demo
- ... """ % dict(server=link_server, python24=other_executable))
-
-Now, if we run the buildout:
-
- >>> import os
- >>> os.chdir(sample_buildout)
- >>> buildout = os.path.join(sample_buildout, 'bin', 'buildout')
- >>> run(buildout)
- Installing demo.
- Getting distribution for 'demo<0.3'.
- Got demo 0.2.
- Getting distribution for 'demoneeded'.
- Got demoneeded 1.2c1.
- Generated script '/sample-buildout/bin/demo'.
- Generated interpreter '/sample-buildout/bin/py-demo'.
-
-we'll get the Python 2.5 eggs for demo and demoneeded:
-
- >>> ls(sample_buildout, 'eggs')
- - demo-0.2-py2.5.egg
- - demoneeded-1.2c1-py2.5.egg
- d setuptools-0.6-py2.5.egg
- - zc.buildout-1.0-py2.5.egg
-
-And the generated scripts invoke Python 2.5:
-
- >>> import sys
- >>> if sys.platform == 'win32':
- ... script_name = 'demo-script.py'
- ... else:
- ... script_name = 'demo'
- >>> f = open(os.path.join(sample_buildout, 'bin', script_name))
- >>> shebang = f.readline().strip()
- >>> if shebang[:3] == '#!"' and shebang[-1] == '"':
- ... shebang = '#!'+shebang[3:-1]
- >>> shebang == '#!' + other_executable
- True
- >>> print_(f.read()) # doctest: +NORMALIZE_WHITESPACE
- <BLANKLINE>
- import sys
- sys.path[0:0] = [
- '/sample-buildout/eggs/demo-0.2-py2.5.egg',
- '/sample-buildout/eggs/demoneeded-1.2c1-py2.5.egg',
- ]
- <BLANKLINE>
- import eggrecipedemo
- <BLANKLINE>
- if __name__ == '__main__':
- eggrecipedemo.main()
-
- >>> if sys.platform == 'win32':
- ... f = open(os.path.join(sample_buildout, 'bin', 'py-demo-script.py'))
- ... else:
- ... f = open(os.path.join(sample_buildout, 'bin', 'py-demo'))
-
- >>> shebang = f.readline().strip()
- >>> if shebang[:3] == '#!"' and shebang[-1] == '"':
- ... shebang = '#!'+shebang[3:-1]
- >>> shebang == '#!' + other_executable
- True
- >>> print_(f.read()) # doctest: +NORMALIZE_WHITESPACE
- <BLANKLINE>
- import sys
- <BLANKLINE>
- sys.path[0:0] = [
- '/sample-buildout/eggs/demo-0.2-py2.5.egg',
- '/sample-buildout/eggs/demoneeded-1.2c1-py2.5.egg',
- ]
- <BLANKLINE>
- _interactive = True
- if len(sys.argv) > 1:
- _options, _args = __import__("getopt").getopt(sys.argv[1:], 'ic:m:')
- _interactive = False
- for (_opt, _val) in _options:
- if _opt == '-i':
- _interactive = True
- elif _opt == '-c':
- exec _val
- elif _opt == '-m':
- sys.argv[1:] = _args
- _args = []
- __import__("runpy").run_module(
- _val, {}, "__main__", alter_sys=True)
- <BLANKLINE>
- if _args:
- sys.argv[:] = _args
- __file__ = _args[0]
- del _options, _args
- exec(compile(open(__file__).read(), __file__, "exec"))
- <BLANKLINE>
- if _interactive:
- del _interactive
- __import__("code").interact(banner="", local=globals())
-
- >>> f.close()
Modified: zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/tests.py
===================================================================
--- zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/tests.py 2011-05-18 21:06:44 UTC (rev 121720)
+++ zc.buildout/branches/2/zc.recipe.egg_/src/zc/recipe/egg/tests.py 2011-05-19 06:04:17 UTC (rev 121721)
@@ -14,7 +14,6 @@
import os, re, shutil, sys
import zc.buildout.tests
-import zc.buildout.testselectingpython
import zc.buildout.testing
import unittest, doctest
@@ -66,9 +65,6 @@
zc.buildout.tests.easy_install_SetUp(test)
zc.buildout.testing.install_develop('zc.recipe.egg', test)
-def setUpSelecting(test):
- zc.buildout.testselectingpython.setup(test)
- zc.buildout.testing.install_develop('zc.recipe.egg', test)
def test_suite():
suite = unittest.TestSuite((
@@ -138,32 +134,6 @@
),
))
- if zc.buildout.testing.script_in_shebang:
- suite.addTest(
- doctest.DocFileSuite(
- 'selecting-python.txt',
- setUp=setUpSelecting,
- tearDown=zc.buildout.testing.buildoutTearDown,
- checker=renormalizing.RENormalizing([
- zc.buildout.testing.normalize_path,
- zc.buildout.testing.normalize_endings,
- zc.buildout.testing.normalize_script,
- zc.buildout.tests.hide_distribute_additions,
- (re.compile('Got (setuptools|distribute) \S+'),
- 'Got setuptools V'),
- (re.compile('([d-] )?(setuptools|distribute)-\S+-py'),
- 'setuptools-V-py'),
- (re.compile('-py2[.][0-35-9][.]'), 'py2.5.'),
- (re.compile('zc.buildout-\S+[.]egg'),
- 'zc.buildout.egg'),
- (re.compile('zc.buildout[.]egg-link'),
- 'zc.buildout.egg'),
- # Distribute unzips eggs by default.
- (re.compile('\- demoneeded'), 'd demoneeded'),
- ]),
- ),
- )
-
return suite
if __name__ == '__main__':
More information about the checkins
mailing list