Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def build_module(module_data):
build_path = tempfile.mkdtemp()
full_module_name = module_data['fullname']
filepath = module_data['filepath']
cfg = module_data['cfg']
module_data['abs_include_dirs'] = [
make_absolute(module_data['filedirname'], d)
for d in cfg.get('include_dirs', [])
] + [os.path.dirname(filepath)]
module_data['abs_library_dirs'] = [
make_absolute(module_data['filedirname'], d)
for d in cfg.get('library_dirs', [])
]
module_data['dependency_dirs'] = (
module_data['abs_include_dirs'] + [module_data['filedirname']]
)
module_data['extra_source_filepaths'] = [
make_absolute(module_data['filedirname'], s)
for s in cfg.get('sources', [])
]
ext = ImportCppExt(
os.path.dirname(filepath),
full_module_name,
language = 'c++',
sources = (
module_data['extra_source_filepaths'] +
filepath = module_data['filepath']
cfg = module_data['cfg']
module_data['abs_include_dirs'] = [
make_absolute(module_data['filedirname'], d)
for d in cfg.get('include_dirs', [])
] + [os.path.dirname(filepath)]
module_data['abs_library_dirs'] = [
make_absolute(module_data['filedirname'], d)
for d in cfg.get('library_dirs', [])
]
module_data['dependency_dirs'] = (
module_data['abs_include_dirs'] + [module_data['filedirname']]
)
module_data['extra_source_filepaths'] = [
make_absolute(module_data['filedirname'], s)
for s in cfg.get('sources', [])
]
ext = ImportCppExt(
os.path.dirname(filepath),
full_module_name,
language = 'c++',
sources = (
module_data['extra_source_filepaths'] +
[module_data['rendered_src_filepath']]
),
include_dirs = module_data['abs_include_dirs'],
extra_compile_args = cfg.get('extra_compile_args', []),
extra_link_args = cfg.get('extra_link_args', []),
library_dirs = module_data['abs_library_dirs'],
libraries = cfg.get('libraries', [])
def checksum_save(module_data):
checksum_filepath = get_checksum_filepath(module_data['filepath'])
dep_filepaths = (
[
make_absolute(module_data['filedirname'], d)
for d in module_data['cfg'].get('dependencies', [])
] +
module_data['extra_source_filepaths'] +
[module_data['filepath']]
)
cur_checksum = calc_cur_checksum(dep_filepaths, module_data)
with open(checksum_filepath, 'wb') as file:
pickle.dump((dep_filepaths, cur_checksum), file)