-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathbuild.py
More file actions
32 lines (26 loc) · 707 Bytes
/
build.py
File metadata and controls
32 lines (26 loc) · 707 Bytes
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
#!/usr/bin/python
import os
import subprocess
source = 'swfzip.py'
target = 'swfunzip.py'
if not os.path.exists(source):
raise Exception(source+' not existed.')
if os.path.exists(target):
raise Exception(target+' existed.')
if 'symlink' in dir(os):
os.symlink(source, target)
else:
p = subprocess.Popen(
'mklink {target} {source}'.format(
source = source,
target = target
),
shell=True,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE
)
stdout, stderr = p.communicate()
if p.returncode != 0:
print stderr
raise Exception('symlink error')
print 'symlinking done.'