Skip to content

Commit

Permalink
BLD: Fix setup.py.
Browse files Browse the repository at this point in the history
  • Loading branch information
MilanSkocic committed Jun 23, 2024
1 parent dbc620e commit 3e0c7b3
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions py/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,39 @@

if platform.system() == "Linux":
libraries = [name]
library_dirs = [f"./src/py{name:s}/lib/"]
library_dirs = [f"./src/py{name:s}"]
runtime_library_dirs = ["$ORIGIN"]
ext = [".so"]
ROOT = ROOTLINUX
LIBS = LIBSLINUX
if platform.system() == "Windows":
extra_objects = [f"./src/py{name:s}/lib/lib{name:s}.dll.a"]
src = pathlib.Path(f"./src/py{name:s}/lib/lib{name:s}.dll")
dest = pathlib.Path(f"./src/py{name:s}/lib{name:s}.dll")
if not src.exists():
raise ValueError(f"The library {name} was not installed. Run in the root folder: make install prefix=./py/src/py{name:s}")
shutil.copy(src, dest)
extra_objects = [f"./src/py{name:s}/lib{name:s}.dll.a"]
ext = [".dll", ".dll.a"]
ROOT = ROOTWINDOWS
LIBS = LIBSWINDOWS
if platform.system() == "Darwin":
libraries = [name]
library_dirs = [f"./src/py{name:s}/lib/"]
library_dirs = [f"./src/py{name:s}"]
runtime_library_dirs = ["@loader_path"]
ext = [".dylib"]
ROOT = ROOTDARWIN
LIBS = LIBSDARWIN


# Headers
root_src = pathlib.Path(f"./src/py{name:s}/include/")
root_dest = pathlib.Path(f"./src/py{name:s}/")
files = [f"{name:s}.h"]
for file in files:
src = root_src / file
dest = root_dest / file
if not src.exists():
raise ValueError(f"The library {name:s} was not installed. Run in the root folder: make install prefix=./py/src/py{name:s}")
try:
print(f"copying {str(src):s} -> {str(dest.parent):s}.")
shutil.copy(src, dest)
except:
print(f"{file:s} was not found.")
print(f"{file:s} was not copied.")

# Libs
root_src = pathlib.Path(f"./src/py{name:s}/lib/")
Expand All @@ -65,11 +65,13 @@
for file in files:
src = root_src / file
dest = root_dest / file
if not src.exists():
raise ValueError(f"The library {name:s} was not installed. Run in the root folder: make install prefix=./py/src/py{name:s}")
try:
print(f"copying {str(src):s} -> {str(dest.parent):s}.")
shutil.copy(src, dest)
except:
print(f"{file:s} was not found.")
print(f"{file:s} was not copied.")

# gfortran libs
root_src = pathlib.Path(ROOT)
Expand All @@ -88,7 +90,7 @@
except subprocess.CalledProcessError:
print(" ".join(cmd) + " was not successful.")
except:
print(f"{file:s} was not found.")
print(f"{file:s} was not copied.")

# check rpaths for Darwin
if platform.system() == "Darwin":
Expand Down

0 comments on commit 3e0c7b3

Please sign in to comment.