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