]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/example/customization/verbatim.py
1 # Copyright 2010 Vladimir Prus
2 # Distributed under the Boost Software License, Version 1.0.
3 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
5 # This file is only used with Python port of Boost.Build
7 # This file shows some of the primary customization mechanisms in Boost.Build V2
8 # and should serve as a basic for your own customization.
9 # Each part has a comment describing its purpose, and you can pick the parts
10 # which are relevant to your case, remove everything else, and then change names
11 # and actions to taste.
13 # Declare a new target type. This allows Boost.Build to do something sensible
14 # when targets with the .verbatim extension are found in sources.
15 import b2
.build
.type as type
16 type.register("VERBATIM", ["verbatim"])
18 # Declare a dependency scanner for the new target type. The
19 # 'inline-file.py' script does not handle includes, so this is
20 # only for illustraction.
21 import b2
.build
.scanner
as scanner
;
22 # First, define a new class, derived from 'common-scanner',
23 # that class has all the interesting logic, and we only need
24 # to override the 'pattern' method which return regular
25 # expression to use when scanning.
26 class VerbatimScanner(scanner
.CommonScanner
):
29 return "//###include[ ]*\"([^\"]*)\""
31 scanner
.register(VerbatimScanner
, ["include"])
32 type.set_scanner("VERBATIM", VerbatimScanner
)
34 import b2
.build
.generators
as generators
36 generators
.register_standard("verbatim.inline-file",
37 ["VERBATIM"], ["CPP"])
39 from b2
.manager
import get_manager
41 get_manager().engine().register_action("verbatim.inline-file",
43 ./inline_file.py $(<) $(>)