s3:auth_sam: introduce effective_domain helper variables
[Samba.git] / pidl / wscript
blobd1b8278990a2d7f94941accb9dd8e46322d27fa7
1 #!/usr/bin/env python
3 import os, string
4 from samba_utils import MODE_755
5 from waflib import Logs
7 # This function checks if a perl module is installed on the system.
8 def check_system_perl_module(conf, module, version=None):
9 bundle_name = module.replace('::', '_')
10 module_check = module
12 # Create module string with version
13 if version:
14 module_check = module + ' ' + str(version)
16 # Check if we have to bundle it.
17 if conf.LIB_MUST_BE_BUNDLED(bundle_name.lower()):
18 return False
20 # Check for system perl module
21 if conf.check_perl_module(module_check) is None:
22 return False
24 conf.define('USING_SYSTEM_%s' % bundle_name.upper(), 1)
26 return True
28 def options(opt):
29 return
31 def configure(conf):
32 # Check if perl(Parse::Yapp::Driver) is available.
33 check_system_perl_module(conf, "Parse::Yapp::Driver", 1.05)
35 # yapp is used for building the parser
36 conf.find_program('yapp', var='YAPP')
38 def build(bld):
40 # we want to prefer the git version of the parsers if we can.
41 # Only if the source has changed do we want to re-run yapp
42 # But we force the developer to use the pidl standalone build
43 # to regenerate the files.
44 # TODO: only warn in developer mode and if 'git diff HEAD'
45 # shows a difference
46 warn_about_grammar_changes = ('PIDL_BUILD_WARNINGS' in bld.env and (
47 bld.IS_NEWER('idl.yp', 'lib/Parse/Pidl/IDL.pm') or
48 bld.IS_NEWER('expr.yp', 'lib/Parse/Pidl/Expr.pm')))
50 if warn_about_grammar_changes:
51 Logs.warn('''
52 Pidl grammar files have changed. Please use the pidl standalone build
53 to regenerate them with yapp.
55 $ cd ../pidl
56 $ perl Makefile.PL
57 $ make lib/Parse/Pidl/IDL.pm lib/Parse/Pidl/Expr.pm
58 $ git add lib/Parse/Pidl/IDL.pm lib/Parse/Pidl/Expr.pm
59 $ git commit
60 $ cd -
62 If your 100% sure you haven't changed idl.yp and expr.yp
63 try this to avoid this message:
65 $ touch ../pidl/lib/Parse/Pidl/IDL.pm ../pidl/lib/Parse/Pidl/Expr.pm
66 ''')