The principle is to use setup. dll. I just automated the command line. Sometimes it is very troublesome to pack a few times.
Usage:
1. Download the attachment and decompress it to any directory.
2. Put all the resource files and exe files you want to install in this directory, modify make. py, and change Provider and AppName to your own. Here, the Chinese AppName cannot be used as the directory.
3. If you want to change the program shortcut name, change chinaname in config/config.txt.
4. Run make. py on the command line to view the successful compilation information.
The script code is as follows:
# Coding = utf-8import osimport OS. pathworkpath = OS. path. dirname (_ file __) provider = "talkweb" # The company name cannot be Chinese AppName = "test" # the program name cannot be Chinese SourceDisksNames = "" CopyFiles = "" SourceDisksFiles = "" DestinationDirs = "" Body =" "# cab tool directory, mobile sdk5, 6 cab_tools = '"D: \ Program Files \ Microsoft Visual Studio 9.0 \ smartdevices \ sdk \ sdktools \ cabwiz.exe" 'f = open ("template. inf ") inf_content = f. read () f. close () nIndex = 1 For root, dirs, files in OS. walk (workpath): for name in files: if not name. endswith (". inf ") and not name. endswith (". CAB ") and not name. endswith (". py "): #1 =," Common1 "," C: \ workspace \ WindowsMobile \ InstallCab \ "SourceDisksNames + = str (nIndex) + '=, \ "Common '+ str (nIndex) + '",, "'+ root +' \" '+ "\ n" SourceDisksFiles + =' "'+ name +'" '+ "=" + str (nIndex) + "\ n" # Files. common1 = 0, "% InstallDir % \ config" Destin AtionDirs + = "Files. common "+ str (nIndex) + '= 0," % InstallDir %' if len (root [len (workpath):])> 0: destinationDirs + = root [len (workpath):] DestinationDirs + = '"' +" \ n "# [Files. common74] # "SetupDLL. dll "," SetupDLL. dll ", 0 Body + =" [Files. common "+ str (nIndex) +"] \ n "Body + = ('" % s "," % s ", 0') % (name, name) body + = "\ n" nIndex + = 1for x in xrange (nIndex): if x> 0: CopyFiles + = "Files. common "+ str (x) if x! = (NIndex-1): CopyFiles + = "," if _ name _ = "_ main _": inf_content = inf_content.replace ("{Provider}", Provider) inf_content = inline ("{AppName}", AppName) inf_content = inf_content.replace ("{SourceDisksNames}", SourceDisksNames) inf_content = inf_content.replace ("{CopyFiles}", CopyFiles) inf_content = encrypt ("{SourceDisksFiles}", SourceDisksFiles) inf_content = inf_content.replace ("{DestinationDirs}", DestinationDirs) inf_content = inf_content.replace ("{Body}", Body) open (AppName + ". inf "," w "). write (inf_content) cmd = cab_tools + "" + AppName + ". inf/err CabWiz. log "OS. system (cmd)