Skip to content

Commit

Permalink
Merge pull request #157 from flyingcircusio/phil/versions_ini_fallback
Browse files Browse the repository at this point in the history
improve detection of versions.ini
  • Loading branch information
zagy authored Apr 16, 2024
2 parents 5990410 + 8922b67 commit 207d985
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGES.d/20240408_101449_ph_versions_ini_fallback.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!--
A new scriv changelog fragment.
Uncomment the section that is right (remove the HTML comment wrapper).
-->

- improve dectection of a versions file for versions updates
9 changes: 8 additions & 1 deletion src/batou_ext/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,14 @@ def update_from_branch(self, branch: str):

@property
def versions_ini(self):
return self.environment.overrides["settings"]["versions_ini"]
if "versions_ini" in self.environment.overrides["settings"]:
return self.environment.overrides["settings"]["versions_ini"]
elif os.path.exists("versions.ini"):
return "versions.ini"
else:
raise ValueError(
"No versions.ini specified in the environment file (via `settings.versions_ini`) and the file `versions.ini` does not exist in the git root, cannot proceed"
)

def interactive(self):
envs = os.listdir(os.path.join(self.basedir, "environments"))
Expand Down

0 comments on commit 207d985

Please sign in to comment.