Skip to content

Commit

Permalink
Fix python env path prepends in gitbash
Browse files Browse the repository at this point in the history
Signed-off-by: javrin <jawabiscuit@users.noreply.github.com>
  • Loading branch information
Jawabiscuit committed Sep 15, 2023
1 parent 63d1fe6 commit f5920fc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/rez/data/tests/builds/packages/foo/1.1.0/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

@include("late_utils")
def commands():
env.PYTHONPATH.append('{root}/python')
# Test prepends by throwing in an extra python path
env.PYTHONPATH.prepend('{root}/python')
env.PYTHONPATH.append('{root}/noexist')
env.FOO_IN_DA_HOUSE = "1"

late_utils.add_eek_var(env)
Expand Down
14 changes: 13 additions & 1 deletion src/rez/rex.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,13 @@ def get_public_methods(self):
('undefined', self.undefined)]

def _env_sep(self, name):
return self._env_sep_map.get(name, self.interpreter.pathsep)
return self.interpreter.env_sep_map.get(
name,
self._env_sep_map.get(
name,
self.interpreter.pathsep
)
)

def _is_verbose(self, command):
if isinstance(self.verbose, (list, tuple)):
Expand Down Expand Up @@ -493,6 +499,12 @@ class ActionInterpreter(object):
#
pathsep = os.pathsep

# Path separator mapping. There are cases (eg gitbash - git for windows) where
# the path separator changes based on the variable
# (eg "PATH": ":", and "PYTHONPATH": ";")
#
env_sep_map = {}

# RegEx that captures environment variables (generic form).
# Extend/override to regex formats that can capture environment formats
# in other interpreters like shells if needed
Expand Down

0 comments on commit f5920fc

Please sign in to comment.