From ca6673100a869b4ce83fdc58745839df77f270ea Mon Sep 17 00:00:00 2001 From: EGuesnet <51407514+EGuesnet@users.noreply.github.com> Date: Tue, 30 Jun 2020 16:17:13 +0200 Subject: [PATCH 1/3] ENH: Add RPATH support for AIX --- numpy/distutils/fcompiler/gnu.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/numpy/distutils/fcompiler/gnu.py b/numpy/distutils/fcompiler/gnu.py index 23d905393b59..e2432497f975 100644 --- a/numpy/distutils/fcompiler/gnu.py +++ b/numpy/distutils/fcompiler/gnu.py @@ -253,14 +253,23 @@ def get_flags_arch(self): return [] def runtime_library_dir_option(self, dir): - if sys.platform[:3] == 'aix' or sys.platform == 'win32': - # Linux/Solaris/Unix support RPATH, Windows and AIX do not + if sys.platform == 'win32': + # Linux/Solaris/Unix support RPATH, Windows does not raise NotImplementedError # TODO: could use -Xlinker here, if it's supported assert "," not in dir - sep = ',' if sys.platform == 'darwin' else '=' + if sys.platform == 'darwin': + sep = ',' + elif sys.platform[:3] == 'aix': + sep = ":" + else: + sep = '=' + + # AIX RPATH is called LIBPATH + if sys.platform[:3] == 'aix': + return '-Wl,-blibpath%s%s' % (sep, dir) return '-Wl,-rpath%s%s' % (sep, dir) From 51f52db562a40cfe6462f392aa0fa08de6fdc350 Mon Sep 17 00:00:00 2001 From: EGuesnet Date: Wed, 1 Jul 2020 14:33:59 +0200 Subject: [PATCH 2/3] ENH: Rewrite function returning RPATH --- numpy/distutils/fcompiler/gnu.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/numpy/distutils/fcompiler/gnu.py b/numpy/distutils/fcompiler/gnu.py index e2432497f975..219289becc43 100644 --- a/numpy/distutils/fcompiler/gnu.py +++ b/numpy/distutils/fcompiler/gnu.py @@ -261,16 +261,12 @@ def runtime_library_dir_option(self, dir): assert "," not in dir if sys.platform == 'darwin': - sep = ',' + return '-Wl,-rpath,%s' % dir elif sys.platform[:3] == 'aix': - sep = ":" + # AIX RPATH is called LIBPATH + return '-Wl,-blibpath:%s' % dir else: - sep = '=' - - # AIX RPATH is called LIBPATH - if sys.platform[:3] == 'aix': - return '-Wl,-blibpath%s%s' % (sep, dir) - return '-Wl,-rpath%s%s' % (sep, dir) + return '-Wl,-rpath=%s' % dir class Gnu95FCompiler(GnuFCompiler): From 78ec53b2db96553bf3d1938255e856800a016204 Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Tue, 7 Jul 2020 17:34:34 -0600 Subject: [PATCH 3/3] MAINT: Use f-strings for clarity. --- numpy/distutils/fcompiler/gnu.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/numpy/distutils/fcompiler/gnu.py b/numpy/distutils/fcompiler/gnu.py index 219289becc43..caa08549e265 100644 --- a/numpy/distutils/fcompiler/gnu.py +++ b/numpy/distutils/fcompiler/gnu.py @@ -261,12 +261,12 @@ def runtime_library_dir_option(self, dir): assert "," not in dir if sys.platform == 'darwin': - return '-Wl,-rpath,%s' % dir + return f'-Wl,-rpath,{dir}' elif sys.platform[:3] == 'aix': # AIX RPATH is called LIBPATH - return '-Wl,-blibpath:%s' % dir + return f'-Wl,-blibpath:{dir}' else: - return '-Wl,-rpath=%s' % dir + return f'-Wl,-rpath={dir}' class Gnu95FCompiler(GnuFCompiler):