From 50451de21187ba0e990ad29e1e36ad1e920707fd Mon Sep 17 00:00:00 2001 From: Tom Van Mele Date: Wed, 16 Dec 2020 23:02:13 +0100 Subject: [PATCH 1/3] Prepend libs to path --- src/compas/_os.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/compas/_os.py b/src/compas/_os.py index b10aa5078487..9957e6b66615 100644 --- a/src/compas/_os.py +++ b/src/compas/_os.py @@ -221,13 +221,15 @@ def prepare_environment(env=None): env = os.environ.copy() if PYTHON_DIRECTORY: - lib_bin = os.path.join(PYTHON_DIRECTORY, 'Library', 'bin') - if os.path.exists(lib_bin) and lib_bin not in env['PATH']: - env['PATH'] += os.pathsep + lib_bin - - lib_bin = os.path.join(PYTHON_DIRECTORY, 'lib') - if os.path.exists(lib_bin) and lib_bin not in env['PATH']: - env['PATH'] += os.pathsep + lib_bin + if is_windows(): + lib_bin = os.path.join(PYTHON_DIRECTORY, 'Library', 'bin') + if os.path.exists(lib_bin) and lib_bin not in env['PATH']: + env['PATH'] = lib_bin + os.pathsep + env['PATH'] + + else: + lib_bin = os.path.join(PYTHON_DIRECTORY, 'bin') + if os.path.exists(lib_bin) and lib_bin not in env['PATH']: + env['PATH'] = lib_bin + os.pathsep + env['PATH'] if CONDA_EXE: env['CONDA_EXE'] = CONDA_EXE From fc7a6428e8f049c3113587b2b9b1182a74e70b9d Mon Sep 17 00:00:00 2001 From: Tom Van Mele Date: Wed, 16 Dec 2020 23:09:34 +0100 Subject: [PATCH 2/3] log --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e376175a7d61..55e8f4b4a9ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +* Changed `compas._os.prepare_environment` to prepend environment paths (fixes problem with RPC on windows). + ### Removed From c6f3f848196004dce76dbfee3935612b68d2fc02 Mon Sep 17 00:00:00 2001 From: Tom Van Mele Date: Wed, 16 Dec 2020 23:23:44 +0100 Subject: [PATCH 3/3] conditional path only --- src/compas/_os.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/compas/_os.py b/src/compas/_os.py index 9957e6b66615..af8a34e8a450 100644 --- a/src/compas/_os.py +++ b/src/compas/_os.py @@ -223,13 +223,11 @@ def prepare_environment(env=None): if PYTHON_DIRECTORY: if is_windows(): lib_bin = os.path.join(PYTHON_DIRECTORY, 'Library', 'bin') - if os.path.exists(lib_bin) and lib_bin not in env['PATH']: - env['PATH'] = lib_bin + os.pathsep + env['PATH'] - else: lib_bin = os.path.join(PYTHON_DIRECTORY, 'bin') - if os.path.exists(lib_bin) and lib_bin not in env['PATH']: - env['PATH'] = lib_bin + os.pathsep + env['PATH'] + + if os.path.exists(lib_bin) and lib_bin not in env['PATH']: + env['PATH'] = lib_bin + os.pathsep + env['PATH'] if CONDA_EXE: env['CONDA_EXE'] = CONDA_EXE