|
4 | 4 | from __future__ import absolute_import, print_function
|
5 | 5 | import sys
|
6 | 6 | from os.path import (join, abspath, dirname, exists, basename, normpath,
|
7 |
| - realpath, basename) |
| 7 | + realpath, relpath, basename) |
8 | 8 | from os import remove
|
9 | 9 | ROOT = abspath(join(dirname(__file__), ".."))
|
10 | 10 | sys.path.insert(0, ROOT)
|
@@ -48,7 +48,7 @@ def setup_project(ide, target, program=None, source_dir=None, build=None, export
|
48 | 48 | project_name = TESTS[program]
|
49 | 49 | else:
|
50 | 50 | project_name = basename(normpath(realpath(source_dir[0])))
|
51 |
| - src_paths = source_dir |
| 51 | + src_paths = {relpath(path, project_dir): [path] for path in source_dir} |
52 | 52 | lib_paths = None
|
53 | 53 | else:
|
54 | 54 | test = Test(program)
|
@@ -163,6 +163,12 @@ def main():
|
163 | 163 | default=False,
|
164 | 164 | help="writes tools/export/README.md")
|
165 | 165 |
|
| 166 | + parser.add_argument("--build", |
| 167 | + type=argparse_filestring_type, |
| 168 | + dest="build_dir", |
| 169 | + default=None, |
| 170 | + help="Directory for the exported project files") |
| 171 | + |
166 | 172 | parser.add_argument("--source",
|
167 | 173 | action="append",
|
168 | 174 | type=argparse_filestring_type,
|
@@ -254,12 +260,16 @@ def main():
|
254 | 260 | except (NotImplementedError, IOError, OSError):
|
255 | 261 | pass
|
256 | 262 | for f in EXPORTERS.values()[0].CLEAN_FILES:
|
257 |
| - remove(f) |
| 263 | + try: |
| 264 | + remove(f) |
| 265 | + except (IOError, OSError): |
| 266 | + pass |
258 | 267 | try:
|
259 | 268 | export(mcu, options.ide, build=options.build,
|
260 | 269 | src=options.source_dir, macros=options.macros,
|
261 | 270 | project_id=options.program, zip_proj=zip_proj,
|
262 |
| - build_profile=profile, app_config=options.app_config) |
| 271 | + build_profile=profile, app_config=options.app_config, |
| 272 | + export_path=options.build_dir) |
263 | 273 | except NotSupportedException as exc:
|
264 | 274 | print("[ERROR] %s" % str(exc))
|
265 | 275 |
|
|
0 commit comments