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

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMartin Hořeňovský2018-01-18 16:28:19 +0100
committerMartin Hořeňovský2018-01-18 16:28:19 +0100
commit15ad95c8dba8ebdc4da08fb3404df66fdff54c52 (patch)
tree621c57f1e00ceb3ee460c9af64a464a1053c4f78
parent00a10d5a5e76ae8d733d8a555b269ba5f66a0e96 (diff)
downloadcatch3-15ad95c8dba8ebdc4da08fb3404df66fdff54c52.tar.gz
Make generateSingleHeader compatible with Python 2.7
-rwxr-xr-xscripts/generateSingleHeader.py31
1 files changed, 16 insertions, 15 deletions
diff --git a/scripts/generateSingleHeader.py b/scripts/generateSingleHeader.py
index 04eaf46c..633e8c12 100755
--- a/scripts/generateSingleHeader.py
+++ b/scripts/generateSingleHeader.py
@@ -3,6 +3,7 @@
from __future__ import print_function
import os
+import io
import sys
import re
import datetime
@@ -46,11 +47,11 @@ def generate(v):
outDir = os.path.dirname(outputPath)
if not os.path.exists(outDir):
os.makedirs(outDir)
- out = open( outputPath, 'w', newline='\n' )
+ out = io.open( outputPath, 'w', newline='\n')
def write( line ):
if globals['includeImpl'] or globals['implIfDefs'] == -1:
- out.write( line )
+ out.write( line.decode('utf-8') )
def insertCpps():
dirs = [os.path.join( rootPath, s) for s in ['', 'internal', 'reporters']]
@@ -104,22 +105,22 @@ def generate(v):
write( '// end {}\n'.format(filename) )
- out.write( "/*\n" )
- out.write( " * Catch v{0}\n".format( v.getVersionString() ) )
- out.write( " * Generated: {0}\n".format( datetime.datetime.now() ) )
- out.write( " * ----------------------------------------------------------\n" )
- out.write( " * This file has been merged from multiple headers. Please don't edit it directly\n" )
- out.write( " * Copyright (c) {} Two Blue Cubes Ltd. All rights reserved.\n".format( datetime.date.today().year ) )
- out.write( " *\n" )
- out.write( " * Distributed under the Boost Software License, Version 1.0. (See accompanying\n" )
- out.write( " * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n" )
- out.write( " */\n" )
- out.write( "#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
- out.write( "#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
+ 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" )
parseFile( rootPath, 'catch.hpp' )
- out.write( "#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n\n" )
+ write( "#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n\n" )
out.close()
print ("Generated single include for Catch v{0}\n".format( v.getVersionString() ) )