2019-12-14 18:16:31 +01:00
|
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
|
|
import runpy
|
|
|
|
|
from os import scandir
|
|
|
|
|
from os.path import dirname, abspath
|
|
|
|
|
|
|
|
|
|
this_dir = dirname(abspath(__file__))
|
|
|
|
|
|
|
|
|
|
def filename(f):
|
2020-01-31 11:35:25 +01:00
|
|
|
|
return f.name
|
2019-12-14 18:16:31 +01:00
|
|
|
|
|
|
|
|
|
with scandir(dirname(abspath(__file__))) as it:
|
2020-01-31 11:35:25 +01:00
|
|
|
|
for f in sorted(it, key = filename):
|
2020-06-02 13:37:57 +02:00
|
|
|
|
if not f.is_file():
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
if f.name.startswith('__'):
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
if not f.name.endswith('.py'):
|
2020-01-31 11:35:25 +01:00
|
|
|
|
continue
|
2020-05-14 16:02:03 +02:00
|
|
|
|
|
|
|
|
|
print(f"▶️ Running the startup script {f.path}")
|
|
|
|
|
try:
|
|
|
|
|
runpy.run_path(f.path)
|
|
|
|
|
except SystemExit as e:
|
|
|
|
|
if e.code is not None and e.code != 0:
|
|
|
|
|
print(f"‼️ The startup script {f.path} returned with code {e.code}, exiting.")
|
|
|
|
|
raise
|