project init
This commit is contained in:
22
src/speccpu/__init__.py
Normal file
22
src/speccpu/__init__.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import copy
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def get_spec_env(spec_dir: Path):
|
||||
new_env = copy.deepcopy(os.environ)
|
||||
new_env["SPEC"] = str(spec_dir)
|
||||
new_env["PATH"] = os.pathsep.join(
|
||||
[
|
||||
str(spec_dir / "bin"),
|
||||
*new_env["PATH"].split(os.pathsep),
|
||||
]
|
||||
)
|
||||
return new_env
|
||||
|
||||
def find_build(build_dir: Path) -> Path:
|
||||
entries = list(sorted(os.listdir(build_dir)))
|
||||
for entry in entries:
|
||||
if entry.startswith("build"):
|
||||
return build_dir / entry
|
||||
raise RuntimeError(f"SPEC build directory not found at {build_dir}")
|
||||
Reference in New Issue
Block a user