Skip to content

Commit aa48a70

Browse files
authored
refactor: copy static files to report directory (#71)
1 parent 70971c4 commit aa48a70

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

gitstats/report_creator.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,19 @@ def create(self, data, path):
3636
ReportCreator.create(self, data, path)
3737
self.title = data.project_name
3838

39-
# copy static files. Looks in the binary directory, ../share/gitstats and /usr/share/gitstats
40-
binarypath = os.path.dirname(os.path.abspath(__file__))
41-
secondarypath = os.path.join(binarypath, "..", "share", "gitstats")
42-
basedirs = [binarypath, secondarypath, "/usr/share/gitstats"]
39+
# copy static files to the report directory
40+
basedir = os.path.dirname(os.path.abspath(__file__))
4341
for file in (
4442
conf["style"],
4543
"sortable.js",
4644
"arrow-up.gif",
4745
"arrow-down.gif",
4846
"arrow-none.gif",
4947
):
50-
for base in basedirs:
51-
src = base + "/" + file
52-
if os.path.exists(src):
53-
shutil.copyfile(src, path + "/" + file)
54-
break
55-
else:
56-
print(
57-
'Warning: "%s" not found, so not copied (searched: %s)'
58-
% (file, basedirs)
59-
)
48+
src = basedir + "/" + file
49+
if os.path.exists(src):
50+
shutil.copyfile(src, path + "/" + file)
51+
break
6052

6153
self.create_index_html(data, path)
6254
self.create_activity_html(data, path)

0 commit comments

Comments
 (0)