Skip to content

Commit 329be06

Browse files
committed
exporters - group by directories in prj root
Update exporter grouping code to group by directories in the root of the project rather than by the parent directory of each file. This reduces the number of groups and allows all mbed-os code to reside in its own folder.
1 parent 3a326c0 commit 329be06

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tools/export/exporters.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
from abc import abstractmethod, ABCMeta
44
import logging
5-
from os.path import join, dirname, relpath, basename, realpath
5+
from os.path import join, dirname, relpath, basename, realpath, normpath
66
from itertools import groupby
77
from jinja2 import FileSystemLoader
88
from jinja2.environment import Environment
@@ -130,9 +130,13 @@ def make_key(self, src):
130130
Positional Arguments:
131131
src - the src's location
132132
"""
133-
key = basename(dirname(src))
134-
if key == ".":
135-
key = basename(realpath(self.export_dir))
133+
rel_path = relpath(src, self.resources.file_basepath[src])
134+
path_list = os.path.normpath(rel_path).split(os.sep)
135+
assert path_list >= 1
136+
if len(path_list) == 1:
137+
key = self.project_name
138+
else:
139+
key = path_list[0]
136140
return key
137141

138142
def group_project_files(self, sources):

0 commit comments

Comments
 (0)