MCPcopy Create free account
hub / github.com/numpy/numpy / get_flags_linker_so

Method get_flags_linker_so

numpy/distutils/fcompiler/gnu.py:109–142  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

107 suggested_f90_compiler = 'gnu95'
108
109 def get_flags_linker_so(self):
110 opt = self.linker_so[1:]
111 if sys.platform == 'darwin':
112 target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', None)
113 # If MACOSX_DEPLOYMENT_TARGET is set, we simply trust the value
114 # and leave it alone. But, distutils will complain if the
115 # environment's value is different from the one in the Python
116 # Makefile used to build Python. We let distutils handle this
117 # error checking.
118 if not target:
119 # If MACOSX_DEPLOYMENT_TARGET is not set in the environment,
120 # we try to get it first from sysconfig and then
121 # fall back to setting it to 10.9 This is a reasonable default
122 # even when using the official Python dist and those derived
123 # from it.
124 import sysconfig
125 target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
126 if not target:
127 target = '10.9'
128 s = f'Env. variable MACOSX_DEPLOYMENT_TARGET set to {target}'
129 warnings.warn(s, stacklevel=2)
130 os.environ['MACOSX_DEPLOYMENT_TARGET'] = str(target)
131 opt.extend(['-undefined', 'dynamic_lookup', '-bundle'])
132 else:
133 opt.append("-shared")
134 if sys.platform.startswith('sunos'):
135 # SunOS often has dynamically loaded symbols defined in the
136 # static library libg2c.a The linker doesn't like this. To
137 # ignore the problem, use the -mimpure-text flag. It isn't
138 # the safest thing, but seems to work. 'man gcc' says:
139 # ".. Instead of using -mimpure-text, you should compile all
140 # source code with -fpic or -fPIC."
141 opt.append('-mimpure-text')
142 return opt
143
144 def get_libgcc_dir(self):
145 try:

Callers 1

get_flags_linker_soMethod · 0.45

Calls 3

warnMethod · 0.80
startswithMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected