diff options
author | Simon Warta <[email protected]> | 2015-08-22 19:05:23 +0200 |
---|---|---|
committer | Simon Warta <[email protected]> | 2015-08-24 19:04:29 +0200 |
commit | a9be4d157cc913c9a7e93a08cc81c8a3603061b3 (patch) | |
tree | e438dfd0e38dcd43a48bd2a8cc1764227511272c /src/scripts/install.py | |
parent | ce849c364c29ce020369685ce8d221f8e67cf538 (diff) |
Add soname_pattern
Fixes #241
Diffstat (limited to 'src/scripts/install.py')
-rwxr-xr-x | src/scripts/install.py | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/src/scripts/install.py b/src/scripts/install.py index d3fb7c124..2c69213e5 100755 --- a/src/scripts/install.py +++ b/src/scripts/install.py @@ -69,6 +69,15 @@ def makedirs(dirname, exist_ok = True): if e.errno != errno.EEXIST or not exist_ok: raise e +# Clear link and create new one +def force_symlink(target, linkname): + try: + os.unlink(linkname) + except OSError as e: + if e.errno != errno.ENOENT: + raise e + os.symlink(target, linkname) + def main(args = None): if args is None: args = sys.argv @@ -143,36 +152,23 @@ def main(args = None): if bool(cfg['build_shared_lib']): if str(cfg['os']) == "windows": - shared_lib = process_template('%{lib_prefix}%{libname}.%{so_suffix}') # botan.dll - copy_executable(os.path.join(out_dir, shared_lib), - os.path.join(lib_dir, os.path.basename(shared_lib))) + soname_base = process_template('%{soname_base}') # botan.dll + copy_executable(os.path.join(out_dir, soname_base), + os.path.join(lib_dir, soname_base)) else: - shared_lib = process_template('%{lib_prefix}%{libname}.%{so_suffix}.%{so_abi_rev}.%{version_patch}') - soname = process_template('%{lib_prefix}%{libname}.%{so_suffix}.%{so_abi_rev}') - baselib = process_template('%{lib_prefix}%{libname}.%{so_suffix}') + soname_patch = process_template('%{soname_patch}') + soname_abi = process_template('%{soname_abi}') + soname_base = process_template('%{soname_base}') - copy_executable(os.path.join(out_dir, shared_lib), - os.path.join(lib_dir, os.path.basename(shared_lib))) + copy_executable(os.path.join(out_dir, soname_patch), + os.path.join(lib_dir, soname_patch)) prev_cwd = os.getcwd() try: os.chdir(lib_dir) - - try: - os.unlink(soname) - except OSError as e: - if e.errno != errno.ENOENT: - raise e - - try: - os.unlink(baselib) - except OSError as e: - if e.errno != errno.ENOENT: - raise e - - os.symlink(shared_lib, soname) - os.symlink(soname, baselib) + force_symlink(soname_patch, soname_abi) + force_symlink(soname_patch, soname_base) finally: os.chdir(prev_cwd) |