Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorMartin Hořeňovský2018-04-19 22:03:25 +0200
committerMartin Hořeňovský2018-04-19 22:03:25 +0200
commitaa7b0c91044ec61c1fd594ed057b2dedf8d2555c (patch)
treec692630d15ba01bb997058fd76eca354e6793256 /scripts
parent375f2052bde3236953905021a52eabe073dac0a6 (diff)
downloadcatch3-aa7b0c91044ec61c1fd594ed057b2dedf8d2555c.tar.gz
Fix generating single header using Python3
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/generateSingleHeader.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/scripts/generateSingleHeader.py b/scripts/generateSingleHeader.py
index 633e8c12..471b872e 100755
--- a/scripts/generateSingleHeader.py
+++ b/scripts/generateSingleHeader.py
@@ -51,7 +51,7 @@ def generate(v):
def write( line ):
if globals['includeImpl'] or globals['implIfDefs'] == -1:
- out.write( line.decode('utf-8') )
+ out.write( line )
def insertCpps():
dirs = [os.path.join( rootPath, s) for s in ['', 'internal', 'reporters']]
@@ -65,9 +65,9 @@ def generate(v):
parseFile(dir, name)
def parseFile( path, filename ):
- f = open( os.path.join(path, filename), 'r' )
+ f = io.open( os.path.join(path, filename), 'r', encoding='utf-8' )
blanks = 0
- write( "// start {0}\n".format( filename ) )
+ write( u"// start {0}\n".format( filename ) )
for line in f:
if '// ~*~* CATCH_CPP_STITCH_PLACE *~*~' in line:
insertCpps()
@@ -102,25 +102,25 @@ def generate(v):
blanks = 0
if blanks < 2 and not defineParser.match(line):
write( line.rstrip() + "\n" )
- write( '// end {}\n'.format(filename) )
-
-
- write( "/*\n" )
- write( " * Catch v{0}\n".format( v.getVersionString() ) )
- write( " * Generated: {0}\n".format( datetime.datetime.now() ) )
- write( " * ----------------------------------------------------------\n" )
- write( " * This file has been merged from multiple headers. Please don't edit it directly\n" )
- write( " * Copyright (c) {} Two Blue Cubes Ltd. All rights reserved.\n".format( datetime.date.today().year ) )
- write( " *\n" )
- write( " * Distributed under the Boost Software License, Version 1.0. (See accompanying\n" )
- write( " * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n" )
- write( " */\n" )
- write( "#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
- write( "#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
+ write( u'// end {}\n'.format(filename) )
+
+
+ write( u"/*\n" )
+ write( u" * Catch v{0}\n".format( v.getVersionString() ) )
+ write( u" * Generated: {0}\n".format( datetime.datetime.now() ) )
+ write( u" * ----------------------------------------------------------\n" )
+ write( u" * This file has been merged from multiple headers. Please don't edit it directly\n" )
+ write( u" * Copyright (c) {} Two Blue Cubes Ltd. All rights reserved.\n".format( datetime.date.today().year ) )
+ write( u" *\n" )
+ write( u" * Distributed under the Boost Software License, Version 1.0. (See accompanying\n" )
+ write( u" * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n" )
+ write( u" */\n" )
+ write( u"#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
+ write( u"#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
parseFile( rootPath, 'catch.hpp' )
- write( "#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n\n" )
+ write( u"#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n\n" )
out.close()
print ("Generated single include for Catch v{0}\n".format( v.getVersionString() ) )