Skip to content

Commit c9bf785

Browse files
committed
Export - add export log yaml file
Exporters should provide additional information - what templates are they using. For progen, it should be version, and we might add more information later.
1 parent e2cb35e commit c9bf785

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

workspace_tools/export/__init__.py

+20
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import os, tempfile
1818
from os.path import join, exists, basename
1919
from shutil import copytree, rmtree, copy
20+
import yaml
2021

2122
from workspace_tools.utils import mkdir
2223
from workspace_tools.export import uvision4, codered, gccarm, ds5_5, iar, emblocks, coide, kds, zip, simplicityv3, atmelstudio, sw4stm32
@@ -108,6 +109,25 @@ def export(project_path, project_name, ide, target, destination='/tmp/',
108109

109110
zip_path = None
110111
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)
111131
# add readme file to every offline export.
112132
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))
113133
# copy .hgignore file to exported direcotry as well.

0 commit comments

Comments
 (0)