Skip to content

Commit

Permalink
Cleanup of setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
EricEngle-NOAA committed Aug 1, 2024
1 parent 27e8c7a commit 40b22a6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
import sys

def get_version():
"""Get version string"""
with open("VERSION","rt") as f:
ver = f.readline().strip()
return ver

def find_library(name, dirs=None, static=False):
"""Find library"""
_libext_by_platform = {"linux": ".so", "darwin": ".dylib", "win32": ".dll"}
out = []

Expand Down Expand Up @@ -48,31 +50,36 @@ def find_library(name, dirs=None, static=False):
return out[0].absolute().resolve().as_posix()

def run_ar_command(filename):
"""Run the ar command"""
cmd = subprocess.run(['ar','-t',filename],
stdout=subprocess.PIPE)
cmdout = cmd.stdout.decode('utf-8')
return cmdout

def run_nm_command(filename):
"""Run the nm command"""
cmd = subprocess.run(['nm','-C',filename],
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL)
cmdout = cmd.stdout.decode('utf-8')
return cmdout

def run_ldd_command(filename):
"""Run the ldd command"""
cmd = subprocess.run(['ldd',filename],
stdout=subprocess.PIPE)
cmdout = cmd.stdout.decode('utf-8')
return cmdout

def run_otool_command(filename):
"""Run the otool command"""
cmd = subprocess.run(['otool','-L',filename],
stdout=subprocess.PIPE)
cmdout = cmd.stdout.decode('utf-8')
return cmdout

def check_for_openmp(ip_lib, static_lib=False):
"""Check for OpenMP"""
check = False
info = ""
libname = ""
Expand Down Expand Up @@ -102,6 +109,7 @@ def check_for_openmp(ip_lib, static_lib=False):
return check, libname

def check_for_sp(ip_lib, static_lib=False):
"""Check for NCEPLIBS-sp"""
check = False
info = ""
if static_lib:
Expand All @@ -117,7 +125,6 @@ def check_for_sp(ip_lib, static_lib=False):
if 'libsp_4' in info: check=True
return check


# ----------------------------------------------------------------------------------------
# Main part of script
# ----------------------------------------------------------------------------------------
Expand Down

0 comments on commit 40b22a6

Please sign in to comment.