You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kg...@apache.org on 2016/03/02 15:31:37 UTC
qpid-proton git commit: Preserve environment variables when running
Popen.
Repository: qpid-proton
Updated Branches:
refs/heads/master af64ead9d -> b9cd200c5
Preserve environment variables when running Popen.
`Popen` does not inherit environment variables of current process
when run with `env` argument defined (and not None). We therefore
pass copy of the current environment with PYTHONPATH modified to
our needs.
This closes #69
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/b9cd200c
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/b9cd200c
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/b9cd200c
Branch: refs/heads/master
Commit: b9cd200c532e968bc349145b957c586684b08f02
Parents: af64ead
Author: Robert Kuska <rk...@redhat.com>
Authored: Wed Mar 2 10:31:05 2016 +0100
Committer: Ken Giusti <kg...@apache.org>
Committed: Wed Mar 2 09:08:04 2016 -0500
----------------------------------------------------------------------
proton-c/bindings/python/setup.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b9cd200c/proton-c/bindings/python/setup.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/setup.py b/proton-c/bindings/python/setup.py
index 8c815cd..1a74f0f 100755
--- a/proton-c/bindings/python/setup.py
+++ b/proton-c/bindings/python/setup.py
@@ -177,18 +177,26 @@ class Configure(build_ext):
os.makedirs(build_include)
os.mkdir(os.path.join(build_include, 'proton'))
+ # Create copy of environment variables and modify PYTHONPATH to preserve
+ # all others environment variables defined by user. When `env` is specified
+ # Popen will not inherit environment variables of the current process.
+ proton_envs = os.environ.copy()
+ default_path = proton_envs.get('PYTHONPATH')
+ proton_envs['PYTHONPATH'] = proton_base if not default_path else '{0}{1}{2}'.format(
+ proton_base, os.pathsep, default_path)
+
# Generate `protocol.h` by calling the python
# script found in the source dir.
with open(os.path.join(build_include, 'protocol.h'), 'wb') as header:
subprocess.Popen([sys.executable, os.path.join(proton_src, 'protocol.h.py')],
- env={'PYTHONPATH': proton_base}, stdout=header)
+ env=proton_envs, stdout=header)
# Generate `encodings.h` by calling the python
# script found in the source dir.
with open(os.path.join(build_include, 'encodings.h'), 'wb') as header:
subprocess.Popen([sys.executable,
os.path.join(proton_src, 'codec', 'encodings.h.py')],
- env={'PYTHONPATH': proton_base}, stdout=header)
+ env=proton_envs, stdout=header)
# Create a custom, temporary, version.h file mapping the
# major and minor versions from the downloaded tarball. This version should
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org