forked from tidev/titanium-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
drillbit_cmd.py
executable file
·35 lines (25 loc) · 1010 Bytes
/
drillbit_cmd.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
#!/usr/bin/env python
import os, sys, shutil, platform, subprocess
def run(args,env=None,cwd=None):
return subprocess.call(args, cwd=cwd)
#args = [arg.replace(" ", "\\ ") for arg in args]
#p = subprocess.Popen(" ".join(args), cwd=cwd, shell=True)
#return os.waitpid(p.pid, 0)
contents_dir = os.path.dirname(os.path.abspath(__file__))
manifest = os.path.join(contents_dir,'manifest')
manifest_cmdline = os.path.join(contents_dir,'manifest_cmdline')
manifest_backup = os.path.join(contents_dir,'manifest_backup')
shutil.copy(manifest, manifest_backup)
shutil.copy(manifest_cmdline, manifest)
open(os.path.join(contents_dir, '.installed'),'w').write('#')
exe = None
if platform.system() == "Windows":
exe = os.path.join(contents_dir, 'Drillbit.exe')
elif platform.system() == "Darwin":
exe = os.path.join(contents_dir, 'MacOS', 'Drillbit')
else:
exe = os.path.join(contents_dir, 'Drillbit')
args = [exe]
args.extend(sys.argv[1:])
run(args, cwd=os.getcwd())
shutil.copy(manifest_backup, manifest)