MCPcopy Create free account
hub / github.com/catboost/catboost / build

Function build

catboost/python-package/mk_wheel.py:343–379  ·  view source on GitHub ↗
(build_system, arc_root, out_root, tail_args, should_build_widget, should_build_with_cuda)

Source from the content-addressed store, hash-verified

341
342
343def build(build_system, arc_root, out_root, tail_args, should_build_widget, should_build_with_cuda):
344 os.chdir(os.path.join(arc_root, 'catboost', 'python-package', 'catboost'))
345
346 py_trait = PythonTrait(build_system, arc_root, out_root, tail_args)
347 ver = get_version(os.path.join(os.getcwd(), 'version.py'))
348 pkg_name = os.environ.get('CATBOOST_PACKAGE_NAME', 'catboost')
349
350 for task_type in (['GPU', 'CPU'] if should_build_with_cuda else ['CPU']):
351 try:
352 print('Trying to build {} version'.format(task_type), file=sys.stderr)
353
354 dst_so_modules = {}
355 for module_name, arc_path, dst_subdir in (
356 ('_catboost', os.path.join('catboost', 'python-package', 'catboost'), ''),
357 ('_hnsw', os.path.join('library', 'python', 'hnsw', 'hnsw'), 'hnsw')
358 ):
359 print('Trying to build {} native library'.format(module_name), file=sys.stderr)
360
361 cmd = py_trait.gen_cmd(arc_path, module_name, task_type)
362 print(' '.join(cmd), file=sys.stderr)
363 subprocess.check_call(cmd)
364 print('Build {} native library: OK'.format(module_name), file=sys.stderr)
365 src = os.path.join(py_trait.out_root, arc_path, py_trait.built_so_name(module_name))
366 dst = '.'.join([src, task_type])
367 shutil.move(src, dst)
368 dst_so_modules[module_name] = (dst, dst_subdir)
369
370 print('Build {} version: OK'.format(task_type), file=sys.stderr)
371 if should_build_widget:
372 build_widget(arc_root)
373 wheel_name = os.path.join(py_trait.arc_root, 'catboost', 'python-package',
374 '{}-{}-{}-none-{}.whl'.format(pkg_name, ver, py_trait.lang, py_trait.platform_tag_string))
375 make_wheel(wheel_name, pkg_name, ver, build_system, arc_root, dst_so_modules, should_build_widget)
376 return wheel_name
377 except Exception as e:
378 print('{} version build failed: {}'.format(task_type, e), file=sys.stderr)
379 raise Exception('Nothing built')
380
381
382if __name__ == '__main__':

Callers 1

mk_wheel.pyFile · 0.70

Calls 11

gen_cmdMethod · 0.95
built_so_nameMethod · 0.95
PythonTraitClass · 0.85
get_versionFunction · 0.85
make_wheelFunction · 0.85
build_widgetFunction · 0.70
printFunction · 0.50
joinMethod · 0.45
getMethod · 0.45
formatMethod · 0.45
moveMethod · 0.45

Tested by

no test coverage detected