diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/boost/tools/build/example/customization/verbatim.py | |
parent | Initial commit. (diff) | |
download | ceph-upstream/18.2.2.tar.xz ceph-upstream/18.2.2.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/tools/build/example/customization/verbatim.py')
-rw-r--r-- | src/boost/tools/build/example/customization/verbatim.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/boost/tools/build/example/customization/verbatim.py b/src/boost/tools/build/example/customization/verbatim.py new file mode 100644 index 000000000..996577054 --- /dev/null +++ b/src/boost/tools/build/example/customization/verbatim.py @@ -0,0 +1,47 @@ +# Copyright 2010 Vladimir Prus +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt) + +# This file is only used with Python port of Boost.Build + +# This file shows some of the primary customization mechanisms in Boost.Build V2 +# and should serve as a basic for your own customization. +# Each part has a comment describing its purpose, and you can pick the parts +# which are relevant to your case, remove everything else, and then change names +# and actions to taste. + +# Declare a new target type. This allows Boost.Build to do something sensible +# when targets with the .verbatim extension are found in sources. +import b2.build.type as type +type.register("VERBATIM", ["verbatim"]) + +# Declare a dependency scanner for the new target type. The +# 'inline-file.py' script does not handle includes, so this is +# only for illustraction. +import b2.build.scanner as scanner; +# First, define a new class, derived from 'common-scanner', +# that class has all the interesting logic, and we only need +# to override the 'pattern' method which return regular +# expression to use when scanning. +class VerbatimScanner(scanner.CommonScanner): + + def pattern(self): + return "//###include[ ]*\"([^\"]*)\"" + +scanner.register(VerbatimScanner, ["include"]) +type.set_scanner("VERBATIM", VerbatimScanner) + +import b2.build.generators as generators + +generators.register_standard("verbatim.inline-file", + ["VERBATIM"], ["CPP"]) + +from b2.manager import get_manager + +get_manager().engine().register_action("verbatim.inline-file", +""" +./inline_file.py $(<) $(>) +""") + + + |