################################################################################
package_name = os.getenv('TORCH_PACKAGE_NAME', 'torch')
version = '1.1.0a0'
+sha = 'Unknown'
+
+try:
+ sha = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=cwd).decode('ascii').strip()
+except Exception:
+ pass
+
if os.getenv('PYTORCH_BUILD_VERSION'):
assert os.getenv('PYTORCH_BUILD_NUMBER') is not None
build_number = int(os.getenv('PYTORCH_BUILD_NUMBER'))
version = os.getenv('PYTORCH_BUILD_VERSION')
if build_number > 1:
version += '.post' + str(build_number)
-else:
- try:
- sha = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=cwd).decode('ascii').strip()
- version += '+' + sha[:7]
- except Exception:
- pass
+elif sha != 'Unknown':
+ version += '+' + sha[:7]
report("Building wheel {}-{}".format(package_name, version))
# this would claim to be a release build when it's not.)
f.write("debug = {}\n".format(repr(DEBUG)))
f.write("cuda = {}\n".format(repr(CUDA_VERSION)))
+ f.write("git_version = {}\n".format(repr(sha)))
def check_file(f):
if not os.path.exists(f):