@@ -24,20 +24,20 @@ def get_exporter_toolchain(ide):
24
24
return EXPORTERS [ide ], EXPORTERS [ide ].TOOLCHAIN
25
25
26
26
27
- def rewrite_basepath (file_name , resources , export_path ):
27
+ def rewrite_basepath (file_name , resources , export_path , loc ):
28
28
""" Replace the basepath of filename with export_path
29
29
30
30
Positional arguments:
31
31
file_name - the absolute path to a file
32
32
resources - the resources object that the file came from
33
33
export_path - the final destination of the file after export
34
34
"""
35
- new_f = relpath (file_name , resources .file_basepath [file_name ])
35
+ new_f = join ( loc , relpath (file_name , resources .file_basepath [file_name ]) )
36
36
resources .file_basepath [join (export_path , new_f )] = export_path
37
37
return new_f
38
38
39
39
40
- def subtract_basepath (resources , export_path ):
40
+ def subtract_basepath (resources , export_path , loc = "" ):
41
41
""" Rewrite all of the basepaths with the export_path
42
42
43
43
Positional arguments:
@@ -55,63 +55,15 @@ def subtract_basepath(resources, export_path):
55
55
if isinstance (vals , list ):
56
56
new_vals = []
57
57
for val in vals :
58
- new_vals .append (rewrite_basepath (val , resources , export_path ))
58
+ new_vals .append (rewrite_basepath (val , resources , export_path ,
59
+ loc ))
59
60
if isinstance (getattr (resources , key ), set ):
60
61
setattr (resources , key , set (new_vals ))
61
62
else :
62
63
setattr (resources , key , new_vals )
63
64
elif vals :
64
65
setattr (resources , key , rewrite_basepath (vals , resources ,
65
- export_path ))
66
-
67
-
68
- def prepare_project (src_paths , export_path , target , ide ,
69
- libraries_paths = None , options = None , linker_script = None ,
70
- clean = False , notify = None , verbose = False , name = None ,
71
- inc_dirs = None , jobs = 1 , silent = False , extra_verbose = False ,
72
- config = None , macros = None ):
73
- """ This function normalizes the
74
- """
75
-
76
- # Convert src_path to a list if needed
77
- if type (src_paths ) != type ([]):
78
- src_paths = [src_paths ]
79
- # Extend src_paths wiht libraries_paths
80
- if libraries_paths is not None :
81
- src_paths .extend (libraries_paths )
82
-
83
- # Export Directory
84
- if exists (export_path ) and clean :
85
- rmtree (export_path )
86
- if not exists (export_path ):
87
- makedirs (export_path )
88
-
89
- _ , toolchain_name = get_exporter_toolchain (ide )
90
-
91
- # Pass all params to the unified prepare_resources()
92
- toolchain = prepare_toolchain (src_paths , target ,
93
- toolchain_name , macros = macros ,
94
- options = options , clean = clean , jobs = jobs ,
95
- notify = notify , silent = silent , verbose = verbose ,
96
- extra_verbose = extra_verbose , config = config )
97
-
98
-
99
- # The first path will give the name to the library
100
- if name is None :
101
- name = basename (normpath (abspath (src_paths [0 ])))
102
-
103
- # Call unified scan_resources
104
- resources = scan_resources (src_paths , toolchain , inc_dirs = inc_dirs )
105
- toolchain .build_dir = export_path
106
- config_header = toolchain .get_config_header ()
107
- resources .headers .append (config_header )
108
- resources .file_basepath [config_header ] = dirname (config_header )
109
-
110
- # Change linker script if specified
111
- if linker_script is not None :
112
- resources .linker_script = linker_script
113
-
114
- return resources , toolchain
66
+ export_path , loc ))
115
67
116
68
117
69
def generate_project_files (resources , export_path , target , name , toolchain , ide ,
@@ -243,7 +195,7 @@ def export_project(src_paths, export_path, target, ide,
243
195
subtract_basepath (resources , export_path )
244
196
for loc , res in resource_dict .iteritems ():
245
197
temp = copy .deepcopy (res )
246
- subtract_basepath (temp , join ( export_path , loc ) )
198
+ subtract_basepath (temp , export_path , loc )
247
199
resources .add (temp )
248
200
else :
249
201
for _ , res in resource_dict .iteritems ():
0 commit comments