1- """Amalgate json-cpp library sources into a single source and header file.
1+ """Amalgamate json-cpp library sources into a single source and header file.
22
33Works with python2.6+ and python3.4+.
44
55Example of invocation (must be invoked from json-cpp top directory):
6- python amalgate .py
6+ python amalgamate .py
77"""
88import os
99import os .path
@@ -50,20 +50,20 @@ def write_to(self, output_path):
5050def amalgamate_source (source_top_dir = None ,
5151 target_source_path = None ,
5252 header_include_path = None ):
53- """Produces amalgated source.
53+ """Produces amalgamated source.
5454 Parameters:
5555 source_top_dir: top-directory
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 ("Amalgamating header..." )
6060 header = AmalgamationFile (source_top_dir )
61- header .add_text ("/// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/)." )
61+ header .add_text ("/// Json-cpp amalgamated header (http://jsoncpp.sourceforge.net/)." )
6262 header .add_text ('/// It is intended to be used with #include "%s"' % header_include_path )
6363 header .add_file ("LICENSE" , wrap_in_comment = True )
64- header .add_text ("#ifndef JSON_AMALGATED_H_INCLUDED " )
65- header .add_text ("# define JSON_AMALGATED_H_INCLUDED " )
66- header .add_text ("/// If defined, indicates that the source file is amalgated " )
64+ header .add_text ("#ifndef JSON_AMALGAMATED_H_INCLUDED " )
65+ header .add_text ("# define JSON_AMALGAMATED_H_INCLUDED " )
66+ header .add_text ("/// If defined, indicates that the source file is amalgamated " )
6767 header .add_text ("/// to prevent private header inclusion." )
6868 header .add_text ("#define JSON_IS_AMALGAMATION" )
6969 header .add_file ("include/json/version.h" )
@@ -75,37 +75,37 @@ def amalgamate_source(source_top_dir=None,
7575 header .add_file ("include/json/reader.h" )
7676 header .add_file ("include/json/writer.h" )
7777 header .add_file ("include/json/assertions.h" )
78- header .add_text ("#endif //ifndef JSON_AMALGATED_H_INCLUDED " )
78+ header .add_text ("#endif //ifndef JSON_AMALGAMATED_H_INCLUDED " )
7979
8080 target_header_path = os .path .join (os .path .dirname (target_source_path ), header_include_path )
81- print ("Writing amalgated header to %r" % target_header_path )
81+ print ("Writing amalgamated header to %r" % target_header_path )
8282 header .write_to (target_header_path )
8383
8484 base , ext = os .path .splitext (header_include_path )
8585 forward_header_include_path = base + "-forwards" + ext
86- print ("Amalgating forward header..." )
86+ print ("Amalgamating forward header..." )
8787 header = AmalgamationFile (source_top_dir )
88- header .add_text ("/// Json-cpp amalgated forward header (http://jsoncpp.sourceforge.net/)." )
88+ header .add_text ("/// Json-cpp amalgamated forward header (http://jsoncpp.sourceforge.net/)." )
8989 header .add_text ('/// It is intended to be used with #include "%s"' % forward_header_include_path )
9090 header .add_text ("/// This header provides forward declaration for all JsonCpp types." )
9191 header .add_file ("LICENSE" , wrap_in_comment = True )
92- header .add_text ("#ifndef JSON_FORWARD_AMALGATED_H_INCLUDED " )
93- header .add_text ("# define JSON_FORWARD_AMALGATED_H_INCLUDED " )
94- header .add_text ("/// If defined, indicates that the source file is amalgated " )
92+ header .add_text ("#ifndef JSON_FORWARD_AMALGAMATED_H_INCLUDED " )
93+ header .add_text ("# define JSON_FORWARD_AMALGAMATED_H_INCLUDED " )
94+ header .add_text ("/// If defined, indicates that the source file is amalgamated " )
9595 header .add_text ("/// to prevent private header inclusion." )
9696 header .add_text ("#define JSON_IS_AMALGAMATION" )
9797 header .add_file ("include/json/config.h" )
9898 header .add_file ("include/json/forwards.h" )
99- header .add_text ("#endif //ifndef JSON_FORWARD_AMALGATED_H_INCLUDED " )
99+ header .add_text ("#endif //ifndef JSON_FORWARD_AMALGAMATED_H_INCLUDED " )
100100
101101 target_forward_header_path = os .path .join (os .path .dirname (target_source_path ),
102102 forward_header_include_path )
103- print ("Writing amalgated forward header to %r" % target_forward_header_path )
103+ print ("Writing amalgamated forward header to %r" % target_forward_header_path )
104104 header .write_to (target_forward_header_path )
105105
106- print ("Amalgating source..." )
106+ print ("Amalgamating source..." )
107107 source = AmalgamationFile (source_top_dir )
108- source .add_text ("/// Json-cpp amalgated source (http://jsoncpp.sourceforge.net/)." )
108+ source .add_text ("/// Json-cpp amalgamated source (http://jsoncpp.sourceforge.net/)." )
109109 source .add_text ('/// It is intended to be used with #include "%s"' % header_include_path )
110110 source .add_file ("LICENSE" , wrap_in_comment = True )
111111 source .add_text ("" )
@@ -123,20 +123,20 @@ def amalgamate_source(source_top_dir=None,
123123 source .add_file (os .path .join (lib_json , "json_value.cpp" ))
124124 source .add_file (os .path .join (lib_json , "json_writer.cpp" ))
125125
126- print ("Writing amalgated source to %r" % target_source_path )
126+ print ("Writing amalgamated source to %r" % target_source_path )
127127 source .write_to (target_source_path )
128128
129129def main ():
130130 usage = """%prog [options]
131- Generate a single amalgated source and header file from the sources.
131+ Generate a single amalgamated source and header file from the sources.
132132"""
133133 from optparse import OptionParser
134134 parser = OptionParser (usage = usage )
135135 parser .allow_interspersed_args = False
136136 parser .add_option ("-s" , "--source" , dest = "target_source_path" , action = "store" , default = "dist/jsoncpp.cpp" ,
137137 help = """Output .cpp source path. [Default: %default]""" )
138138 parser .add_option ("-i" , "--include" , dest = "header_include_path" , action = "store" , default = "json/json.h" ,
139- help = """Header include path. Used to include the header from the amalgated source file. [Default: %default]""" )
139+ help = """Header include path. Used to include the header from the amalgamated source file. [Default: %default]""" )
140140 parser .add_option ("-t" , "--top-dir" , dest = "top_dir" , action = "store" , default = os .getcwd (),
141141 help = """Source top-directory. [Default: %default]""" )
142142 parser .enable_interspersed_args ()
@@ -149,7 +149,7 @@ def main():
149149 sys .stderr .write (msg + "\n " )
150150 sys .exit (1 )
151151 else :
152- print ("Source succesfully amalagated " )
152+ print ("Source successfully amalgamated " )
153153
154154if __name__ == "__main__" :
155155 main ()
0 commit comments