]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - install.py
eol
[xonotic/netradiant.git] / install.py
1 #!/usr/bin/env python
2
3 import os.path, sys, shutil
4
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 )
10
11 def install( path, src_path ):
12         for f in [ 'radiant.exe', 'radiant.pdb' ]:
13                 install_file( path, src_path, f )
14                 
15         modules_path = os.path.join( path, 'modules' )
16         try:
17                 os.makedirs( modules_path )
18         except:
19                 pass
20         assert( os.path.exists( modules_path ) )
21
22         modules_src = os.path.join( src_path, 'modules' )
23         assert( os.path.exists( modules_src ) )
24
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 )
28         
29         plugins_path = os.path.join( path, 'plugins' )
30         try:
31                 os.makedirs( plugins_path )
32         except:
33                 pass
34         assert( os.path.exists( plugins_path ) )
35         
36         plugins_src = os.path.join( src_path, 'plugins' )
37         assert( os.path.exists( plugins_src ) )
38
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 )
42
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]'
46                 sys.exit(1)             
47         print 'Install %s into %s' % ( sys.argv[2], sys.argv[1] )
48         install( sys.argv[1], sys.argv[2] )