• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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)
4
5# This file is only used with Python port of Boost.Build
6
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.
12
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.
15import b2.build.type as type
16type.register("VERBATIM", ["verbatim"])
17
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.
21import 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.
26class VerbatimScanner(scanner.CommonScanner):
27
28    def pattern(self):
29        return "//###include[ ]*\"([^\"]*)\""
30
31scanner.register(VerbatimScanner, ["include"])
32type.set_scanner("VERBATIM", VerbatimScanner)
33
34import b2.build.generators as generators
35
36generators.register_standard("verbatim.inline-file",
37                             ["VERBATIM"], ["CPP"])
38
39from b2.manager import get_manager
40
41get_manager().engine().register_action("verbatim.inline-file",
42"""
43./inline_file.py $(<) $(>)
44""")
45
46
47
48