Skip to content

Commit 2a86177

Browse files
authored
Revert "Enable complete out-of-tree build with TRITON_BUILD_DIR (#7871)" (#7896)
This reverts commit 1f10206 as it breaks internal workflows (`pip install -v .` no longer copies files into site-packages correctly).
1 parent 97ba3b3 commit 2a86177

File tree

2 files changed

+9
-41
lines changed

2 files changed

+9
-41
lines changed

python/build_helpers.py

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,18 @@
55

66

77
def get_base_dir():
8-
return Path(__file__).parent.parent
8+
return os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
99

1010

11-
def _get_build_base():
12-
build_base = os.getenv("TRITON_BUILD_DIR", default=(get_base_dir() / "build"))
13-
return Path(build_base)
14-
15-
16-
def _get_dir_common(prefix):
11+
def _get_cmake_dir():
1712
plat_name = sysconfig.get_platform()
1813
python_version = sysconfig.get_python_version()
19-
dir_name = f"{prefix}.{plat_name}-{sys.implementation.name}-{python_version}"
20-
path = _get_build_base() / dir_name
21-
path.mkdir(parents=True, exist_ok=True)
22-
return path
14+
dir_name = f"cmake.{plat_name}-{sys.implementation.name}-{python_version}"
15+
return Path(get_base_dir()) / "build" / dir_name
2316

2417

2518
def get_cmake_dir():
26-
return _get_dir_common("cmake")
27-
28-
29-
def get_build_lib():
30-
return _get_dir_common("lib")
31-
32-
33-
def get_build_temp():
34-
return _get_dir_common("temp")
35-
36-
37-
def get_bdist_dir():
38-
return _get_dir_common("bdist")
19+
cmake_dir = os.getenv("TRITON_BUILD_DIR", default=_get_cmake_dir())
20+
cmake_dir = Path(cmake_dir)
21+
cmake_dir.mkdir(parents=True, exist_ok=True)
22+
return cmake_dir

setup.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,7 @@ class editable_wheel:
4343

4444
sys.path.insert(0, os.path.dirname(__file__))
4545

46-
from python.build_helpers import (
47-
get_base_dir,
48-
get_cmake_dir,
49-
get_build_lib,
50-
get_build_temp,
51-
get_bdist_dir,
52-
)
46+
from python.build_helpers import get_base_dir, get_cmake_dir
5347

5448

5549
def is_git_repo():
@@ -381,10 +375,6 @@ def initialize_options(self):
381375

382376
class CMakeBuildPy(build_py):
383377

384-
def initialize_options(self):
385-
super().initialize_options()
386-
self.build_lib = get_build_lib().as_posix()
387-
388378
def run(self) -> None:
389379
self.run_command('build_ext')
390380
return super().run()
@@ -406,8 +396,6 @@ class CMakeBuild(build_ext):
406396
def initialize_options(self):
407397
build_ext.initialize_options(self)
408398
self.base_dir = get_base_dir()
409-
self.build_lib = get_build_lib()
410-
self.build_temp = get_build_temp()
411399

412400
def finalize_options(self):
413401
build_ext.finalize_options(self)
@@ -708,10 +696,6 @@ def add_links(external_only):
708696

709697
class plugin_bdist_wheel(bdist_wheel):
710698

711-
def initialize_options(self):
712-
super().initialize_options()
713-
self.bdist_dir = get_bdist_dir()
714-
715699
def run(self):
716700
add_links(external_only=True)
717701
super().run()

0 commit comments

Comments
 (0)