MCPcopy Index your code
hub / github.com/numpy/numpy / buildmodule

Function buildmodule

numpy/f2py/rules.py:1313–1512  ·  view source on GitHub ↗

Return

(m, um)

Source from the content-addressed store, hash-verified

1311
1312
1313def buildmodule(m, um):
1314 """
1315 Return
1316 """
1317 outmess(f" Building module \"{m['name']}\"...\n")
1318 ret = {}
1319 mod_rules = defmod_rules[:]
1320 vrd = capi_maps.modsign2map(m)
1321 rd = dictappend({'f2py_version': f2py_version}, vrd)
1322 funcwrappers = []
1323 funcwrappers2 = [] # F90 codes
1324 for n in m['interfaced']:
1325 nb = None
1326 for bi in m['body']:
1327 if bi['block'] not in ['interface', 'abstract interface']:
1328 errmess('buildmodule: Expected interface block. Skipping.\n')
1329 continue
1330 for b in bi['body']:
1331 if b['name'] == n:
1332 nb = b
1333 break
1334
1335 if not nb:
1336 print(
1337 f'buildmodule: Could not find the body of interfaced routine "{n}". Skipping.\n', file=sys.stderr)
1338 continue
1339 nb_list = [nb]
1340 if 'entry' in nb:
1341 for k, a in nb['entry'].items():
1342 nb1 = copy.deepcopy(nb)
1343 del nb1['entry']
1344 nb1['name'] = k
1345 nb1['args'] = a
1346 nb_list.append(nb1)
1347 for nb in nb_list:
1348 # requiresf90wrapper must be called before buildapi as it
1349 # rewrites assumed shape arrays as automatic arrays.
1350 isf90 = requiresf90wrapper(nb)
1351 # options is in scope here
1352 if options['emptygen']:
1353 b_path = options['buildpath']
1354 m_name = vrd['modulename']
1355 outmess(' Generating possibly empty wrappers"\n')
1356 Path(f"{b_path}/{vrd['coutput']}").touch()
1357 if isf90:
1358 # f77 + f90 wrappers
1359 outmess(f' Maybe empty "{m_name}-f2pywrappers2.f90"\n')
1360 Path(f'{b_path}/{m_name}-f2pywrappers2.f90').touch()
1361 outmess(f' Maybe empty "{m_name}-f2pywrappers.f"\n')
1362 Path(f'{b_path}/{m_name}-f2pywrappers.f').touch()
1363 else:
1364 # only f77 wrappers
1365 outmess(f' Maybe empty "{m_name}-f2pywrappers.f"\n')
1366 Path(f'{b_path}/{m_name}-f2pywrappers.f').touch()
1367 api, wrap = buildapi(nb)
1368 if wrap:
1369 if isf90:
1370 funcwrappers2.append(wrap)

Callers

nothing calls this directly

Calls 15

dictappendFunction · 0.85
errmessFunction · 0.85
requiresf90wrapperFunction · 0.85
buildapiFunction · 0.85
applyrulesFunction · 0.85
openFunction · 0.85
itemsMethod · 0.80
joinMethod · 0.80
replaceMethod · 0.80
splitMethod · 0.80
findMethod · 0.80
outmessFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…