@@ -138,48 +138,6 @@ def get_exporter_toolchain(ide):
138
138
return EXPORTERS [ide ], EXPORTERS [ide ].TOOLCHAIN
139
139
140
140
141
- def rewrite_basepath (file_name , resources , export_path , loc ):
142
- """ Replace the basepath of filename with export_path
143
-
144
- Positional arguments:
145
- file_name - the absolute path to a file
146
- resources - the resources object that the file came from
147
- export_path - the final destination of the file after export
148
- """
149
- new_f = join (loc , relpath (file_name , resources .file_basepath [file_name ]))
150
- resources .file_basepath [new_f ] = export_path
151
- return new_f
152
-
153
-
154
- def subtract_basepath (resources , export_path , loc = "" ):
155
- """ Rewrite all of the basepaths with the export_path
156
-
157
- Positional arguments:
158
- resources - the resource object to rewrite the basepaths of
159
- export_path - the final destination of the resources with respect to the
160
- generated project files
161
- """
162
- keys = ['s_sources' , 'c_sources' , 'cpp_sources' , 'hex_files' ,
163
- 'objects' , 'libraries' , 'inc_dirs' , 'headers' , 'linker_script' ,
164
- 'lib_dirs' ]
165
- for key in keys :
166
- vals = getattr (resources , key )
167
- if isinstance (vals , set ):
168
- vals = list (vals )
169
- if isinstance (vals , list ):
170
- new_vals = []
171
- for val in vals :
172
- new_vals .append (rewrite_basepath (val , resources , export_path ,
173
- loc ))
174
- if isinstance (getattr (resources , key ), set ):
175
- setattr (resources , key , set (new_vals ))
176
- else :
177
- setattr (resources , key , new_vals )
178
- elif vals :
179
- setattr (resources , key , rewrite_basepath (vals , resources ,
180
- export_path , loc ))
181
-
182
-
183
141
def generate_project_files (resources , export_path , target , name , toolchain , ide ,
184
142
macros = None ):
185
143
"""Generate the project files for a project
@@ -305,27 +263,21 @@ def export_project(src_paths, export_path, target, ide, libraries_paths=None,
305
263
notify = notify , silent = silent , verbose = verbose ,
306
264
extra_verbose = extra_verbose , config = config , build_profile = build_profile ,
307
265
app_config = app_config )
308
- # The first path will give the name to the library
266
+
309
267
toolchain .RESPONSE_FILES = False
310
268
if name is None :
311
269
name = basename (normpath (abspath (src_paths [0 ])))
312
270
313
- # Call unified scan_resources
314
271
resource_dict = {loc : sum ((toolchain .scan_resources (p , collect_ignores = True )
315
272
for p in path ),
316
273
Resources ())
317
274
for loc , path in src_paths .items ()}
318
275
resources = Resources ()
319
276
320
- if zip_proj :
321
- subtract_basepath (resources , "." )
322
- for loc , res in resource_dict .items ():
323
- temp = copy .deepcopy (res )
324
- subtract_basepath (temp , "." , loc )
325
- resources .add (temp )
326
- else :
327
- for _ , res in resource_dict .items ():
328
- resources .add (res )
277
+ for loc , res in resource_dict .items ():
278
+ temp = copy .deepcopy (res )
279
+ temp .subtract_basepath ("." , loc )
280
+ resources .add (temp )
329
281
330
282
toolchain .build_dir = export_path
331
283
toolchain .config .load_resources (resources )
@@ -345,8 +297,7 @@ def export_project(src_paths, export_path, target, ide, libraries_paths=None,
345
297
if zip_proj :
346
298
for resource in resource_dict .values ():
347
299
for label , res in resource .features .items ():
348
- if label not in toolchain .target .features :
349
- resource .add (res )
300
+ resource .add (res )
350
301
if isinstance (zip_proj , basestring ):
351
302
zip_export (join (export_path , zip_proj ), name , resource_dict ,
352
303
files + list (exporter .static_files ), inc_repos )
0 commit comments