HEAD = ''' ; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! [Setup] Compression=zip/9 AppName=CCP4I2 AppVerName=CCP4I2 2.0 AppPublisher=STFC AppPublisherURL=http://www.ccp4.ac.uk AppSupportURL=mailto:ccp4@ccp4.ac.uk AppUpdatesURL=http://www.ccp4.ac.uk/MG/ DefaultDirName={pf}\CCP4I2 DefaultGroupName=CCP4I2 [Tasks] ; NOTE: The following entry contains English phrases ("Create a desktop icon" and "Additional icons"). You are free to translate them into another language if required. Name: "desktopicon"; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:" [Files] Source: "bin\wini2.exe"; DestDir: "{app}\bin"; Flags: ignoreversion Source: "bin\*.*"; DestDir:"{app}\bin"; Flags: ignoreversion Source: "python27.dll"; DestDir:"{app}"; Flags: ignoreversion Source: "lib\Qt*.dll"; DestDir:"{app}\bin"; Flags: ignoreversion ''' FOOT = """ Source: "vendor\\vcredist_x86.exe"; DestDir: "{tmp}" ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] Name: "{group}\ccp4i2"; Filename: "{app}\\bin\wini2.exe" ; NOTE: The following entry contains an English phrase ("Uninstall"). You are free to translate it into another language if required. Name: "{group}\Uninstall ccp4i2"; Filename: "{uninstallexe}" Name: "{userdesktop}\ccp4i2"; Filename: "{app}\\bin\\wini2.exe"; Tasks: desktopicon [Messages] WelcomeLabel2=This will install [name/ver] on your computer.%n%nIt is recommended that you close all other applications before continuing.%n%n [Run] ; NOTE: The following entry contains an English phrase ("Launch"). You are free to translate it into another language if required. Filename: {tmp}\\vcredist_x86.exe; Parameters: "/passive /Q:a /c:""msiexec /qb /i vcredist.msi"" "; StatusMsg: Installing Microsoft VC++ 2010 RunTime... Filename: "{app}\\bin\\wini2.exe"; Description: "Launch ccp4i2"; Flags: nowait postinstall skipifsilent """ ROOT = "C:\\Users\\lizp\\DEV\\ccp4i2" EXCLUDE = ['Linux','MacOSX','Output'] import sys,os,glob,re def search(root,path,output): if path is not None: contents = glob.glob(os.path.join(root,path,'*')) for f in contents: if os.path.isfile(f): output = output + '\n' + 'Source: "' + path +'\*.*"; DestDir:"{app}\\' + path + '"; Flags: ignoreversion' break else: contents = glob.glob(os.path.join(root,'*')) for f in contents: if os.path.isdir(f): fpath = os.path.relpath(f,root) if fpath not in EXCLUDE: output = search(root,fpath,output) return output output = HEAD output = search(ROOT,None,output) output = output + FOOT f = open(os.path.join(ROOT,'inno_i2.iss'),'w') f.write(output) f.close()