Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop mangling the environments #2228

Merged
merged 5 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions ganga/GangaCore/Utility/Shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,10 @@ def __init__(self, setup=None, setup_args=[]):
setup_args (list): list of strings which are executed directly with a ' ' character spacing
"""

self.env = os.environ
if setup is not None:
self.env = dict(os.environ)
execute('source {0} {1}'.format(setup, " ".join(setup_args)), shell=True, env=self.env, update_env=True)

else:
# bug #44334: Ganga/Utility/Shell.py does not save environ
env = dict(os.environ)
self.env = expand_vars(env)

self.dirname = None

def cmd(self, cmd, soutfile=None, allowed_exit=None,
Expand Down
4 changes: 1 addition & 3 deletions ganga/GangaDirac/Lib/Utilities/DiracUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def get_env(env_source):

"""
logger.debug('Running DIRAC source command %s', env_source)
env = dict(os.environ)
env = os.environ
gexecute.execute('source {0}'.format(env_source), shell=True, env=env, update_env=True)
if not any(key.startswith('DIRAC') for key in env):
fake_dict = {}
Expand Down Expand Up @@ -139,8 +139,6 @@ def read_env_cache(cache_filename):
logger.debug('Reading DIRAC cache file at %s', cache_filename)
with open(cache_filename, 'r') as cache_file:
env = json.load(cache_file)
# Convert unicode strings to byte strings
env = dict((k.encode('utf-8'), v.encode('utf-8')) for k, v in env.items())
return env

# /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Expand Down
Loading