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 DoTask(self): """ Build the library and .exe files with py2exe. """ buildSetup = self.buildSetup sys.path.append(EncodePath(buildSetup.pyVersionDir)) from distutils.core import setup InstallPy2exePatch() import py2exe origIsSystemDLL = py2exe.build_exe.isSystemDLL def isSystemDLL(path): if basename(path).lower().startswith("api-ms-win-"): return 1 else: return origIsSystemDLL(path) py2exe.build_exe.isSystemDLL = isSystemDLL libraryDir = buildSetup.libraryDir if exists(libraryDir): for filename in os.listdir(libraryDir): path = join(libraryDir, filename) if not os.path.isdir(path): os.remove(path) setup(script_args=["py2exe"], windows=[Target(buildSetup)], verbose=0, zipfile=EncodePath(join(buildSetup.libraryName, self.zipName)), options=dict( build=dict(build_base=join(buildSetup.tmpDir, "build")), py2exe=dict( compressed=0, includes=["encodings", "encodings.*", "Imports"], excludes=buildSetup.excludeModules, dll_excludes=DLL_EXCLUDES, dist_dir=EncodePath(buildSetup.sourceDir), custom_boot_script=join(buildSetup.dataDir, "Py2ExeBootScript.py"), ))) dllNames = [basename(name) for name in glob(join(libraryDir, "*.dll"))] neededDlls = [] paths = [sys.prefix] if hasattr(sys, "real_prefix"): paths.append(sys.real_prefix) for path in paths: for _, _, files in os.walk(path): for filename in files: if filename in dllNames: neededDlls.append(filename) for dllName in dllNames: if dllName not in neededDlls: os.remove(join(libraryDir, dllName))
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 Add(self, section, line): """ Adds a line to the INI section. """ if section not in self.innoSections: self.innoSections[section] = [] self.innoSections[section].append(EncodePath(line))
def DoTask(self): """ Create the library and .exe files with py2exe. """ buildSetup = self.buildSetup sys.path.append(EncodePath(buildSetup.pyVersionDir)) from distutils.core import setup InstallPy2exePatch() import py2exe # pylint: disable-msg=W0612 # looks like py2exe import is unneeded, but it isn't libraryDir = buildSetup.libraryDir if exists(libraryDir): for filename in os.listdir(libraryDir): path = join(libraryDir, filename) if not os.path.isdir(path): os.remove(path) setup(script_args=["py2exe"], windows=[Target(buildSetup)], verbose=0, zipfile=EncodePath(join(buildSetup.libraryName, self.zipName)), options=dict( build=dict(build_base=join(buildSetup.tmpDir, "build")), py2exe=dict( compressed=0, includes=["encodings", "encodings.*", "imports"], excludes=buildSetup.excludeModules, dll_excludes=["DINPUT8.dll", "w9xpopen.exe"], dist_dir=EncodePath(buildSetup.sourceDir), custom_boot_script=join(buildSetup.dataDir, "Py2ExeBootScript.py"), ))) dllNames = [basename(name) for name in glob(join(libraryDir, "*.dll"))] neededDlls = [] for _, _, files in os.walk(dirname(sys.executable)): for filename in files: if filename in dllNames: neededDlls.append(filename) for dllName in dllNames: if dllName not in neededDlls: os.remove(join(libraryDir, dllName)) if buildSetup.pyVersionStr == "26": RemoveAllManifests(libraryDir)
import sys import re import shutil import codecs import warnings from os.path import join import sphinx import builder from builder.Utils import StartProcess, GetHtmlHelpCompilerPath, EncodePath MAIN_DIR = builder.buildSetup.sourceDir DOCS_SOURCE_DIR = join(MAIN_DIR, "docs") sys.path.append(EncodePath(MAIN_DIR)) import eg from eg.Utils import GetFirstParagraph def WritePluginList(filepath): kindList = [ ("core", "Essential (always loaded)"), ("remote", "Remote Receiver"), ("program", "Program Control"), ("external", "External Hardware Equipment"), ("other", "Other"), ] numPlugins = 0 groups = {} for info in eg.pluginManager.GetPluginInfoList():