Commit 3122780d authored by Gary Poster's avatar Gary Poster

settle on "include-site-packages" and migrate all variations of...

settle on "include-site-packages" and migrate all variations of "add-site-packages" to that spelling.
parent b0e203be
...@@ -1170,7 +1170,7 @@ def scripts(reqs, working_set, executable, dest, ...@@ -1170,7 +1170,7 @@ def scripts(reqs, working_set, executable, dest,
def sitepackage_safe_scripts( def sitepackage_safe_scripts(
dest, working_set, executable, site_py_dest, dest, working_set, executable, site_py_dest,
reqs=(), scripts=None, interpreter=None, extra_paths=(), reqs=(), scripts=None, interpreter=None, extra_paths=(),
initialization='', add_site_packages=False, exec_sitecustomize=False, initialization='', include_site_packages=False, exec_sitecustomize=False,
relative_paths=False, script_arguments='', script_initialization=''): relative_paths=False, script_arguments='', script_initialization=''):
"""Generate scripts and/or an interpreter from a system Python. """Generate scripts and/or an interpreter from a system Python.
...@@ -1184,7 +1184,7 @@ def sitepackage_safe_scripts( ...@@ -1184,7 +1184,7 @@ def sitepackage_safe_scripts(
site_py_dest, executable, initialization, exec_sitecustomize)) site_py_dest, executable, initialization, exec_sitecustomize))
generated.append(_generate_site( generated.append(_generate_site(
site_py_dest, working_set, executable, extra_paths, site_py_dest, working_set, executable, extra_paths,
add_site_packages, relative_paths)) include_site_packages, relative_paths))
script_initialization = ( script_initialization = (
'\nimport site # imports custom buildout-generated site.py\n%s' % ( '\nimport site # imports custom buildout-generated site.py\n%s' % (
script_initialization,)) script_initialization,))
...@@ -1521,10 +1521,10 @@ def _generate_sitecustomize(dest, executable, initialization='', ...@@ -1521,10 +1521,10 @@ def _generate_sitecustomize(dest, executable, initialization='',
return sitecustomize_path return sitecustomize_path
def _generate_site(dest, working_set, executable, extra_paths=(), def _generate_site(dest, working_set, executable, extra_paths=(),
add_site_packages=False, relative_paths=False): include_site_packages=False, relative_paths=False):
"""Write a site.py file with eggs from working_set. """Write a site.py file with eggs from working_set.
extra_paths will be added to the path. If add_site_packages is True, extra_paths will be added to the path. If include_site_packages is True,
paths from the underlying Python will be added. paths from the underlying Python will be added.
""" """
path = _get_path(working_set, extra_paths) path = _get_path(working_set, extra_paths)
...@@ -1536,7 +1536,7 @@ def _generate_site(dest, working_set, executable, extra_paths=(), ...@@ -1536,7 +1536,7 @@ def _generate_site(dest, working_set, executable, extra_paths=(),
[(line and ' %s' % (line,) or line) [(line and ' %s' % (line,) or line)
for line in preamble.split('\n')]) for line in preamble.split('\n')])
original_path_setup = '' original_path_setup = ''
if add_site_packages: if include_site_packages:
stdlib, site_paths = _get_system_paths(executable) stdlib, site_paths = _get_system_paths(executable)
original_path_setup = original_path_snippet % ( original_path_setup = original_path_snippet % (
_format_paths((repr(p) for p in site_paths), 2),) _format_paths((repr(p) for p in site_paths), 2),)
...@@ -1551,7 +1551,7 @@ def _generate_site(dest, working_set, executable, extra_paths=(), ...@@ -1551,7 +1551,7 @@ def _generate_site(dest, working_set, executable, extra_paths=(),
relative_paths) relative_paths)
else: else:
location = repr(distribution.location) location = repr(distribution.location)
preamble += namespace_add_site_packages_setup % (location,) preamble += namespace_include_site_packages_setup % (location,)
original_path_setup = ( original_path_setup = (
addsitedir_namespace_originalpackages_snippet + addsitedir_namespace_originalpackages_snippet +
original_path_setup) original_path_setup)
...@@ -1580,7 +1580,7 @@ def _generate_site(dest, working_set, executable, extra_paths=(), ...@@ -1580,7 +1580,7 @@ def _generate_site(dest, working_set, executable, extra_paths=(),
raise RuntimeError('Buildout did not successfully rewrite site.py') raise RuntimeError('Buildout did not successfully rewrite site.py')
return site_path return site_path
namespace_add_site_packages_setup = ''' namespace_include_site_packages_setup = '''
setuptools_path = %s setuptools_path = %s
sys.path.append(setuptools_path) sys.path.append(setuptools_path)
known_paths.add(os.path.normcase(setuptools_path)) known_paths.add(os.path.normcase(setuptools_path))
......
...@@ -1267,7 +1267,7 @@ this is very straightforward. ...@@ -1267,7 +1267,7 @@ this is very straightforward.
>>> reset_interpreter() >>> reset_interpreter()
>>> generated = zc.buildout.easy_install.sitepackage_safe_scripts( >>> generated = zc.buildout.easy_install.sitepackage_safe_scripts(
... interpreter_bin_dir, ws, sys.executable, interpreter_parts_dir, ... interpreter_bin_dir, ws, sys.executable, interpreter_parts_dir,
... interpreter='py', add_site_packages=True) ... interpreter='py', include_site_packages=True)
>>> sys.stdout.write('#\n'); cat(site_path) >>> sys.stdout.write('#\n'); cat(site_path)
... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE ... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
#... #...
...@@ -1336,7 +1336,7 @@ call to another text fixture to create. ...@@ -1336,7 +1336,7 @@ call to another text fixture to create.
... links=[link_server, namespace_eggs], index=link_server+'index/') ... links=[link_server, namespace_eggs], index=link_server+'index/')
>>> generated = zc.buildout.easy_install.sitepackage_safe_scripts( >>> generated = zc.buildout.easy_install.sitepackage_safe_scripts(
... interpreter_bin_dir, ws, sys.executable, interpreter_parts_dir, ... interpreter_bin_dir, ws, sys.executable, interpreter_parts_dir,
... interpreter='py', add_site_packages=True) ... interpreter='py', include_site_packages=True)
>>> sys.stdout.write('#\n'); cat(site_path) >>> sys.stdout.write('#\n'); cat(site_path)
... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE ... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
#... #...
...@@ -1394,7 +1394,7 @@ at that result. ...@@ -1394,7 +1394,7 @@ at that result.
>>> reset_interpreter() >>> reset_interpreter()
>>> generated = zc.buildout.easy_install.sitepackage_safe_scripts( >>> generated = zc.buildout.easy_install.sitepackage_safe_scripts(
... interpreter_bin_dir, ws, sys.executable, interpreter_parts_dir, ... interpreter_bin_dir, ws, sys.executable, interpreter_parts_dir,
... interpreter='py', add_site_packages=True, ... interpreter='py', include_site_packages=True,
... relative_paths=interpreter_dir) ... relative_paths=interpreter_dir)
>>> sys.stdout.write('#\n'); cat(site_path) >>> sys.stdout.write('#\n'); cat(site_path)
... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE ... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
......
...@@ -1912,7 +1912,7 @@ tellmy.version and tellmy.fortune. ...@@ -1912,7 +1912,7 @@ tellmy.version and tellmy.fortune.
... recipe = z3c.recipe.scripts ... recipe = z3c.recipe.scripts
... python = primed_python ... python = primed_python
... interpreter = py ... interpreter = py
... add-site-packages = true ... include-site-packages = true
... eggs = tellmy.version == 1.0 ... eggs = tellmy.version == 1.0
... tellmy.fortune == 1.0 ... tellmy.fortune == 1.0
... demo ... demo
...@@ -1937,7 +1937,7 @@ tellmy.version and tellmy.fortune. ...@@ -1937,7 +1937,7 @@ tellmy.version and tellmy.fortune.
Generated interpreter '/sample-buildout/bin/py'. Generated interpreter '/sample-buildout/bin/py'.
<BLANKLINE> <BLANKLINE>
Finally, we are ready for the actual test. Prior to the bug fix that Finally, we are ready to see if it worked. Prior to the bug fix that
this tests, the results of both calls below was the following:: this tests, the results of both calls below was the following::
1.1 1.1
......
...@@ -33,7 +33,7 @@ this, we'll list the new options and describe them. ...@@ -33,7 +33,7 @@ this, we'll list the new options and describe them.
In addition to these, the recipe offers these new options. They are In addition to these, the recipe offers these new options. They are
introduced here, and described more in depth below. introduced here, and described more in depth below.
add-site-packages include-site-packages
You can choose to have the site-packages of the underlying Python You can choose to have the site-packages of the underlying Python
available to your script or interpreter, in addition to the packages available to your script or interpreter, in addition to the packages
from your eggs. See the section on this option for motivations and from your eggs. See the section on this option for motivations and
...@@ -47,7 +47,7 @@ extends ...@@ -47,7 +47,7 @@ extends
exec-sitecustomize exec-sitecustomize
Normally the Python's real sitecustomize module is not processed. Normally the Python's real sitecustomize module is not processed.
If you want it to be processed, set this value to 'true'. This will If you want it to be processed, set this value to 'true'. This will
be honored irrespective of the setting for add-site-packages. be honored irrespective of the setting for include-site-packages.
script-initialization script-initialization
The standard initialization code affects both an interpreter and scripts. The standard initialization code affects both an interpreter and scripts.
...@@ -202,7 +202,7 @@ instance, it is a system Python), you open yourself up to these ...@@ -202,7 +202,7 @@ instance, it is a system Python), you open yourself up to these
possibilities. Don't be unaware of the dangers. possibilities. Don't be unaware of the dangers.
To show off these features, we need to use buildout with a Python To show off these features, we need to use buildout with a Python
executable with some extra paths to show ``add-site-packages``; and one executable with some extra paths to show ``include-site-packages``; and one
guaranteed to have a sitecustomize module to show guaranteed to have a sitecustomize module to show
``exec-sitecustomize``. We'll make one using a test fixture called ``exec-sitecustomize``. We'll make one using a test fixture called
``make_py``. The os.environ change below will go into the sitecustomize, ``make_py``. The os.environ change below will go into the sitecustomize,
...@@ -215,7 +215,7 @@ and the site_packages_path will be in the Python's path. ...@@ -215,7 +215,7 @@ and the site_packages_path will be in the Python's path.
>>> print site_packages_path >>> print site_packages_path
/executable_buildout/site-packages /executable_buildout/site-packages
Now let's take a look at add-site-packages. Now let's take a look at include-site-packages.
>>> write(sample_buildout, 'buildout.cfg', >>> write(sample_buildout, 'buildout.cfg',
... """ ... """
...@@ -225,7 +225,7 @@ Now let's take a look at add-site-packages. ...@@ -225,7 +225,7 @@ Now let's take a look at add-site-packages.
... ...
... [py] ... [py]
... recipe = z3c.recipe.scripts:interpreter ... recipe = z3c.recipe.scripts:interpreter
... add-site-packages = true ... include-site-packages = true
... eggs = demo<0.3 ... eggs = demo<0.3
... find-links = %(server)s ... find-links = %(server)s
... index = %(server)s/index ... index = %(server)s/index
......
...@@ -31,13 +31,13 @@ class Base(ScriptBase): ...@@ -31,13 +31,13 @@ class Base(ScriptBase):
b_options['parts-directory'], self.name) b_options['parts-directory'], self.name)
value = options.setdefault( value = options.setdefault(
'add-site-packages', 'include-site-packages',
b_options.get('add-site-packages', 'false')) b_options.get('include-site-packages', 'false'))
if value not in ('true', 'false'): if value not in ('true', 'false'):
raise zc.buildout.UserError( raise zc.buildout.UserError(
"Invalid value for add-site-packages option: %s" % "Invalid value for include-site-packages option: %s" %
(value,)) (value,))
self.add_site_packages = (value == 'true') self.include_site_packages = (value == 'true')
value = options.setdefault( value = options.setdefault(
'exec-sitecustomize', 'exec-sitecustomize',
...@@ -69,7 +69,7 @@ class Interpreter(Base): ...@@ -69,7 +69,7 @@ class Interpreter(Base):
interpreter=options['name'], interpreter=options['name'],
extra_paths=self.extra_paths, extra_paths=self.extra_paths,
initialization=options.get('initialization', ''), initialization=options.get('initialization', ''),
add_site_packages=self.add_site_packages, include_site_packages=self.include_site_packages,
exec_sitecustomize=self.exec_sitecustomize, exec_sitecustomize=self.exec_sitecustomize,
relative_paths=self._relative_paths, relative_paths=self._relative_paths,
)) ))
...@@ -92,7 +92,7 @@ class Scripts(Base): ...@@ -92,7 +92,7 @@ class Scripts(Base):
interpreter=options.get('interpreter'), interpreter=options.get('interpreter'),
extra_paths=self.extra_paths, extra_paths=self.extra_paths,
initialization=options.get('initialization', ''), initialization=options.get('initialization', ''),
add_site_packages=self.add_site_packages, include_site_packages=self.include_site_packages,
exec_sitecustomize=self.exec_sitecustomize, exec_sitecustomize=self.exec_sitecustomize,
relative_paths=self._relative_paths, relative_paths=self._relative_paths,
script_arguments=options.get('arguments', ''), script_arguments=options.get('arguments', ''),
......
...@@ -25,7 +25,7 @@ from zope.testing import doctest, renormalizing ...@@ -25,7 +25,7 @@ from zope.testing import doctest, renormalizing
# all of the examples. The README tests ``extends``, # all of the examples. The README tests ``extends``,
# ``include-site-customization`` and ``name``. That leaves ``python``, # ``include-site-customization`` and ``name``. That leaves ``python``,
# ``extra-paths``, ``initialization``, ``relative-paths``, and # ``extra-paths``, ``initialization``, ``relative-paths``, and
# ``add-site-packages``. # ``include-site-packages``.
def supports_python_option(): def supports_python_option():
""" """
......
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