[ghstack-poisoned]
This commit is contained in:
Xuehai Pan
2025-06-30 18:53:49 +08:00

View File

@ -415,12 +415,16 @@ sys.argv = filtered_args
if VERBOSE_SCRIPT:
def report(*args: Any, file: IO[str] = sys.stderr, **kwargs: Any) -> None:
print(*args, file=file, **kwargs)
def report(
*args: Any, file: IO[str] = sys.stderr, flush: bool = True, **kwargs: Any
) -> None:
print(*args, file=file, flush=flush, **kwargs)
else:
def report(*args: Any, file: IO[str] = sys.stderr, **kwargs: Any) -> None:
def report(
*args: Any, file: IO[str] = sys.stderr, flush: bool = True, **kwargs: Any
) -> None:
pass
# Make distutils respect --quiet too
@ -1166,9 +1170,11 @@ def configure_extension_build() -> tuple[
extra_compile_args=main_compile_args + extra_compile_args,
include_dirs=[],
library_dirs=library_dirs,
extra_link_args=(
extra_link_args + main_link_args + make_relative_rpath_args("lib")
),
extra_link_args=[
*extra_link_args,
*main_link_args,
*make_relative_rpath_args("lib"),
],
)
extensions.append(C)
@ -1219,10 +1225,10 @@ def print_box(msg: str) -> None:
msg = textwrap.dedent(msg).strip()
lines = ["", *msg.split("\n"), ""]
max_width = max(len(l) for l in lines)
print("+" + "-" * (max_width + 4) + "+")
print("+" + "-" * (max_width + 4) + "+", file=sys.stderr, flush=True)
for line in lines:
print(f"| {line:<{max_width}s} |")
print("+" + "-" * (max_width + 4) + "+")
print(f"| {line:<{max_width}s} |", file=sys.stderr, flush=True)
print("+" + "-" * (max_width + 4) + "+", file=sys.stderr, flush=True)
def main() -> None:
@ -1242,7 +1248,7 @@ def main() -> None:
]
if BUILD_PYTHON_ONLY:
install_requires.append(f"{LIBTORCH_PKG_NAME}=={get_torch_version()}")
install_requires.append(f"{LIBTORCH_PKG_NAME}=={TORCH_VERSION}")
if str2bool(os.getenv("USE_PRIORITIZED_TEXT_FOR_LD")):
gen_linker_script(
@ -1272,7 +1278,7 @@ def main() -> None:
try:
dist.parse_command_line()
except setuptools.errors.BaseError as e:
print(e)
print(e, file=sys.stderr)
sys.exit(1)
mirror_files_into_torchgen()