Commit a9fd78ce authored by gary's avatar gary

Scripts store the old PYTHONPATH in BUILDOUT_ORIGINAL_PYTHONPATH if it existed

git-svn-id: http://svn.zope.org/repos/main/zc.buildout/trunk@116009 62d5b8a3-27da-0310-9561-8e5933582275
parent e83d41ce
......@@ -4,6 +4,13 @@ Change History
1.5.1 (unreleased)
==================
New features:
- Scripts store the old PYTHONPATH in BUILDOUT_ORIGINAL_PYTHONPATH if it
existed, and store nothing in the value if it did not exist. This allows
recipes that do not want subprocesses to have the system-Python-protected
site.py to set the environment of the subprocess appropriately.
Bugs fixed:
- https://bugs.launchpad.net/bugs/623590 : If include-site-packages were
......
......@@ -65,6 +65,7 @@ customized site.py.
import os
path = sys.path[0]
if os.environ.get('PYTHONPATH'):
os.environ['BUILDOUT_ORIGINAL_PYTHONPATH'] = os.environ['PYTHONPATH']
path = os.pathsep.join([path, os.environ['PYTHONPATH']])
os.environ['PYTHONPATH'] = path
import site # imports custom buildout-generated site.py
......
......@@ -2421,6 +2421,7 @@ If relative-paths is ``true``, the buildout script uses relative paths.
import os
path = sys.path[0]
if os.environ.get('PYTHONPATH'):
os.environ['BUILDOUT_ORIGINAL_PYTHONPATH'] = os.environ['PYTHONPATH']
path = os.pathsep.join([path, os.environ['PYTHONPATH']])
os.environ['PYTHONPATH'] = path
import site # imports custom buildout-generated site.py
......
......@@ -1287,6 +1287,7 @@ _script_initialization_template = '''
import os
path = sys.path[0]
if os.environ.get('PYTHONPATH'):
os.environ['BUILDOUT_ORIGINAL_PYTHONPATH'] = os.environ['PYTHONPATH']
path = os.pathsep.join([path, os.environ['PYTHONPATH']])
os.environ['PYTHONPATH'] = path
import site # imports custom buildout-generated site.py
......
......@@ -1510,6 +1510,7 @@ The demo script runs the entry point defined in the demo egg:
import os
path = sys.path[0]
if os.environ.get('PYTHONPATH'):
os.environ['BUILDOUT_ORIGINAL_PYTHONPATH'] = os.environ['PYTHONPATH']
path = os.pathsep.join([path, os.environ['PYTHONPATH']])
os.environ['PYTHONPATH'] = path
import site # imports custom buildout-generated site.py
......@@ -1554,6 +1555,7 @@ Let's see ``script_arguments`` and ``script_initialization`` in action.
import os
path = sys.path[0]
if os.environ.get('PYTHONPATH'):
os.environ['BUILDOUT_ORIGINAL_PYTHONPATH'] = os.environ['PYTHONPATH']
path = os.pathsep.join([path, os.environ['PYTHONPATH']])
os.environ['PYTHONPATH'] = path
import site # imports custom buildout-generated site.py
......
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