Skip to content

Commit 33aff48

Browse files
authored
Merge pull request #3559 from c1728p9/simplify_exporter_dirs
exporters - group by directories in prj root
2 parents e223f6f + 329be06 commit 33aff48

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)