|
17 | 17 | import os, tempfile
|
18 | 18 | from os.path import join, exists, basename
|
19 | 19 | from shutil import copytree, rmtree, copy
|
20 |
| -import yaml |
21 | 20 |
|
22 | 21 | from tools.utils import mkdir
|
23 | 22 | from tools.export import uvision4, codered, gccarm, ds5_5, iar, emblocks, coide, kds, zip, simplicityv3, atmelstudio, sw4stm32
|
@@ -55,7 +54,7 @@ def online_build_url_resolver(url):
|
55 | 54 |
|
56 | 55 |
|
57 | 56 | def export(project_path, project_name, ide, target, destination='/tmp/',
|
58 |
| - tempdir=None, clean=True, extra_symbols=None, build_url_resolver=online_build_url_resolver): |
| 57 | + tempdir=None, clean=True, extra_symbols=None, zip=True, build_url_resolver=online_build_url_resolver): |
59 | 58 | # Convention: we are using capitals for toolchain and target names
|
60 | 59 | if target is not None:
|
61 | 60 | target = target.upper()
|
@@ -109,30 +108,16 @@ def export(project_path, project_name, ide, target, destination='/tmp/',
|
109 | 108 |
|
110 | 109 | zip_path = None
|
111 | 110 | if report['success']:
|
112 |
| - # readme.txt to contain more exported data |
113 |
| - exporter_yaml = { |
114 |
| - 'project_generator': { |
115 |
| - 'active' : False, |
116 |
| - } |
117 |
| - } |
118 |
| - if use_progen: |
119 |
| - try: |
120 |
| - import pkg_resources |
121 |
| - version = pkg_resources.get_distribution('project_generator').version |
122 |
| - exporter_yaml['project_generator']['version'] = version |
123 |
| - exporter_yaml['project_generator']['active'] = True; |
124 |
| - exporter_yaml['project_generator_definitions'] = {} |
125 |
| - version = pkg_resources.get_distribution('project_generator_definitions').version |
126 |
| - exporter_yaml['project_generator_definitions']['version'] = version |
127 |
| - except ImportError: |
128 |
| - pass |
129 |
| - with open(os.path.join(tempdir, 'exporter.yaml'), 'w') as outfile: |
130 |
| - yaml.dump(exporter_yaml, outfile, default_flow_style=False) |
131 | 111 | # add readme file to every offline export.
|
132 | 112 | open(os.path.join(tempdir, 'GettingStarted.htm'),'w').write('<meta http-equiv="refresh" content="0; url=http://mbed.org/handbook/Getting-Started-mbed-Exporters#%s"/>'% (ide))
|
133 | 113 | # copy .hgignore file to exported direcotry as well.
|
134 |
| - copy(os.path.join(exporter.TEMPLATE_DIR,'.hgignore'),tempdir) |
135 |
| - zip_path = zip_working_directory_and_clean_up(tempdir, destination, project_name, clean) |
| 114 | + if exists(os.path.join(exporter.TEMPLATE_DIR,'.hgignore')): |
| 115 | + copy(os.path.join(exporter.TEMPLATE_DIR,'.hgignore'),tempdir) |
| 116 | + |
| 117 | + if zip: |
| 118 | + zip_path = zip_working_directory_and_clean_up(tempdir, destination, project_name, clean) |
| 119 | + else: |
| 120 | + zip_path = destination |
136 | 121 |
|
137 | 122 | return zip_path, report
|
138 | 123 |
|
|
0 commit comments