forked from TTimo/GtkRadiant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.py
48 lines (38 loc) · 1.35 KB
/
install.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
#!/usr/bin/env python
import os.path, sys, shutil
def install_file( path, src_path, f ):
src = os.path.join( src_path, f )
dst = os.path.join( path, f )
print '%s -> %s' % ( src, dst )
shutil.copyfile( src, dst )
def install( path, src_path ):
for f in [ 'radiant.exe', 'radiant.pdb' ]:
install_file( path, src_path, f )
modules_path = os.path.join( path, 'modules' )
try:
os.makedirs( modules_path )
except:
pass
assert( os.path.exists( modules_path ) )
modules_src = os.path.join( src_path, 'modules' )
assert( os.path.exists( modules_src ) )
for e in os.listdir( modules_src ):
if ( e[-4:] == '.dll' or e[-4:] == '.pdb' ):
install_file( modules_path, modules_src, e )
plugins_path = os.path.join( path, 'plugins' )
try:
os.makedirs( plugins_path )
except:
pass
assert( os.path.exists( plugins_path ) )
plugins_src = os.path.join( src_path, 'plugins' )
assert( os.path.exists( plugins_src ) )
for e in os.listdir( plugins_src ):
if ( e[-4:] == '.dll' or e[-4:] == '.pdb' ):
install_file( plugins_path, plugins_src, e )
if __name__ == '__main__':
if ( len( sys.argv ) <= 2 or not os.path.exists( sys.argv[1] ) or not os.path.exists( sys.argv[2] ) ):
print 'usage: install [target directory] [source directory]'
sys.exit(1)
print 'Install %s into %s' % ( sys.argv[2], sys.argv[1] )
install( sys.argv[1], sys.argv[2] )