3 import os.path, sys, shutil
5 def install_file( path, src_path, f ):
6 src = os.path.join( src_path, f )
7 dst = os.path.join( path, f )
8 print '%s -> %s' % ( src, dst )
9 shutil.copyfile( src, dst )
11 def install( path, src_path ):
12 for f in [ 'radiant.exe', 'radiant.pdb' ]:
13 install_file( path, src_path, f )
15 modules_path = os.path.join( path, 'modules' )
17 os.makedirs( modules_path )
20 assert( os.path.exists( modules_path ) )
22 modules_src = os.path.join( src_path, 'modules' )
23 assert( os.path.exists( modules_src ) )
25 for e in os.listdir( modules_src ):
26 if ( e[-4:] == '.dll' or e[-4:] == '.pdb' ):
27 install_file( modules_path, modules_src, e )
29 plugins_path = os.path.join( path, 'plugins' )
31 os.makedirs( plugins_path )
34 assert( os.path.exists( plugins_path ) )
36 plugins_src = os.path.join( src_path, 'plugins' )
37 assert( os.path.exists( plugins_src ) )
39 for e in os.listdir( plugins_src ):
40 if ( e[-4:] == '.dll' or e[-4:] == '.pdb' ):
41 install_file( plugins_path, plugins_src, e )
43 if __name__ == '__main__':
44 if ( len( sys.argv ) <= 2 or not os.path.exists( sys.argv[1] ) or not os.path.exists( sys.argv[2] ) ):
45 print 'usage: install [target directory] [source directory]'
47 print 'Install %s into %s' % ( sys.argv[2], sys.argv[1] )
48 install( sys.argv[1], sys.argv[2] )