-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathrun_program_debug.py
54 lines (40 loc) · 1.61 KB
/
run_program_debug.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
import os
import sys
from gi.repository import Gio
import subprocess
import pathlib
import shutil
OPENVPN3 = True
try:
import openvpn3
except:
OPENVPN3 = False
APP_NAME = "com.github.jkotra.eovpn"
sys.path.insert(1, os.getcwd())
sys.path.insert(1, os.getcwd() + "/eovpn/")
os.environ["GSETTINGS_SCHEMA_DIR"] = "data/"
os.environ["G_MESSAGES_DEBUG"] = "eovpn"
def reset():
subprocess.run(["rm", "-rf", "build"])
if pathlib.Path("subprojects/openvpn3/enums.h").exists():
subprocess.run(["rm", "subprojects/openvpn3/enums.h"])
subprocess.run(["meson", "setup", "build", "-Dprefix=/usr", f"-Dopenvpn3={OPENVPN3}"])
subprocess.run(["ninja", "-C", "build"])
def copy_libs():
shutil.copyfile("build/subprojects/networkmanager/libeovpn_nm.so", "eovpn/backend/networkmanager/libeovpn_nm.so")
shutil.copyfile("build/subprojects/networkmanager/_libeovpn_nm.so", "eovpn/backend/networkmanager/_libeovpn_nm.so")
if OPENVPN3:
shutil.copyfile("build/subprojects/openvpn3/libopenvpn3.so", "eovpn/backend/openvpn3/libopenvpn3.so")
shutil.copyfile("build/subprojects/openvpn3/_libopenvpn3.so", "eovpn/backend/openvpn3/_libopenvpn3.so")
shutil.copyfile("build/eovpn/metadata.json", "eovpn/metadata.json")
if __name__ == "__main__":
reset()
copy_libs()
from eovpn.application import launch_eovpn
gre_path = "build/data/com.github.jkotra.eovpn.gresource"
resource = Gio.resource_load(gre_path)
subprocess.run(["glib-compile-schemas", "data/"])
sys.argv.append("--debug")
sys.argv.append("DEBUG")
Gio.Resource._register(resource)
launch_eovpn()