21
21
22
22
Author: Liviu Ionescu <[email protected] >
23
23
"""
24
+ from __future__ import print_function , absolute_import
25
+ from builtins import str
24
26
25
27
import os
26
28
import copy
@@ -139,8 +141,6 @@ def create_jinja_ctx(self):
139
141
# TODO: use some logger to display additional info if verbose
140
142
141
143
libraries = []
142
- # print 'libraries'
143
- # print self.resources.libraries
144
144
for lib in self .resources .libraries :
145
145
l , _ = splitext (basename (lib ))
146
146
libraries .append (l [3 :])
@@ -158,28 +158,22 @@ def create_jinja_ctx(self):
158
158
# TODO: get the list from existing .cproject
159
159
build_folders = [s .capitalize () for s in profile_ids ]
160
160
build_folders .append ('BUILD' )
161
- # print build_folders
162
161
163
162
objects = [self .filter_dot (s ) for s in self .resources .objects ]
164
163
for bf in build_folders :
165
164
objects = [o for o in objects if not o .startswith (bf + '/' )]
166
- # print 'objects'
167
- # print objects
168
165
169
166
self .compute_exclusions ()
170
167
171
168
self .include_path = [
172
169
self .filter_dot (s ) for s in self .resources .inc_dirs ]
173
- print 'Include folders: {0}' .format (len (self .include_path ))
174
170
175
171
self .as_defines = self .toolchain .get_symbols (True )
176
172
self .c_defines = self .toolchain .get_symbols ()
177
173
self .cpp_defines = self .c_defines
178
- print 'Symbols: {0}' .format (len (self .c_defines ))
179
174
180
175
self .ld_script = self .filter_dot (
181
176
self .resources .linker_script )
182
- print 'Linker script: {0}' .format (self .ld_script )
183
177
184
178
self .options = {}
185
179
for id in profile_ids :
@@ -196,8 +190,6 @@ def create_jinja_ctx(self):
196
190
opts ['id' ] = id
197
191
opts ['name' ] = opts ['id' ].capitalize ()
198
192
199
- print
200
- print 'Build configuration: {0}' .format (opts ['name' ])
201
193
202
194
profile = profiles [id ]
203
195
@@ -215,12 +207,6 @@ def create_jinja_ctx(self):
215
207
216
208
flags = self .toolchain_flags (toolchain )
217
209
218
- print 'Common flags:' , ' ' .join (flags ['common_flags' ])
219
- print 'C++ flags:' , ' ' .join (flags ['cxx_flags' ])
220
- print 'C flags:' , ' ' .join (flags ['c_flags' ])
221
- print 'ASM flags:' , ' ' .join (flags ['asm_flags' ])
222
- print 'Linker flags:' , ' ' .join (flags ['ld_flags' ])
223
-
224
210
# Most GNU ARM Eclipse options have a parent,
225
211
# either debug or release.
226
212
if '-O0' in flags ['common_flags' ] or '-Og' in flags ['common_flags' ]:
@@ -281,11 +267,6 @@ def generate(self):
281
267
"""
282
268
jinja_ctx = self .create_jinja_ctx ()
283
269
284
- print
285
- print 'Create a GNU ARM Eclipse C++ managed project'
286
- print 'Project name: {0}' .format (self .project_name )
287
- print 'Target: {0}' .format (self .toolchain .target .name )
288
- print 'Toolchain: {0}' .format (self .TOOLCHAIN )
289
270
290
271
self .gen_file ('gnuarmeclipse/.project.tmpl' , jinja_ctx ,
291
272
'.project' , trim_blocks = True , lstrip_blocks = True )
@@ -296,8 +277,7 @@ def generate(self):
296
277
self .gen_file_nonoverwrite ('gnuarmeclipse/mbedignore.tmpl' , jinja_ctx ,
297
278
'.mbedignore' )
298
279
299
- print
300
- print 'Done. Import the \' {0}\' project in Eclipse.' .format (self .project_name )
280
+ print ('Done. Import the \' {0}\' project in Eclipse.' .format (self .project_name ))
301
281
302
282
@staticmethod
303
283
def clean (_ ):
@@ -363,7 +343,7 @@ def build(project_name, log_name="build_log.txt", cleanup=True):
363
343
if ret_code != 0 :
364
344
ret_string += "FAILURE\n "
365
345
366
- print "%s\n %s\n %s\n %s" % (stdout_string , out , err_string , ret_string )
346
+ print ( "%s\n %s\n %s\n %s" % (stdout_string , out , err_string , ret_string ) )
367
347
368
348
if log_name :
369
349
# Write the output to the log file
@@ -397,11 +377,9 @@ def get_all_profiles():
397
377
file_names = [join (tools_path , "profiles" , fn ) for fn in os .listdir (
398
378
join (tools_path , "profiles" )) if fn .endswith (".json" )]
399
379
400
- # print file_names
401
380
402
381
profile_names = [basename (fn ).replace (".json" , "" )
403
382
for fn in file_names ]
404
- # print profile_names
405
383
406
384
profiles = {}
407
385
@@ -435,7 +413,6 @@ def compute_exclusions(self):
435
413
src ) for src in self .resources .c_sources + self .resources .cpp_sources + self .resources .s_sources )]
436
414
437
415
self .excluded_folders = set (self .resources .ignored_dirs ) - set (self .resources .inc_dirs )
438
- print 'Source folders: {0}, with {1} exclusions' .format (len (source_folders ), len (self .excluded_folders ))
439
416
440
417
441
418
# -------------------------------------------------------------------------
@@ -460,7 +437,6 @@ def dump_tree(self, nodes, depth=0):
460
437
node = nodes [k ]
461
438
parent_name = node ['parent' ][
462
439
'name' ] if 'parent' in node .keys () else ''
463
- print ' ' * depth , node ['name' ], node ['is_used' ], parent_name
464
440
if len (node ['children' ].keys ()) != 0 :
465
441
self .dump_tree (node ['children' ], depth + 1 )
466
442
@@ -474,7 +450,6 @@ def dump_paths(self, nodes, depth=0):
474
450
break
475
451
node = node ['parent' ]
476
452
path = '/' .join (parts )
477
- print path , nodes [k ]['is_used' ]
478
453
self .dump_paths (nodes [k ]['children' ], depth + 1 )
479
454
480
455
# -------------------------------------------------------------------------
@@ -504,14 +479,6 @@ def process_options(self, opts, flags_in):
504
479
# Make a copy of the flags, to be one by one removed after processing.
505
480
flags = copy .deepcopy (flags_in )
506
481
507
- if False :
508
- print
509
- print 'common_flags' , flags ['common_flags' ]
510
- print 'asm_flags' , flags ['asm_flags' ]
511
- print 'c_flags' , flags ['c_flags' ]
512
- print 'cxx_flags' , flags ['cxx_flags' ]
513
- print 'ld_flags' , flags ['ld_flags' ]
514
-
515
482
# Initialise the 'last resort' options where all unrecognised
516
483
# options will be collected.
517
484
opts ['as' ]['other' ] = ''
@@ -944,17 +911,6 @@ def process_options(self, opts, flags_in):
944
911
opts ['cpp' ]['other' ] = opts ['cpp' ]['other' ].strip ()
945
912
opts ['ld' ]['other' ] = opts ['ld' ]['other' ].strip ()
946
913
947
- if False :
948
- print
949
- print opts
950
-
951
- print
952
- print 'common_flags' , flags ['common_flags' ]
953
- print 'asm_flags' , flags ['asm_flags' ]
954
- print 'c_flags' , flags ['c_flags' ]
955
- print 'cxx_flags' , flags ['cxx_flags' ]
956
- print 'ld_flags' , flags ['ld_flags' ]
957
-
958
914
@staticmethod
959
915
def find_options (lst , option ):
960
916
tmp = [str for str in lst if str .startswith (option )]
0 commit comments