smbd: rename change_to_user() to change_to_user_and_service()
[Samba.git] / pidl / wscript
blob01b71bd8b275d66d6ac86487f61cdd5533569648
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')
37 conf.find_program('pod2man', var='POD2MAN')
39 def build(bld):
41 # we want to prefer the git version of the parsers if we can.
42 # Only if the source has changed do we want to re-run yapp
43 # But we force the developer to use the pidl standalone build
44 # to regenerate the files.
45 # TODO: only warn in developer mode and if 'git diff HEAD'
46 # shows a difference
47 warn_about_grammar_changes = ('PIDL_BUILD_WARNINGS' in bld.env and (
48 bld.IS_NEWER('idl.yp', 'lib/Parse/Pidl/IDL.pm') or
49 bld.IS_NEWER('expr.yp', 'lib/Parse/Pidl/Expr.pm')))
51 if warn_about_grammar_changes:
52 Logs.warn('''
53 Pidl grammar files have changed. Please use the pidl standalone build
54 to regenerate them with yapp.
56 $ cd ../pidl
57 $ perl Makefile.PL
58 $ make lib/Parse/Pidl/IDL.pm lib/Parse/Pidl/Expr.pm
59 $ git add lib/Parse/Pidl/IDL.pm lib/Parse/Pidl/Expr.pm
60 $ git commit
61 $ cd -
63 If your 100% sure you haven't changed idl.yp and expr.yp
64 try this to avoid this message:
66 $ touch ../pidl/lib/Parse/Pidl/IDL.pm ../pidl/lib/Parse/Pidl/Expr.pm
67 ''')