mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-30 19:57:10 +01:00 
			
		
		
		
	Fix generating single header using Python3
This commit is contained in:
		| @@ -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( u'// 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"/*\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() ) ) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Martin Hořeňovský
					Martin Hořeňovský