From 5083a3c68362caf05d3c70456a0c4ff3f677cc52 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 5 Dec 2020 12:39:33 +0200 Subject: [PATCH] build script: extract base target class --- build.py | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/build.py b/build.py index f185972c..0ecc0023 100755 --- a/build.py +++ b/build.py @@ -46,23 +46,41 @@ class CommandLineOptions(dict): return result -class Target: +class BaseTarget: def __init__(self, name=None): self.name = name - self.src_root = '' - self.prefix = None - self.environment = os.environ - self.options = CommandLineOptions() def prepare_source(self, builder: 'Builder'): pass def initialize(self, builder: 'Builder'): - self.prefix = builder.deps_path + self.name + pass def detect(self, builder: 'Builder') -> bool: return False + def configure(self, builder: 'Builder'): + pass + + def build(self, builder: 'Builder'): + pass + + def post_build(self, builder: 'Builder'): + pass + + +class Target(BaseTarget): + def __init__(self, name=None): + super().__init__(name) + + self.src_root = '' + self.prefix = None + self.environment = os.environ + self.options = CommandLineOptions() + + def initialize(self, builder: 'Builder'): + self.prefix = builder.deps_path + self.name + def configure(self, builder: 'Builder'): os.makedirs(builder.build_path, exist_ok=True) @@ -71,12 +89,6 @@ class Target: + os.pathsep + builder.bin_path self.environment['PKG_CONFIG_PATH'] = builder.lib_path + 'pkgconfig' - def build(self, builder: 'Builder'): - pass - - def post_build(self, builder: 'Builder'): - pass - def install(self, builder: 'Builder', options: 'CommandLineOptions' = None): if builder.xcode: return