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

summaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorMartin Hořeňovský2017-07-09 20:58:51 +0200
committerMartin Hořeňovský2017-07-09 21:02:36 +0200
commit93f84b5b0d2ef8edc9dee0c22a2e662b9f4de512 (patch)
tree457613af436c42da05aecac486238e295abea57e /scripts
parentfc32165d48f0a46a60ac02e0e52f8c89adafd8be (diff)
downloadcatch3-93f84b5b0d2ef8edc9dee0c22a2e662b9f4de512.tar.gz
Modified generateSingleHeader script to work with .cpp files better
Also fixed the scripts to take into account renamed version file
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/generateSingleHeader.py16
-rw-r--r--scripts/releaseCommon.py2
2 files changed, 16 insertions, 2 deletions
diff --git a/scripts/generateSingleHeader.py b/scripts/generateSingleHeader.py
index bb267ff5..3b6f722d 100755
--- a/scripts/generateSingleHeader.py
+++ b/scripts/generateSingleHeader.py
@@ -7,6 +7,7 @@ import sys
import re
import datetime
import string
+from glob import glob
from scriptCommon import catchPath
from releaseCommon import Version
@@ -21,6 +22,7 @@ ifImplParser = re.compile( r'\s*#ifdef CATCH_CONFIG_RUNNER' )
commentParser1 = re.compile( r'^\s*/\*')
commentParser2 = re.compile( r'^ \*')
blankParser = re.compile( r'^\s*$')
+
seenHeaders = set([])
rootPath = os.path.join( catchPath, 'include/' )
outputPath = os.path.join( catchPath, 'single_include/catch.hpp' )
@@ -49,13 +51,25 @@ def write( line ):
if includeImpl or implIfDefs == -1:
out.write( line )
+def insertCpps():
+ dirs = [os.path.join( rootPath, s) for s in ['', 'internal', 'reporters']]
+ cppFiles = []
+ for dir in dirs:
+ cppFiles += glob(os.path.join(dir, '*.cpp'))
+ for fname in cppFiles:
+ dir, name = fname.rsplit(os.path.sep, 1)
+ dir += os.path.sep
+ parseFile(dir, name)
+
def parseFile( path, filename ):
global ifdefs
global implIfDefs
- f = open( path + filename, 'r' )
+ f = open( os.path.join(path, filename), 'r' )
blanks = 0
for line in f:
+ if '// ~*~* CATCH_CPP_STITCH_PLACE *~*~' in line:
+ insertCpps()
if ifParser.match( line ):
ifdefs = ifdefs + 1
elif endIfParser.match( line ):
diff --git a/scripts/releaseCommon.py b/scripts/releaseCommon.py
index c49f7461..652985c9 100644
--- a/scripts/releaseCommon.py
+++ b/scripts/releaseCommon.py
@@ -9,7 +9,7 @@ from scriptCommon import catchPath
versionParser = re.compile( r'(\s*static\sVersion\sversion)\s*\(\s*(.*)\s*,\s*(.*)\s*,\s*(.*)\s*,\s*\"(.*)\"\s*,\s*(.*)\s*\).*' )
rootPath = os.path.join( catchPath, 'include/' )
-versionPath = os.path.join( rootPath, "internal/catch_version.hpp" )
+versionPath = os.path.join( rootPath, "internal/catch_version.cpp" )
readmePath = os.path.join( catchPath, "README.md" )
class Version: