Module setup
[hide private]
[frames] | no frames]

Source Code for Module setup

 1  """ 
 2  Manual setup file for pisi 
 3   
 4  Pisi is free software: you can redistribute it and/or modify 
 5  it under the terms of the GNU General Public License as published by 
 6  the Free Software Foundation, either version 3 of the License, or 
 7  (at your option) any later version. 
 8   
 9  Pisi is distributed in the hope that it will be useful, 
10  but WITHOUT ANY WARRANTY; without even the implied warranty of 
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
12  GNU General Public License for more details. 
13   
14  You should have received a copy of the GNU General Public License 
15  along with Pisi.  If not, see <http://www.gnu.org/licenses/>. 
16   
17  Run with  
18      python setup.py build /         - or 
19      python setup.py install / 
20       
21  Puts all PISI stuff under /opt/pisi (assuming you provide / as destination) 
22  Some links and additional stuff is put in corresponding places. 
23  """ 
24   
25  import sys 
26  import os 
27  import os.path 
28  import shutil 
29   
30  filesToMove = [ 
31                 ['conf.example', 'usr/share/doc/pisi', 'conf.example'],  
32                 ['build/pisi.desktop', 'usr/share/applications', 'pisi.desktop'],  
33                 ['build/pisi.png', 'usr/share/pixmaps', 'pisi.png'] 
34                 ] 
35  filesToLink = [ 
36                 ['../opt/pisi/pisi.py', 'bin','pisi'],  
37                 ['../opt/pisi/pisigui.py', 'bin', 'pisigui'] 
38                 ] 
39   
40   
41 -def doBuild(path):
42 pass
43
44 -def doInstall(path):
45 print "installing pisi" 46 basedir = os.path.join(path, 'opt/pisi') 47 if not os.path.exists(os.path.join(path, 'opt/')): 48 os.mkdir(os.path.join(path, 'opt/')) 49 shutil.copytree(os.getcwdu(), basedir, ignore = shutil.ignore_patterns('debian')) 50 for entry in filesToMove: 51 dir = os.path.join(path, entry[1]) 52 if not os.path.exists(dir): 53 os.makedirs(dir) 54 shutil.move(os.path.join(basedir, entry[0]), os.path.join(path, entry[1], entry[2])) 55 for entry in filesToLink: 56 destDir = os.path.join(path, entry[1]) 57 if not os.path.exists(destDir): 58 os.makedirs(destDir) 59 os.symlink(entry[0], os.path.join(destDir, entry[2]))
60 61 if __name__ == "__main__": 62 # if len(sys.argv) != 3: 63 # print "Wrong number of arguments" 64 # sys.exit(1) 65 if sys.argv[1] == 'build': 66 doBuild(sys.argv[2]) 67 elif sys.argv[1] == 'install': 68 if sys.argv[2].startswith('--root='): 69 dest = sys.argv[2][7:] 70 else: 71 dest = sys.argv[2] 72 doInstall(dest) 73 elif sys.argv[1] == 'clean': 74 pass 75 else: 76 print "Unknown command" 77 sys.exit(1) 78