-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_helper.py
26 lines (20 loc) · 1 KB
/
setup_helper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os
def find_resource_files(directory, relative_to=None):
paths = []
for (path, directories, filenames) in os.walk(directory):
for filename in filenames:
if relative_to is not None:
paths.append(os.path.join(os.path.relpath(path, relative_to), filename))
else:
paths.append(os.path.join('..', path, filename))
return paths
def find_resource_files_of_type(resource_type, app_package, app_root):
relative_to = f"{app_root}/{app_package}"
resources = find_resource_files(f"{relative_to}/{resource_type}", relative_to)
return resources
def find_all_resource_files(app_package, app_root):
resources = find_resource_files_of_type("templates", app_package, app_root)
resources += find_resource_files_of_type("public", app_package, app_root)
resources += find_resource_files_of_type("workspaces", app_package, app_root)
resources += find_resource_files_of_type("scripts", app_package, app_root)
return resources