-
Notifications
You must be signed in to change notification settings - Fork 221
/
Copy pathinstaller_vars.py
executable file
·76 lines (68 loc) · 2.42 KB
/
installer_vars.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env python
#--------------------------------------------------------------------------
#
# File: installer_vars.py
#
# NightDriverStrip - (c) 2024 Plummer's Software LLC. All Rights Reserved.
#
# This file is part of the NightDriver software project.
#
# NightDriver is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# NightDriver is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Nightdriver. It is normally found in copying.txt
# If not, see <https://www.gnu.org/licenses/>.
#
# Description:
#
# Global variables and functions for the installer_*.py scripts
#
# History: Jul-12-2024 Rbergen Created
#
#---------------------------------------------------------------------------
import json
import os
class Dirs:
build = 'build'
config = 'config'
webinstaller = 'WebInstaller'
firmware = 'firmware'
manifests = 'manifests'
include = 'include'
assets = 'assets'
class Manifest:
base = 'manifest_'
ext = '.json'
unmerged_template = 'manifest_template.json'
merged_template = 'manifest_template_merged.json'
class Files:
webprojects = 'web_projects.json'
feature_flags = 'feature_flags.json'
features = 'features.json'
manifest = 'manifest.json'
merged_image = 'merged_image.bin'
globals_h = 'globals.h'
index_template = 'installer_index.html'
index = 'index.html'
def get_project_tree():
with open(os.path.join(Dirs.config, Files.webprojects), "r", encoding='utf-8') as f:
return json.load(f).get('devices')
def get_project(tag: str):
for device in get_project_tree():
merge = device['merge'] if 'merge' in device else True
for project in device['projects']:
if project['tag'] == tag:
project['device'] = device['name']
project['chipfamily'] = device['chipfamily']
if 'merge' not in project:
project['merge'] = merge
return project
return None