Skip to content

Commit

Permalink
Make all environment elements work same way
Browse files Browse the repository at this point in the history
  • Loading branch information
guyer committed Feb 22, 2024
1 parent ce22702 commit b3c0f4a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions fipy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@ def _excepthook(*args):

if _log.isEnabledFor(logging.DEBUG):
try:
_fipy_environment["conda"] = environment.conda_info()
_fipy_environment.update(environment.conda_info())
except:
pass

try:
_fipy_environment["pip"] = environment.pip_info()
_fipy_environment.update(environment.pip_info())
except:
pass

try:
_fipy_environment["nix"] = environment.nix_info()
_fipy_environment.update(environment.nix_info())
except:
pass

Expand Down
8 changes: 6 additions & 2 deletions fipy/tools/logging/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def conda_info(conda="conda"):
stdout = stdout.decode('ascii')

info["conda_info"] = json.loads(stdout)

p = subprocess.Popen([conda, "env", "export",
"--name", info["conda_info"]["active_prefix_name"],
"--json"],
Expand Down Expand Up @@ -53,7 +54,9 @@ def pip_info(python="python"):
stdout, _ = p.communicate()
stdout = stdout.decode('ascii')

return json.loads(stdout)
info["pip"] = json.loads(stdout)

return info

def nix_info():
"""Collect information about nix environment.
Expand Down Expand Up @@ -83,7 +86,8 @@ def nix_info():
stdout, _ = p.communicate()
stdout = stdout.decode('ascii')

info["nix_info"] = json.loads(stdout)
info["nix"] = json.loads(stdout)

return info

def package_info():
Expand Down

0 comments on commit b3c0f4a

Please sign in to comment.