Skip to content

Commit

Permalink
WIP: fix module not found
Browse files Browse the repository at this point in the history
  • Loading branch information
doneachh committed Nov 27, 2023
1 parent 248b9f8 commit 0ba36bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ RDIR = config["results_dir"] + config["run"]
CDIR = config["costs_dir"]

config.update({"git_commit": get_last_commit_message(".")})
config.update({"submodule_commit": get_last_commit_message("./pypsa-earth")})
config.update({"submodule_commit": get_last_commit_message(PYPSAEARTH_FOLDER)})

CUTOUTS_PATH = (
"cutouts/cutout-2013-era5-tutorial.nc"
Expand Down
9 changes: 6 additions & 3 deletions scripts/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,17 +576,20 @@ def get_last_commit_message(path):
result : string
"""
_logger = logging.getLogger(__name__)
last_commit_message = None
backup_cwd = os.getcwd()
try:
os.chdir(path)
last_commit_message = (
subprocess.check_output(
["git", "log", "-n", "1", "--pretty=format:%H %s"],
cwd=path,
stderr=subprocess.STDOUT,
)
.decode()
.strip()
)
return last_commit_message
except subprocess.CalledProcessError as e:
_logger.warning(f"Error executing Git: {e}")
return None

os.chdir(backup_cwd)
return last_commit_message

0 comments on commit 0ba36bc

Please sign in to comment.