diff options
Diffstat (limited to 'win/wb.py')
-rw-r--r-- | win/wb.py | 44 |
1 files changed, 25 insertions, 19 deletions
@@ -101,20 +101,28 @@ def parse_build_params(kv, settings_in): kv[g[0]] = g[1] or '' f.close() +def dict_def(dict, newdefs): + ret = dict.copy() + ret.update(newdefs) + return ret -def dict_def(dict, newdefs):
- ret = dict.copy()
- ret.update(newdefs)
- return ret
-
-def build_autodefs(kv, autodefs_in, autodefs_out):
+def build_autodefs(kv, autodefs_in, autodefs_out): preprocess(kv,
- in_fn=autodefs_in,
- out_fn=autodefs_out,
- quote_begin='@',
- quote_end='@',
- head_comment='/* %s */\n\n' % autogen)
-
+ in_fn=autodefs_in, + out_fn=autodefs_out, + quote_begin='@', + quote_end='@', + head_comment='/* %s */\n\n' % autogen) + +def build_config_h(kv): + """Generate static win/config.h to config.h to mimic autotools behavior""" + preprocess(kv, + in_fn=mod_fn('config.h.in'), + out_fn=home_fn('config.h'), + quote_begin='@', + quote_end='@', + head_comment='/* %s */\n\n' % autogen) + def build_configure_h(kv, configure_h_out, head_comment): """Generate a configure.h dynamically""" fout = open(configure_h_out, 'w') @@ -163,14 +171,12 @@ win/settings.in format. This done to allow importing them in win/openvpn.nsi""" fout.close() +def preprocess(kv, in_fn, out_fn, quote_begin=None, quote_end=None, if_prefix=None, head_comment=None): + def repfn(m): + var, = m.groups() + return kv.get(var, '') - -def preprocess(kv, in_fn, out_fn, quote_begin=None, quote_end=None, if_prefix=None, head_comment=None):
- def repfn(m):
- var, = m.groups()
- return kv.get(var, '')
-
- re_macro = re_ifdef = None
+ re_macro = re_ifdef = None if quote_begin and quote_end:
re_macro = re.compile(r'%s(\w+)%s' % (re.escape(quote_begin), re.escape(quote_end)))
|