aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-12-04 05:11:29 -0500
committerJack Lloyd <[email protected]>2017-12-04 05:11:29 -0500
commitdeed48efb1a1c3c66aead08b0a49124b94aba7d8 (patch)
tree225e4ddc4a4e1cd9fe46a84c78be00bbe88c2d74 /src/scripts
parentb236a8aa0803bac4fba3c1de840379fb01f54ca1 (diff)
Cleanup install target
There is no reason to process template language in here, all we need to do is look up values in the build JSON.
Diffstat (limited to 'src/scripts')
-rwxr-xr-xsrc/scripts/install.py39
1 files changed, 10 insertions, 29 deletions
diff --git a/src/scripts/install.py b/src/scripts/install.py
index 7a5659b47..c6e4ec2cd 100755
--- a/src/scripts/install.py
+++ b/src/scripts/install.py
@@ -14,7 +14,6 @@ import logging
import optparse # pylint: disable=deprecated-module
import os
import shutil
-import string
import sys
import subprocess
@@ -148,24 +147,13 @@ def main(args):
with open(os.path.join(options.build_dir, 'build_config.json')) as f:
cfg = json.load(f)
- def process_template(template_str):
- class PercentSignTemplate(string.Template):
- delimiter = '%'
-
- try:
- template = PercentSignTemplate(template_str)
- return template.substitute(cfg)
- except KeyError as e:
- raise Exception('Unbound var %s in template' % (e))
- except Exception as e:
- raise Exception('Exception %s in template' % (e))
-
ver_major = int(cfg['version_major'])
ver_minor = int(cfg['version_minor'])
ver_patch = int(cfg['version_patch'])
target_os = cfg['os']
build_shared_lib = bool(cfg['build_shared_lib'])
build_static_lib = bool(cfg['build_static_lib'])
+ out_dir = cfg['out_dir']
bin_dir = os.path.join(options.prefix, options.bindir)
lib_dir = os.path.join(options.prefix, options.libdir)
@@ -174,12 +162,6 @@ def main(args):
'botan-%d' % (ver_major),
'botan')
- out_dir = process_template('%{out_dir}')
- if target_os == "windows":
- app_exe = 'botan-cli.exe'
- else:
- app_exe = process_template('botan%{program_suffix}')
-
for d in [options.prefix, lib_dir, bin_dir, target_include_dir]:
makedirs(prepend_destdir(d))
@@ -197,21 +179,21 @@ def main(args):
copy_file(os.path.join(build_external_include_dir, include),
prepend_destdir(os.path.join(target_include_dir, include)))
- if build_static_lib:
- static_lib = process_template('%{lib_prefix}%{libname}.%{static_suffix}')
+ if build_static_lib or target_os == 'windows':
+ static_lib = cfg['static_lib_name']
copy_file(os.path.join(out_dir, static_lib),
prepend_destdir(os.path.join(lib_dir, os.path.basename(static_lib))))
if build_shared_lib:
if target_os == "windows":
- libname = process_template('%{libname}')
+ libname = cfg['libname']
soname_base = libname + '.dll'
copy_executable(os.path.join(out_dir, soname_base),
prepend_destdir(os.path.join(lib_dir, soname_base)))
else:
- soname_patch = process_template('%{soname_patch}')
- soname_abi = process_template('%{soname_abi}')
- soname_base = process_template('%{soname_base}')
+ soname_patch = cfg['soname_patch']
+ soname_abi = cfg['soname_abi']
+ soname_base = cfg['soname_base']
copy_executable(os.path.join(out_dir, soname_patch),
prepend_destdir(os.path.join(lib_dir, soname_patch)))
@@ -225,8 +207,7 @@ def main(args):
finally:
os.chdir(prev_cwd)
- copy_executable(os.path.join(out_dir, app_exe),
- prepend_destdir(os.path.join(bin_dir, app_exe)))
+ copy_executable(cfg['cli_exe'], prepend_destdir(os.path.join(bin_dir, cfg['cli_exe_name'])))
# On Darwin, if we are using shared libraries and we install, we should fix
# up the library name, otherwise the botan command won't work; ironically
@@ -234,13 +215,13 @@ def main(args):
# that would be correct for installation to one that lets us run it from
# the build directory
if target_os == 'darwin' and build_shared_lib:
- soname_abi = process_template('%{soname_abi}')
+ soname_abi = cfg['soname_abi']
subprocess.check_call(['install_name_tool',
'-change',
os.path.join('@executable_path', soname_abi),
os.path.join(lib_dir, soname_abi),
- os.path.join(bin_dir, app_exe)])
+ os.path.join(bin_dir, cfg['cli_exe_name'])])
if 'botan_pkgconfig' in cfg:
pkgconfig_dir = os.path.join(options.prefix, options.libdir, options.pkgconfigdir)