Skip to content

Commit 7cb5788

Browse files
Update build tools and dependencies (#139)
* Move build directory into temporary directory * Update pybind11 extensions dependency * Remove pybind11 extensions from dev requirements
1 parent a6da7fc commit 7cb5788

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

get_compiler/__init__.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
import os
22
import subprocess
3-
4-
Dir = os.path.dirname(__file__)
3+
from tempfile import TemporaryDirectory
54

65

76
def main() -> str:
87
if subprocess.run(["cmake", "--version"]).returncode:
98
raise RuntimeError("Could not find cmake")
109

11-
# get the compiler id and version
12-
if subprocess.run(
13-
["cmake", "-S", Dir, "-B", os.path.join(Dir, "build")]
14-
).returncode:
15-
raise RuntimeError(
16-
"Could not find a C++ 20 compiler. Do you have a C++ 20 compiler installed?"
17-
)
10+
with TemporaryDirectory() as build_dir:
11+
# get the compiler id and version
12+
if subprocess.run(
13+
["cmake", "-S", os.path.dirname(__file__), "-B", build_dir]
14+
).returncode:
15+
raise RuntimeError(
16+
"Could not find a C++ 20 compiler. Do you have a C++ 20 compiler installed?"
17+
)
1818

19-
# Get the compiler variables generated by the cmake file
20-
with open(os.path.join(Dir, "build", "compiler_id.txt")) as f:
21-
compiler_id_str = f.read().strip()
22-
with open(os.path.join(Dir, "build", "compiler_version.txt")) as f:
23-
compiler_version = f.read().strip().split(".", 1)[0]
19+
# Get the compiler variables generated by the cmake file
20+
with open(os.path.join(build_dir, "compiler_id.txt")) as f:
21+
compiler_id_str = f.read().strip()
22+
with open(os.path.join(build_dir, "compiler_version.txt")) as f:
23+
compiler_version = f.read().strip().split(".", 1)[0]
2424

2525
# convert the compiler id to an int so it can be used in a version number
2626
compiler_id_int = 0

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ dev = [
3232
"versioneer",
3333
"packaging",
3434
"wheel",
35-
"amulet_pybind11_extensions~=1.0",
3635
"pybind11_stubgen>=2.5.4",
3736
"black>=22.3",
3837
"isort",

requirements.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
AMULET_COMPILER_TARGET_REQUIREMENT = "==2.0"
66

77
PYBIND11_REQUIREMENT = "==3.0.0"
8-
AMULET_PYBIND11_EXTENSIONS_REQUIREMENT = "~=1.1.0.0a0"
8+
AMULET_PYBIND11_EXTENSIONS_REQUIREMENT = "~=1.2.0.0a0"
99
AMULET_IO_REQUIREMENT = "~=1.0"
1010
AMULET_ZLIB_REQUIREMENT = "~=1.0.8.0a0"
1111
NUMPY_REQUIREMENT = "~=2.0"

0 commit comments

Comments
 (0)