selftest: test listing trusted domains that includes an NT4 domain
[vlendec/samba-autobuild/.git] / pidl / wscript
1 #!/usr/bin/env python
2
3 from waflib import Logs, Errors
4
5 # This function checks if a perl module is installed on the system.
6 def check_system_perl_module(conf, module, version=None):
7     module_check = module
8
9     # Create module string with version
10     if version:
11         module_check = module + ' ' + str(version)
12
13     # Check for system perl module
14     if conf.check_perl_module(module_check) is None:
15         return False
16
17     return True
18
19 def options(opt):
20     return
21
22 def configure(conf):
23     # Check if perl(Parse::Yapp::Driver) is available.
24     if not check_system_perl_module(conf,
25                                     "Parse::Yapp::Driver",
26                                     1.05):
27         raise Errors.WafError('perl module "Parse::Yapp::Driver" not found')
28
29     # yapp is used for building the parser
30     if not conf.find_program('yapp', var='YAPP'):
31         raise Errors.WafError('yapp not found')
32
33 def build(bld):
34
35     # we want to prefer the git version of the parsers if we can.
36     # Only if the source has changed do we want to re-run yapp
37     # But we force the developer to use the pidl standalone build
38     # to regenerate the files.
39     # TODO: only warn in developer mode and if 'git diff HEAD'
40     #       shows a difference
41     warn_about_grammar_changes = ('PIDL_BUILD_WARNINGS' in bld.env and (
42         bld.IS_NEWER('idl.yp', 'lib/Parse/Pidl/IDL.pm') or
43         bld.IS_NEWER('expr.yp', 'lib/Parse/Pidl/Expr.pm')))
44
45     if warn_about_grammar_changes:
46         Logs.warn('''
47 Pidl grammar files have changed. Please use the pidl standalone build
48 to regenerate them with yapp.
49
50 $ cd ../pidl
51 $ perl Makefile.PL
52 $ make lib/Parse/Pidl/IDL.pm lib/Parse/Pidl/Expr.pm
53 $ git add lib/Parse/Pidl/IDL.pm lib/Parse/Pidl/Expr.pm
54 $ git commit
55 $ cd -
56
57 If you're 100% sure you haven't changed idl.yp and expr.yp
58 try this to avoid this message:
59
60 $ touch ../pidl/lib/Parse/Pidl/IDL.pm ../pidl/lib/Parse/Pidl/Expr.pm
61 ''')