Skip to content

Commit d323568

Browse files
committed
Switching from chrpath to patchelf
1 parent 92205b3 commit d323568

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

python/.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ __pycache__/
1111
build/
1212
develop-eggs/
1313
dist/
14-
dist_old/
1514
downloads/
1615
eggs/
1716
.eggs/

python/build_env_linux.yml

+1
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,5 @@ dependencies:
102102
- ninja==1.11.1.3
103103
- numpy==2.2.3
104104
- packaging==24.2
105+
- patchelf==0.17.2.1
105106
- pyproject-hooks==1.2.0

python/requirements-dev.txt

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ meson==1.7.0
44
ninja==1.11.1.3
55
numpy==2.2.3
66
packaging==24.2
7+
patchelf==0.17.2.1
78
pyproject_hooks==1.2.0
89
setuptools==75.8.2
910
wheel==0.45.1

python/scripts/dist_pypi.py

+18-6
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,24 @@ def main(py_versions):
5858
subprocess.run(["rm", lib_path])
5959
lib_path = f"src/magtense/lib/magtensesource.{py_lib}-{arch}.{suffix}"
6060
if platform == "linux":
61-
# subprocess.run(
62-
# ["patchelf", "--set-rpath", "$ORIGIN/../../../../../lib", lib_path]
63-
# )
64-
subprocess.run(
65-
["chrpath", "-r", "$ORIGIN/../../../../../lib", lib_path]
66-
)
61+
if cuda == "cpu":
62+
subprocess.run(
63+
[
64+
"patchelf",
65+
"--set-rpath",
66+
"$ORIGIN/../../../../../lib",
67+
lib_path,
68+
]
69+
)
70+
elif cuda == "cu12":
71+
subprocess.run(
72+
[
73+
"patchelf",
74+
"--set-rpath",
75+
"$ORIGIN/../../../../../lib:$ORIGIN/../../nvidia/cublas/lib/:$ORIGIN/../../nvidia/cuda_runtime/lib/:$ORIGIN/../../nvidia/cusparse/lib/",
76+
lib_path,
77+
]
78+
)
6779
subprocess.run(["cp", f"requirements-{cuda}.txt", "requirements.txt"])
6880
subprocess.run(["python3", "-m", "build", "--wheel"])
6981
subprocess.run(

0 commit comments

Comments
 (0)