From db7542d51d451714379af90a253b511af4f03b09 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Sun, 30 Apr 2023 23:50:23 -0300 Subject: [PATCH 1/2] Change version numbering to be in accordance with PEP 440, required by Setuptools>=66 --- setup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index d1b528bb4bb..b1112456d3b 100644 --- a/setup.py +++ b/setup.py @@ -31,8 +31,10 @@ sys.argv.remove('--nightly') project_name = 'tensorflow-examples' -# Get the current commit hash -version = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('utf-8') +# Get the current commit hash and timestamp +commit_hash = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('utf-8').strip() +commit_timestamp = subprocess.check_output(['git', 'show', '-s', '--format=%ct', 'HEAD']).decode('utf-8').strip() +version = f"0.{commit_timestamp}.{int(commit_hash, 16)}" if nightly: project_name = 'tensorflow-examples-nightly' From 94860f6316ece6ab67ffd7580cff0a77f05e05d0 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Mon, 1 May 2023 00:46:27 -0300 Subject: [PATCH 2/2] Minor changes for clarity and add explanatory comments. --- setup.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index b1112456d3b..ba7cedde01c 100644 --- a/setup.py +++ b/setup.py @@ -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'