Skip to content

Commit

Permalink
Minor changes for clarity and add explanatory comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoscsouza committed May 1, 2023
1 parent db7542d commit 94860f6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@

project_name = 'tensorflow-examples'
# Get the current commit hash and timestamp
commit_hash = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('utf-8').strip()
# The timestamp is used so that newer commits have a higher version number
# The hash is used so that the specific commit can be identified
# The hash integer can be converted back to the hash string with: '%032x' % commit_hash_int
commit_hash_int = int(subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('utf-8').strip(), 16)
commit_timestamp = subprocess.check_output(['git', 'show', '-s', '--format=%ct', 'HEAD']).decode('utf-8').strip()
version = f"0.{commit_timestamp}.{int(commit_hash, 16)}"
version = f"0.{commit_timestamp}.{commit_hash_int}"

if nightly:
project_name = 'tensorflow-examples-nightly'
Expand Down

0 comments on commit 94860f6

Please sign in to comment.