Skip to content

Commit

Permalink
Merge pull request #2228 from ganga-devs/sort_envs
Browse files Browse the repository at this point in the history
stop mangling the environments
  • Loading branch information
mesmith75 authored Dec 12, 2023
2 parents 719ca41 + fe71a6d commit 62e5e74
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
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

0 comments on commit 62e5e74

Please sign in to comment.