-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmados-installer
More file actions
executable file
·48 lines (42 loc) · 1.7 KB
/
Copy pathmados-installer
File metadata and controls
executable file
·48 lines (42 loc) · 1.7 KB
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
#!/bin/bash
cd "$(dirname "$0")"
DEMO_MODE="${DEMO_MODE:-false}"
python3 -c "
import sys
import os
import types
import importlib.util
os.environ['DEMO_MODE'] = '${DEMO_MODE}'
pkg_dir = '$(pwd)'
spec = importlib.util.spec_from_file_location('mados_installer', f'{pkg_dir}/__init__.py')
pkg = importlib.util.module_from_spec(spec)
sys.modules['mados_installer'] = pkg
spec.loader.exec_module(pkg)
submodules = ['mados_installer', 'config', 'theme', 'translations', 'utils']
for name in submodules:
filepath = f'{pkg_dir}/{name}.py'
if os.path.exists(filepath):
spec = importlib.util.spec_from_file_location(f'mados_installer.{name}', filepath)
mod = importlib.util.module_from_spec(spec)
sys.modules[f'mados_installer.{name}'] = mod
spec.loader.exec_module(mod)
for subdir in ['installer', 'pages', 'translations']:
subdir_path = f'{pkg_dir}/{subdir}'
if os.path.isdir(subdir_path):
sys.modules[f'mados_installer.{subdir}'] = types.ModuleType(f'mados_installer.{subdir}')
for pyfile in os.listdir(subdir_path):
if pyfile.endswith('.py') and pyfile != '__init__.py':
modname = pyfile[:-3]
filepath = f'{subdir_path}/{pyfile}'
spec = importlib.util.spec_from_file_location(f'mados_installer.{subdir}.{modname}', filepath)
mod = importlib.util.module_from_spec(spec)
sys.modules[f'mados_installer.{subdir}.{modname}'] = mod
spec.loader.exec_module(mod)
from mados_installer.mados_installer import MadOSInstaller
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
app = MadOSInstaller()
app.connect('destroy', Gtk.main_quit)
Gtk.main()
" "$@"