Portability fixes to preprocess.py et al. (thanks to Larry Evans!)

[SVN r31189]
This commit is contained in:
Aleksey Gurtovoy 2005-10-04 08:35:29 +00:00
parent af51dfffc2
commit 9884799fe1
3 changed files with 18 additions and 8 deletions

View File

@ -247,9 +247,10 @@ class pretty:
self.output.write(line)
self.prev_line = line
def main():
p = pretty(os.path.basename(sys.argv[2]))
for line in fileinput.input(sys.argv[1]):
def main( src, dest ):
p = pretty( os.path.basename( dest ) )
for line in fileinput.input( src ):
p.process(line)
main()
if __name__ == '__main__':
main( sys.argv[1], sys.argv[2] )

View File

@ -1 +1 @@
gcc -E -C -P -I%1 "-D BOOST_USER_CONFIG=<%1/libs/mpl/preprocessed/include/%2/user.hpp>" -D BOOST_MPL_CFG_NO_OWN_PP_PRIMITIVES %3 >%4
gcc -E -C -P "-I%(boost_root)s" "-D BOOST_USER_CONFIG=<%(boost_root)s/libs/mpl/preprocessed/include/%(mode)s/user.hpp>" -D BOOST_MPL_CFG_NO_OWN_PP_PRIMITIVES %(file)s >"%(file_path)s"

View File

@ -11,17 +11,26 @@
# $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.system( "preprocess %s %s %s %s" % ( boost_root, mode, file, file_path ) )
os.rename( file_path, "%s.tmp" % file_path )
os.system( "python pp.py %s.tmp %s" % ( file_path, file_path ) )
pp.main( "%s.tmp" % file_path, file_path )
os.remove( "%s.tmp" % file_path )
filename = os.path.basename(file_path)
@ -75,5 +84,5 @@ if __name__ == '__main__':
main(
["bcc", "bcc551", "gcc", "msvc60", "msvc70", "mwcw", "dmc", "no_ctps", "no_ttp", "plain"]
, "src"
, "boost\\mpl\\aux_\\preprocessed"
, os.path.join( "boost", "mpl", "aux_", "preprocessed" )
)