Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# we grafted in a bunch of libraries and modifed their sonames, but
# they may have internal dependencies (DT_NEEDED) on one another, so
# we need to update those records so each now knows about the new
# name of the other.
for old_soname, (new_soname, path) in soname_map.items():
needed = elf_read_dt_needed(path)
for n in needed:
if n in soname_map:
check_call(['patchelf', '--replace-needed', n, soname_map[n][0], path])
check_call(['patchelf', '--force-rpath', '--set-rpath', '$ORIGIN/.libs:$ORIGIN/lib', 'xacc/_pyxacc.so'])
if update_tags:
ctx.out_wheel = add_platforms(ctx, [abi],
get_replace_platforms(abi))
return ctx.out_wheel
new_rpath = os.path.relpath(dest_dir, os.path.dirname(fn))
new_rpath = os.path.join('$ORIGIN', new_rpath)
append_rpath_within_wheel(fn, new_rpath, ctx.name, patcher)
# we grafted in a bunch of libraries and modified their sonames, but
# they may have internal dependencies (DT_NEEDED) on one another, so
# we need to update those records so each now knows about the new
# name of the other.
for old_soname, (new_soname, path) in soname_map.items():
needed = elf_read_dt_needed(path)
for n in needed:
if n in soname_map:
patcher.replace_needed(path, n, soname_map[n][0])
if update_tags:
ctx.out_wheel = add_platforms(ctx, [abi],
get_replace_platforms(abi))
return ctx.out_wheel
logger.info('%s receives the following tag: "%s".',
basename(args.WHEEL_FILE), wheel_abi.overall_tag)
logger.info('Use ``auditwheel show`` for more details')
if wheel_abi.overall_tag in in_fname_tags:
logger.info('No tags to be added. Exiting.')
return 1
# todo: move more of this logic to separate file
if not exists(args.WHEEL_DIR):
os.makedirs(args.WHEEL_DIR)
with InWheelCtx(args.WHEEL_FILE) as ctx:
try:
out_wheel = add_platforms(ctx, [wheel_abi.overall_tag])
except WheelToolsError as e:
logger.exception('\n%s.', repr(e))
return 1
if out_wheel:
# tell context manager to write wheel on exit with
# the proper output directory
ctx.out_wheel = join(args.WHEEL_DIR, basename(out_wheel))
logger.info('\nUpdated wheel written to %s', out_wheel)
return 0
@click.command()
@click.argument('wheel', type=click.Path(exists=True))
def main(wheel):
dir = os.path.dirname(os.path.abspath(wheel))
with InWheelCtx(wheel) as ctx:
try:
new_wheel = add_platforms(ctx, ['manylinux1_x86_64'], remove_platforms=('linux_x86_64',))
except WheelToolsError as e:
click.echo(str(e), err=True)
raise
if new_wheel:
ctx.out_wheel = os.path.normpath(os.path.join(dir, new_wheel))
click.echo('Updated wheel written to %s' % ctx.out_wheel)