Crossfire Client, Trunk  R20401
Bundle.py
Go to the documentation of this file.
1 import os, sys, subprocess
2 import urllib2 as u
3 pwd=os.getcwd()
4 def system(cmd):
5  return subprocess.Popen(cmd.split(),env=os.environ,stdin=sys.stdin,stdout=sys.stdout,stderr=sys.stderr).wait()
6 def AskInstall(Name):
7  return Auto or 'Y' in raw_input('Install %s?' %Name).upper()
8 Auto='auto' in sys.argv
9 
10 def FetchFile(URL, Filename):
11  f=u.urlopen(URL)
12  o=open(Filename,'wb')
13  txt=f.read(1024*512)
14  ctr=0
15  while txt:
16  if (ctr+1)/2*2==ctr+1:
17  print ctr*1024*512+len(txt), 'bytes downloaded'
18  o.write(txt)
19  txt=f.read()
20  ctr+=1
21  f.close()
22  o.close()
23 
24 
25 #FetchFile('https://crossfire.svn.sourceforge.net/svnroot/crossfire/client/trunk/gtk-v2/win32/gtkclient.nsi', 'gtkclient.nsi')
26 system('copy %s\\gtk-2\\win32\\gtkclient.nsi.in .' %CFSOURCE)
27 
28 if not DB and AskInstall('Nsis'):
29  FetchFile('http://downloads.sourceforge.net/project/nsis/NSIS%202/2.46/nsis-2.46-setup.exe?r=http%3A%2F%2Fnsis.sourceforge.net%2FDownload&ts=1316497068&use_mirror=superb-sea2', 'nsis.exe')
30  system('nsis.exe')
31 
32 NSIS=pwd+'\NSIS' if DB else raw_input('Path to nsis?') or pwd+'\NSIS'
33 NSIS+='\makensis.exe '
34 if 'CFSOURCE' not in dir():
35  CFSOURCE=raw_input("Path to client.svn? ")
36 f=open('gtkclient.nsi.in')
37 txt=f.read()
38 f.close()
39 txt=txt %(CFSOURCE,CFSOURCE,CFSOURCE,CFSOURCE,CFSOURCE,CFSOURCE,CFSOURCE,CFSOURCE,CFSOURCE,CFSOURCE,CFSOURCE,CFSOURCE,CFSOURCE,CFSOURCE,CFSOURCE,CFSOURCE,CFSOURCE,CFSOURCE)
40 f=open('gtkclient.nsi','w')
41 f.write(txt)
42 f.close()
43 
44 print NSIS
45 
46 system(NSIS + 'gtkclient.nsi')
47 
def system(cmd)
Definition: Bundle.py:4
def AskInstall(Name)
Definition: Bundle.py:6
def FetchFile(URL, Filename)
Definition: Bundle.py:10