mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Revert "[BE][Easy] enable postponed annotations in tools
(#129375)"
This reverts commit 59eb2897f1745f513edb6c63065ffad481c4c8d0. Reverted https://github.com/pytorch/pytorch/pull/129375 on behalf of https://github.com/huydhn due to Sorry for reverting your change but I need to revert to cleanly revert https://github.com/pytorch/pytorch/pull/129374, please do a rebase and reland this ([comment](https://github.com/pytorch/pytorch/pull/129375#issuecomment-2197800541))
This commit is contained in:
@ -1,10 +1,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from typing import Optional, Union
|
||||
|
||||
from setuptools import distutils # type: ignore[import]
|
||||
|
||||
@ -13,7 +12,7 @@ UNKNOWN = "Unknown"
|
||||
RELEASE_PATTERN = re.compile(r"/v[0-9]+(\.[0-9]+)*(-rc[0-9]+)?/")
|
||||
|
||||
|
||||
def get_sha(pytorch_root: str | Path) -> str:
|
||||
def get_sha(pytorch_root: Union[str, Path]) -> str:
|
||||
try:
|
||||
rev = None
|
||||
if os.path.exists(os.path.join(pytorch_root, ".git")):
|
||||
@ -31,7 +30,7 @@ def get_sha(pytorch_root: str | Path) -> str:
|
||||
return UNKNOWN
|
||||
|
||||
|
||||
def get_tag(pytorch_root: str | Path) -> str:
|
||||
def get_tag(pytorch_root: Union[str, Path]) -> str:
|
||||
try:
|
||||
tag = subprocess.run(
|
||||
["git", "describe", "--tags", "--exact"],
|
||||
@ -47,8 +46,8 @@ def get_tag(pytorch_root: str | Path) -> str:
|
||||
return UNKNOWN
|
||||
|
||||
|
||||
def get_torch_version(sha: str | None = None) -> str:
|
||||
pytorch_root = Path(__file__).absolute().parent.parent
|
||||
def get_torch_version(sha: Optional[str] = None) -> str:
|
||||
pytorch_root = Path(__file__).parent.parent
|
||||
version = open(pytorch_root / "version.txt").read().strip()
|
||||
|
||||
if os.getenv("PYTORCH_BUILD_VERSION"):
|
||||
|
Reference in New Issue
Block a user