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

Function buildmodule

numpy/f2py/rules.py:1241–1442  ·  view source on GitHub ↗

Return

(m, um)

Source from the content-addressed store, hash-verified

1239
1240
1241def buildmodule(m, um):
1242 """
1243 Return
1244 """
1245 outmess(' Building module "%s"...\n' % (m['name']))
1246 ret = {}
1247 mod_rules = defmod_rules[:]
1248 vrd = capi_maps.modsign2map(m)
1249 rd = dictappend({'f2py_version': f2py_version}, vrd)
1250 funcwrappers = []
1251 funcwrappers2 = [] # F90 codes
1252 for n in m['interfaced']:
1253 nb = None
1254 for bi in m['body']:
1255 if bi['block'] not in ['interface', 'abstract interface']:
1256 errmess('buildmodule: Expected interface block. Skipping.\n')
1257 continue
1258 for b in bi['body']:
1259 if b['name'] == n:
1260 nb = b
1261 break
1262
1263 if not nb:
1264 print(
1265 'buildmodule: Could not find the body of interfaced routine "%s". Skipping.\n' % (n), file=sys.stderr)
1266 continue
1267 nb_list = [nb]
1268 if 'entry' in nb:
1269 for k, a in nb['entry'].items():
1270 nb1 = copy.deepcopy(nb)
1271 del nb1['entry']
1272 nb1['name'] = k
1273 nb1['args'] = a
1274 nb_list.append(nb1)
1275 for nb in nb_list:
1276 # requiresf90wrapper must be called before buildapi as it
1277 # rewrites assumed shape arrays as automatic arrays.
1278 isf90 = requiresf90wrapper(nb)
1279 # options is in scope here
1280 if options['emptygen']:
1281 b_path = options['buildpath']
1282 m_name = vrd['modulename']
1283 outmess(' Generating possibly empty wrappers"\n')
1284 Path(f"{b_path}/{vrd['coutput']}").touch()
1285 if isf90:
1286 # f77 + f90 wrappers
1287 outmess(f' Maybe empty "{m_name}-f2pywrappers2.f90"\n')
1288 Path(f'{b_path}/{m_name}-f2pywrappers2.f90').touch()
1289 outmess(f' Maybe empty "{m_name}-f2pywrappers.f"\n')
1290 Path(f'{b_path}/{m_name}-f2pywrappers.f').touch()
1291 else:
1292 # only f77 wrappers
1293 outmess(f' Maybe empty "{m_name}-f2pywrappers.f"\n')
1294 Path(f'{b_path}/{m_name}-f2pywrappers.f').touch()
1295 api, wrap = buildapi(nb)
1296 if wrap:
1297 if isf90:
1298 funcwrappers2.append(wrap)

Callers

nothing calls this directly

Calls 14

dictappendFunction · 0.85
printFunction · 0.85
requiresf90wrapperFunction · 0.85
buildapiFunction · 0.85
applyrulesFunction · 0.85
openFunction · 0.85
valuesMethod · 0.80
keysMethod · 0.80
replaceMethod · 0.80
findMethod · 0.80
outmessFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected