Skip to content

Commit e5de78d

Browse files
committed
Merge pull request open-source-parsers#87 from cdunn2001/master
2to3 (but only the changes which should work with python2 also)
2 parents 5fda247 + ffd7295 commit e5de78d

12 files changed

+395
-386
lines changed

amalgamate.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def amalgamate_source( source_top_dir=None,
5656
target_source_path: output .cpp path
5757
header_include_path: generated header path relative to target_source_path.
5858
"""
59-
print ("Amalgating header...")
59+
print("Amalgating header...")
6060
header = AmalgamationFile( source_top_dir )
6161
header.add_text( "/// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/)." )
6262
header.add_text( "/// It is intented to be used with #include <%s>" % header_include_path )
@@ -77,12 +77,12 @@ def amalgamate_source( source_top_dir=None,
7777
header.add_text( "#endif //ifndef JSON_AMALGATED_H_INCLUDED" )
7878

7979
target_header_path = os.path.join( os.path.dirname(target_source_path), header_include_path )
80-
print ("Writing amalgated header to %r" % target_header_path)
80+
print("Writing amalgated header to %r" % target_header_path)
8181
header.write_to( target_header_path )
8282

8383
base, ext = os.path.splitext( header_include_path )
8484
forward_header_include_path = base + "-forwards" + ext
85-
print ("Amalgating forward header...")
85+
print("Amalgating forward header...")
8686
header = AmalgamationFile( source_top_dir )
8787
header.add_text( "/// Json-cpp amalgated forward header (http://jsoncpp.sourceforge.net/)." )
8888
header.add_text( "/// It is intented to be used with #include <%s>" % forward_header_include_path )
@@ -99,10 +99,10 @@ def amalgamate_source( source_top_dir=None,
9999

100100
target_forward_header_path = os.path.join( os.path.dirname(target_source_path),
101101
forward_header_include_path )
102-
print ("Writing amalgated forward header to %r" % target_forward_header_path)
102+
print("Writing amalgated forward header to %r" % target_forward_header_path)
103103
header.write_to( target_forward_header_path )
104104

105-
print ("Amalgating source...")
105+
print("Amalgating source...")
106106
source = AmalgamationFile( source_top_dir )
107107
source.add_text( "/// Json-cpp amalgated source (http://jsoncpp.sourceforge.net/)." )
108108
source.add_text( "/// It is intented to be used with #include <%s>" % header_include_path )
@@ -118,7 +118,7 @@ def amalgamate_source( source_top_dir=None,
118118
source.add_file( os.path.join(lib_json, "json_value.cpp") )
119119
source.add_file( os.path.join(lib_json, "json_writer.cpp") )
120120

121-
print ("Writing amalgated source to %r" % target_source_path)
121+
print("Writing amalgated source to %r" % target_source_path)
122122
source.write_to( target_source_path )
123123

124124
def main():
@@ -144,7 +144,7 @@ def main():
144144
sys.stderr.write( msg + "\n" )
145145
sys.exit( 1 )
146146
else:
147-
print ("Source succesfully amalagated")
147+
print("Source succesfully amalagated")
148148

149149
if __name__ == "__main__":
150150
main()

devtools/antglob.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# encoding: utf-8
33
# Baptiste Lepilleur, 2009
44

5+
from __future__ import print_function
56
from dircache import listdir
67
import re
78
import fnmatch
@@ -190,12 +191,12 @@ def local_path( paths ):
190191
test_cases.append( (ant_pattern, local_path(accepted_matches), local_path( rejected_matches )) )
191192
for ant_pattern, accepted_matches, rejected_matches in test_cases:
192193
rex = ant_pattern_to_re( ant_pattern )
193-
print 'ant_pattern:', ant_pattern, ' => ', rex.pattern
194+
print('ant_pattern:', ant_pattern, ' => ', rex.pattern)
194195
for accepted_match in accepted_matches:
195-
print 'Accepted?:', accepted_match
196-
self.assert_( rex.match( accepted_match ) is not None )
196+
print('Accepted?:', accepted_match)
197+
self.assertTrue( rex.match( accepted_match ) is not None )
197198
for rejected_match in rejected_matches:
198-
print 'Rejected?:', rejected_match
199-
self.assert_( rex.match( rejected_match ) is None )
199+
print('Rejected?:', rejected_match)
200+
self.assertTrue( rex.match( rejected_match ) is None )
200201

201202
unittest.main()

0 commit comments

Comments
 (0)