blob: 8fc4fea6aecb136caa8c885e255560678ed68c95 (
plain)
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
|
import os
import subprocess
import shutil
from sugar3 import env
_b2g_process = None
def _ensure_profile():
b2g_profile_path = os.path.join(env.get_profile_path(), "b2g")
sugar_html_path = os.environ["SUGAR_HTML_PATH"]
if not os.path.exists(b2g_profile_path):
shutil.copytree(sugar_html_path, b2g_profile_path)
return b2g_profile_path
def start():
profile_path = _ensure_profile()
b2g_bin = os.path.join(os.environ["B2G_PATH"], "b2g")
global _b2g_process
_b2g_process = subprocess.Popen([b2g_bin, "-profile", profile_path])
def stop():
global _b2g_process
_b2g_process.terminate()
|