def Choco(*args): choco = GetChocolateyPath() if not choco: try: if not (StartProcess( "powershell", "-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", "iex ((new-object net.webclient).DownloadString" "('https://chocolatey.org/install.ps1'))" ) == 0): raise MissingChocolatey except WindowsError: raise MissingPowerShell choco = GetChocolateyPath() args = list(args) + ["-f", "-y"] return (StartProcess(choco, *args) == 0)
def ExecuteInnoSetup(self): """ Finishes the setup, writes the Inno Setup script and calls the Inno Setup compiler. """ innoScriptTemplate = file( join(self.buildSetup.dataDir, "InnoSetup.template"), "rt").read() innoScriptPath = join(self.buildSetup.tmpDir, "Setup.iss") issFile = open(innoScriptPath, "w") templateDict = {} for key, value in self.buildSetup.__dict__.iteritems(): if isinstance(value, unicode): value = EncodePath(value) templateDict[key] = value issFile.write(innoScriptTemplate % templateDict) for section, lines in self.innoSections.iteritems(): issFile.write("[%s]\n" % section) for line in lines: issFile.write("%s\n" % line) issFile.close() if not (StartProcess(GetInnoCompilerPath(), innoScriptPath, "/Q") == 0): raise InnoSetupError
def DoTask(self): tmpDir = join(self.buildSetup.tmpDir, "chm") Prepare() #warnings.simplefilter('ignore', DeprecationWarning) sphinx.build_main([ None, "-a", # always write all output files "-b", "htmlhelp", "-E", # Don’t use a saved environment (the structure # caching all cross-references), "-N", # Prevent colored output. "-P", # (Useful for debugging only.) Run the Python debugger, # pdb, if an unhandled exception occurs while building. "-D", "release=%s" % self.buildSetup.appVersion, "-D", "templates_path=[]", "-d", EncodePath(join(self.buildSetup.tmpDir, ".doctree")), EncodePath(DOCS_SOURCE_DIR), tmpDir, ]) print "calling HTML Help Workshop compiler" htmlHelpCompilerPath = GetHtmlHelpCompilerPath() if htmlHelpCompilerPath is None: raise Exception( "HTML Help Workshop command line compiler not found") hhpPath = join(tmpDir, "EventGhost.hhp") StartProcess(htmlHelpCompilerPath, hhpPath) shutil.copy(join(tmpDir, "EventGhost.chm"), self.buildSetup.sourceDir)
def DoTask(self): tmpDir = join(self.buildSetup.tmpDir, "chm") Prepare() #warnings.simplefilter('ignore', DeprecationWarning) sphinx.main([ None, #"-a", "-b", "htmlhelp", "-E", "-P", "-D", "release=%s" % eg.Version.base, "-D", "templates_path=[]", "-d", EncodePath(join(self.buildSetup.tmpDir, ".doctree")), EncodePath(DOCS_SOURCE_DIR), tmpDir, ]) print "calling HTML Help Workshop compiler" htmlHelpCompilerPath = GetHtmlHelpCompilerPath() if htmlHelpCompilerPath is None: raise Exception( "HTML Help Workshop command line compiler not found") hhpPath = join(tmpDir, "EventGhost.hhp") StartProcess(htmlHelpCompilerPath, hhpPath) shutil.copy(join(tmpDir, "EventGhost.chm"), self.buildSetup.sourceDir)
def InstallMSI(file, path): file = file if exists(file) else DownloadFile(file) return (StartProcess( "msiexec", "/a", file, "/qb", "TARGETDIR=%s" % path, ) == 0)
def Pip(*args): args = list(args) if args[0].lower() == "install": args += ["-U"] elif args[0].lower() == "uninstall": args += ["-y"] try: return (StartProcess(sys.executable, "-m", "pip", *args) == 0) except WindowsError: raise MissingPip
def DoTask(self): tmpDir = join(self.buildSetup.tmpDir, "chm") call_sphinx('htmlhelp', self.buildSetup, tmpDir) print "calling HTML Help Workshop compiler" htmlHelpCompilerPath = GetHtmlHelpCompilerPath() if htmlHelpCompilerPath is None: raise Exception( "HTML Help Workshop command line compiler not found") hhpPath = join(tmpDir, "EventGhost.hhp") StartProcess(htmlHelpCompilerPath, hhpPath) shutil.copy(join(tmpDir, "EventGhost.chm"), self.buildSetup.sourceDir)
def CreateVirtualEnv(): # These files will be replaced by virtualenv. We don't want that. backups = [ join(VirtualEnv.PATH, "Lib", "distutils", "__init__.py"), join(VirtualEnv.PATH, "Lib", "site.py"), ] # Install virtualenv and virtualenvwrapper. #Pip("install", "pip", "-q") Pip("install", "virtualenvwrapper-win", "-q") # Install Stackless Python in virtualenv folder. url = [d.url for d in DEPENDENCIES if d.name == "Stackless Python"][0] file = DownloadFile(url) InstallMSI(file, VirtualEnv.PATH) os.unlink(file) # Backup stock files. for f in backups: copy2(f, f + ".bak") # Create virtualenv on top of Stackless Python. result = (StartProcess( sys.executable, "-m", "virtualenv", "--python=%s" % join(VirtualEnv.PATH, "python.exe"), VirtualEnv.PATH, ) == 0) # Restore stock files. for f in backups: os.unlink(f) os.rename(f + ".bak", f) # Start in build folder when virtualenv activated manually. with open(join(VirtualEnv.PATH, ".project"), "w") as f: f.write(os.getcwd()) return result