Commit c989a1cf authored by limm's avatar limm
Browse files

fix the whl naming format

parent d79540ef
......@@ -12,24 +12,21 @@ from tools import setup_helpers
ROOT_DIR = Path(__file__).parent.resolve()
def _run_cmd(cmd):
def _run_cmd(cmd, shell=False):
try:
return subprocess.check_output(cmd, cwd=ROOT_DIR, stderr=subprocess.DEVNULL).decode("ascii").strip()
except Exception:
return None
def _get_version(sha):
with open(ROOT_DIR / "version.txt", "r") as f:
version = f.read().strip()
if os.getenv("BUILD_VERSION"):
version = os.getenv("BUILD_VERSION")
elif sha is not None:
version += "+" + sha[:7]
#elif sha is not None:
# version += "+" + sha[:7]
return version
def _make_version_file(version, sha):
sha = "Unknown" if sha is None else sha
version_path = ROOT_DIR / "src" / "torchaudio" / "version.py"
......@@ -37,13 +34,11 @@ def _make_version_file(version, sha):
f.write(f"__version__ = '{version}'\n")
f.write(f"git_version = '{sha}'\n")
def _get_pytorch_version():
if "PYTORCH_VERSION" in os.environ:
return f"torch=={os.environ['PYTORCH_VERSION']}"
return "torch"
class clean(distutils.command.clean.clean):
def run(self):
# Run default behavior first
......@@ -62,7 +57,6 @@ class clean(distutils.command.clean.clean):
print(f"removing '{path}' (and everything under it)")
shutil.rmtree(str(path), ignore_errors=True)
def _parse_url(path):
with open(path, "r") as file_:
for line in file_:
......@@ -71,15 +65,14 @@ def _parse_url(path):
url = match.group(1)
yield url
def _fetch_archives(src):
for dest, url in src:
if not dest.exists():
print(f" --- Fetching {os.path.basename(dest)}")
torch.hub.download_url_to_file(url, dest, progress=False)
def _main():
ROCM_HOME = os.getenv("ROCM_PATH")
sha = _run_cmd(["git", "rev-parse", "HEAD"])
branch = _run_cmd(["git", "rev-parse", "--abbrev-ref", "HEAD"])
tag = _run_cmd(["git", "describe", "--tags", "--exact-match", "@"])
......@@ -89,7 +82,11 @@ def _main():
pytorch_package_dep = _get_pytorch_version()
print("-- PyTorch dependency:", pytorch_package_dep)
version = _get_version(sha)
version += "+das.opt1"
print("-- Building version", version)
dtk = _run_cmd(["cat", os.path.join(ROCM_HOME, '.info/rocm_version')])
print(f"-- dtk_version = {dtk}")
version += ".dtk" + dtk
_make_version_file(version, sha)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment