Skip to content

Commit

Permalink
Update hash handling in conanfile.py
Browse files Browse the repository at this point in the history
Refactor variable name from `hash` to `commit_hash` for clarity. Also, set `commit_hash` to "unknown" when an exception is caught during git interaction.
  • Loading branch information
saumyaj3 committed Oct 9, 2024
1 parent 010f5a9 commit e62a449
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ class DulcificumConan(ConanFile):
def set_version(self):
try:
git = Git(self)
self.hash = git.get_commit()
self.commit_hash = git.get_commit()
except ConanException as e:
self.commit_hash = "unknown"
self.output.error(f"An error occurred: {e}")
if not self.version:
self.version = self.conan_data["version"]
Expand Down Expand Up @@ -135,7 +136,7 @@ def generate(self):
tc.variables["ENABLE_TESTS"] = self._run_tests
tc.variables["EXTENSIVE_WARNINGS"] = self.options.enable_extensive_warnings
tc.variables["DULCIFICUM_VERSION"] = self.version
tc.variables["GIT_COMMIT_HASH"] = self.hash
tc.variables["GIT_COMMIT_HASH"] = self.commit_hash

tc.variables["WITH_APPS"] = self.options.with_apps
if self.options.with_apps:
Expand Down

0 comments on commit e62a449

Please sign in to comment.