|
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 |
20 | 21 |
|
21 | 22 | from tools.utils import mkdir
|
22 | 23 | from tools.export import uvision4, codered, gccarm, ds5_5, iar, emblocks, coide, kds, zip, simplicityv3, atmelstudio, sw4stm32
|
@@ -54,7 +55,7 @@ def online_build_url_resolver(url):
|
54 | 55 |
|
55 | 56 |
|
56 | 57 | def export(project_path, project_name, ide, target, destination='/tmp/',
|
57 |
| - tempdir=None, clean=True, extra_symbols=None, zip=True, build_url_resolver=online_build_url_resolver): |
| 58 | + tempdir=None, clean=True, extra_symbols=None, build_url_resolver=online_build_url_resolver): |
58 | 59 | # Convention: we are using capitals for toolchain and target names
|
59 | 60 | if target is not None:
|
60 | 61 | target = target.upper()
|
@@ -108,16 +109,30 @@ def export(project_path, project_name, ide, target, destination='/tmp/',
|
108 | 109 |
|
109 | 110 | zip_path = None
|
110 | 111 | 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) |
111 | 131 | # add readme file to every offline export.
|
112 | 132 | 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))
|
113 | 133 | # copy .hgignore file to exported direcotry as well.
|
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 |
| 134 | + copy(os.path.join(exporter.TEMPLATE_DIR,'.hgignore'),tempdir) |
| 135 | + zip_path = zip_working_directory_and_clean_up(tempdir, destination, project_name, clean) |
121 | 136 |
|
122 | 137 | return zip_path, report
|
123 | 138 |
|
|
0 commit comments