aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts/install.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/scripts/install.py')
-rwxr-xr-xsrc/scripts/install.py42
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)