Complete python3 fixes for issue #67

This commit is contained in:
James E. King III
2025-07-03 00:11:41 -04:00
committed by Jim King
parent 4b8160057a
commit 02ec362f5c
3 changed files with 10 additions and 10 deletions

View File

@@ -5,12 +5,12 @@ Pre-processing of MPL-containers can be accomplished using the script
"boost_mpl_preprocess.py". In the simple case call it with a single "boost_mpl_preprocess.py". In the simple case call it with a single
argument which is the path to the source-directory of Boost. argument which is the path to the source-directory of Boost.
python boost_mpl_preprocess.py <path-to-boost-sourcedir> python3 boost_mpl_preprocess.py <path-to-boost-sourcedir>
If the Boost source-directory is the one this script resides in, you If the Boost source-directory is the one this script resides in, you
can just call it without any arguments. can just call it without any arguments.
python boost_mpl_preprocess.py python3 boost_mpl_preprocess.py
Either way, this will pre-process all four MPL-container types (vector, Either way, this will pre-process all four MPL-container types (vector,
list, set, map) and makes them able to hold up to 100 elements. They can list, set, map) and makes them able to hold up to 100 elements. They can
@@ -22,7 +22,7 @@ be different from the one of other MPL-container types and it can also
differ between its 'numbered' and 'variadic' form. differ between its 'numbered' and 'variadic' form.
To see all options, call the script like this: To see all options, call the script like this:
python boost_mpl_preprocess.py --help python3 boost_mpl_preprocess.py --help
Fixing pre-processing of MPL-containers Fixing pre-processing of MPL-containers
@@ -44,12 +44,12 @@ can also fix them explicitly by calling "fix_boost_mpl_preprocess.py"
directly. directly.
If you just want to test if any fixing is needed call it like this: If you just want to test if any fixing is needed call it like this:
python fix_boost_mpl_preprocess.py --check-only <path-to-boost-sourcedir> python3 fix_boost_mpl_preprocess.py --check-only <path-to-boost-sourcedir>
This will tell you if any fixing is needed. In such a case call the script This will tell you if any fixing is needed. In such a case call the script
"fix_boost_mpl_preprocess.py" like this: "fix_boost_mpl_preprocess.py" like this:
python fix_boost_mpl_preprocess.py <path-to-boost-sourcedir> python3 fix_boost_mpl_preprocess.py <path-to-boost-sourcedir>
This will fix the header-comments of all the source-files needed during This will fix the header-comments of all the source-files needed during
pre-processing. Calling "boost_mpl_preprocess.py" afterwards should then pre-processing. Calling "boost_mpl_preprocess.py" afterwards should then

View File

@@ -29,7 +29,7 @@ def create_more_container_files(sourceDir, suffix, maxElements, containers, cont
newFile = os.path.join( sourceDir, container, container + str(i+10) + suffix ) newFile = os.path.join( sourceDir, container, container + str(i+10) + suffix )
shutil.copyfile( os.path.join( sourceDir, container, container + "20" + suffix ), newFile ) shutil.copyfile( os.path.join( sourceDir, container, container + "20" + suffix ), newFile )
# Adjust copy of "template"-file accordingly. # Adjust copy of "template"-file accordingly.
for line in fileinput.input( newFile, inplace=1, mode="rU" ): for line in fileinput.input( newFile, inplace=1, mode="r" ):
line = re.sub(r'20', '%TWENTY%', line.rstrip()) line = re.sub(r'20', '%TWENTY%', line.rstrip())
line = re.sub(r'11', '%ELEVEN%', line.rstrip()) line = re.sub(r'11', '%ELEVEN%', line.rstrip())
line = re.sub(r'10(?![0-9])', '%TEN%', line.rstrip()) line = re.sub(r'10(?![0-9])', '%TEN%', line.rstrip())
@@ -43,7 +43,7 @@ def create_more_container_files(sourceDir, suffix, maxElements, containers, cont
newFile = os.path.join( sourceDir, container, container + str(i+10) + "_c" + suffix ) newFile = os.path.join( sourceDir, container, container + str(i+10) + "_c" + suffix )
shutil.copyfile( os.path.join( sourceDir, container, container + "20_c" + suffix ), newFile ) shutil.copyfile( os.path.join( sourceDir, container, container + "20_c" + suffix ), newFile )
# Adjust copy of "template"-file accordingly. # Adjust copy of "template"-file accordingly.
for line in fileinput.input( newFile, inplace=1, mode="rU" ): for line in fileinput.input( newFile, inplace=1, mode="r" ):
line = re.sub(r'20', '%TWENTY%', line.rstrip()) line = re.sub(r'20', '%TWENTY%', line.rstrip())
line = re.sub(r'11', '%ELEVEN%', line.rstrip()) line = re.sub(r'11', '%ELEVEN%', line.rstrip())
line = re.sub(r'10(?![0-9])', '%TEN%', line.rstrip()) line = re.sub(r'10(?![0-9])', '%TEN%', line.rstrip())
@@ -73,7 +73,7 @@ def adjust_container_limits_for_variadic_sequences(headerDir, containers, maxEle
headerFile = os.path.join( headerDir, "limits", container + ".hpp" ) headerFile = os.path.join( headerDir, "limits", container + ".hpp" )
regexMatch = r'(define\s+BOOST_MPL_LIMIT_' + container.upper() + r'_SIZE\s+)[0-9]+' regexMatch = r'(define\s+BOOST_MPL_LIMIT_' + container.upper() + r'_SIZE\s+)[0-9]+'
regexReplace = r'\g<1>' + re.escape( str(maxElements) ) regexReplace = r'\g<1>' + re.escape( str(maxElements) )
for line in fileinput.input( headerFile, inplace=1, mode="rU" ): for line in fileinput.input( headerFile, inplace=1, mode="r" ):
line = re.sub(regexMatch, regexReplace, line.rstrip()) line = re.sub(regexMatch, regexReplace, line.rstrip())
print(line) print(line)

View File

@@ -21,7 +21,7 @@ def check_header_comment(filename):
# Check input file. # Check input file.
name = os.path.basename( filename ) name = os.path.basename( filename )
# Read content of input file. # Read content of input file.
sourcefile = open( filename, "rU" ) sourcefile = open( filename, "r" )
content = sourcefile.read() content = sourcefile.read()
sourcefile.close() sourcefile.close()
# Search content for '$Id$'. # Search content for '$Id$'.
@@ -93,7 +93,7 @@ def fix_header_comment(filename, timestamp):
"""Fixes the header-comment of the given file.""" """Fixes the header-comment of the given file."""
# Fix input file. # Fix input file.
name = os.path.basename( filename ) name = os.path.basename( filename )
for line in fileinput.input( filename, inplace=1, mode="rU" ): for line in fileinput.input( filename, inplace=1, mode="r" ):
# If header-comment already contains anything for '$Id$', remove it. # If header-comment already contains anything for '$Id$', remove it.
line = re.sub(r'\$Id:[^$]+\$', r'$Id$', line.rstrip()) line = re.sub(r'\$Id:[^$]+\$', r'$Id$', line.rstrip())
# Replace '$Id$' by a string containing the file's name (and a timestamp)! # Replace '$Id$' by a string containing the file's name (and a timestamp)!