summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/mpl/preprocessed/preprocess.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/mpl/preprocessed/preprocess.py
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/mpl/preprocessed/preprocess.py')
-rw-r--r--src/boost/libs/mpl/preprocessed/preprocess.py88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/boost/libs/mpl/preprocessed/preprocess.py b/src/boost/libs/mpl/preprocessed/preprocess.py
new file mode 100644
index 00000000..0c38eb06
--- /dev/null
+++ b/src/boost/libs/mpl/preprocessed/preprocess.py
@@ -0,0 +1,88 @@
+
+# Copyright Aleksey Gurtovoy 2001-2004
+#
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+#
+# See http://www.boost.org/libs/mpl for documentation.
+
+# $Id$
+# $Date$
+# $Revision$
+
+import pp
+import shutil
+import os.path
+import os
+import string
+import sys
+
+preprocess_cmd = open( "preprocess.cmd" ).readlines()[0]
+
+def process( file, boost_root, dst_dir, mode ):
+ file_path = "%s.hpp" % os.path.splitext( file )[0]
+ os.system( preprocess_cmd % {
+ 'boost_root': boost_root
+ , 'mode': mode
+ , 'file': file
+ , 'file_path': file_path
+ } )
+
+ os.rename( file_path, "%s.tmp" % file_path )
+ pp.main( "%s.tmp" % file_path, file_path )
+ os.remove( "%s.tmp" % file_path )
+
+ filename = os.path.basename(file_path)
+ dst_dir = os.path.join( dst_dir, mode )
+ dst_file = os.path.join( dst_dir, filename )
+
+ if os.path.exists( dst_file ):
+ shutil.copymode( filename, dst_file )
+
+ shutil.copy( filename, dst_dir )
+ os.remove( filename )
+
+
+def process_all( root, boost_root, dst_dir, mode ):
+ files = os.listdir( root )
+ for file in files:
+ path = os.path.join( root, file )
+ if os.path.splitext( file )[1] == ".cpp":
+ process( path, boost_root, dst_dir, mode )
+ else:
+ if os.path.isdir( path ):
+ process_all( path, boost_root, dst_dir, mode )
+
+
+def main( all_modes, src_dir, dst_dir ):
+ if len( sys.argv ) < 2:
+ print "\nUsage:\n\t %s <mode> <boost_root> [<source_file>]" % os.path.basename( sys.argv[0] )
+ print "\nPurpose:\n\t updates preprocessed version(s) of the header(s) in \"%s\" directory" % dst_dir
+ print "\nExample:\n\t the following command will re-generate and update all 'apply.hpp' headers:"
+ print "\n\t\t %s all f:\\cvs\\boost apply.cpp" % os.path.basename( sys.argv[0] )
+ sys.exit( -1 )
+
+ if sys.argv[1] == "all":
+ modes = all_modes
+ else:
+ modes = [sys.argv[1]]
+
+ boost_root = sys.argv[2]
+ dst_dir = os.path.join( boost_root, dst_dir )
+
+ for mode in modes:
+ if len( sys.argv ) > 3:
+ file = os.path.join( os.path.join( os.getcwd(), src_dir ), sys.argv[3] )
+ process( file, boost_root, dst_dir, mode )
+ else:
+ process_all( os.path.join( os.getcwd(), src_dir ), boost_root, dst_dir, mode )
+
+
+if __name__ == '__main__':
+
+ main(
+ ["bcc", "bcc551", "gcc", "mwcw", "dmc", "no_ttp", "plain"]
+ , "src"
+ , os.path.join( "boost", "mpl", "aux_", "preprocessed" )
+ )