def compileAppDLL(files, outname="AppAssembly"): fs = files.split() gb = fs gb.append("/out:" + outname) # gb.append("/out:StdLib") # print ["/target:dll",] + gb pyc.Main(["/target:dll"] + gb)
def _subprocPYC(strCmd, cmpfile, dotExt='.dll'): clr = None # keep out global clr try: import clr sys.path.append(oprel(compiler.pycpath)) import pyc except Exception as exi: pass args = None if clr: args = strCmd[2:] try: pyc.Main(args) except Exception as ex: if ex: print('type', type(ex)) try: print(ex) print(ex.message) except Exception: pass log.warn('pyc.Main err:\n' + ex.ToString()) else: log.warn('pyc.Main err:\n') return False else: po = subprocess.Popen(strCmd, stdout=PIPE, stderr=PIPE) stdout, stderr = po.communicate() po.wait() if stderr: log.warn('ERR\n {}:\n\t compiling with {}'.format(stderr, cmpfile)) po.kill() return False else: if gsBuild.Verbose or not gsBuild.INFO: log.info('\n - STDOUT - \n{}'.format(stdout)) po.kill() if dotExt and opex( opj(opd(compiler.mainoutdir), opb(cmpfile).replace('.py', dotExt))): log.FILE('Build Created: {}'.format(cmpfile.replace('.py', dotExt))) elif opex(cmpfile): log.FILE('Build Created: {}'.format(cmpfile)) else: return False return True
def compileStd(ipLib_Rootpath): gb1 = glob.glob(ipLib_Rootpath + r"\*.py") gb2 = glob.glob(ipLib_Rootpath + r"\encodings\*.py") gb = gb1 + gb2 gb.append("/out:StdLibALLs") # print ["/target:dll",] + gb pyc.Main(["/target:dll"] + gb)
def compileAppExe(fies, EntryFilename): fs = files.split() gb = fs gb = [ "/target:exe ", ] + gb gb += ["/standalone"] gb += ["/main:" + EntryFilename] pyc.Main(gb)
def compileAppExe(files ,EntryFilename ,LibPathName=None): fs= files.split()#+[EntryFilename] gb1 = [] gb2=[] # print(EntryFilename ) gb = ["/target:exe ",] gb += ["/standalone /platform:x64" ] gb += ["/main:" + EntryFilename ] # print LibPathName if LibPathName != None : # print LibPathName,getLibPys( LibPathName ) gb2 += getLibPys( LibPathName ) gb = gb + gb1 + gb2 + fs # for g in gb : # print (g) pyc.Main( gb )
ip_path = r'C:\Program Files (x86)\IronPython 2.7' pyc_path = ip_path + r'\Tools\Scripts' stdlib_path = ip_path + r'\Lib' import sys sys.path.append(pyc_path) import os, fnmatch import pyc # Find all py files recursively. files = [] for root, dirnames, filenames in os.walk(stdlib_path): for filename in fnmatch.filter(filenames, '*.py'): files.append(os.path.join(root, filename)) # Remove multiprocessing files as they fails to compile. files = [file for file in files if not 'multiprocessing' in file] # Concatenate with pyc arguments. args = ['/target:dll', '/out:StdLib27'] + files # Run pyc. pyc.Main(args)
gb.append("/out:StdLib") # print ["/target:dll",]+gb # pyc.Main(["/target:dll"]+gb) # Build EXE gb = [ "/main:maclient_cli.py", "xml2dict.py", "maclient.py", "maclient_network.py", "maclient_smart.py", "maclient_player.py", "maclient_proxy.py", "maclient_update.py", "maclient_logging.py", "maclient_plugin.py", "cross_platform.py", "D:\Dev\Python\Python27\Lib\__future__.py", "/target:exe", "/out:maclient_cli", "/platform:all", "/embed" ] pyc.Main(gb) # CopyFiles to Release Directory # doscopy("StdLib.dll") doscopy("maclient_cli.exe") # Copy DLLs to Release Directory fl = [ "IronPython.dll", "IronPython.Modules.dll", "Microsoft.Dynamic.dll", "Microsoft.Scripting.Debugging.dll", "Microsoft.Scripting.dll", "Microsoft.Scripting.ExtensionAttribute.dll", "Microsoft.Scripting.Core.dll" ] # for f in fl: # doscopy(f)
def _subprocPYC(strCmd, cmpfile, dotExt='.dll'): clr = None # keep out global clr try: import clr except Exception as ex: pass if clr: try: sys.path.append(oprel(compiler.pycpath)) import pyc except Exception as ex: pass try: clr.AddReference("StdLib") except System.IO.IOException as ex: print('StdLib.dll reference error:\n\t' + \ 'check file | filepath') try: clr.AddReference("IronPython") except System.IO.IOException as ex: print('IronPython reference error:\n\t' + \ 'check file | filepath') f_ipy = False try: import ipyver rs = ipyver.ReferenceStatus() f_ipy = rs.RefStatusIPMS()['ipy']['isLocal'] except System.IO.IOException as ex: pass try: clr.AddReference("ipybuild") except System.IO.IOException as ex: try: clr.AddReference("ipybuilder") except System.IO.IOException as ex: if f_ipy: print('IF .exe: ipybuild(er) reference error:\n\t' + \ 'check file | filepath') args = None rslt = None args = strCmd[2:] try: rslt = pyc.Main(args) except Exception as ex: errtyp = '' gsBuild.OK = False try: errtyp = ex.GetType().ToString() except Exception as exf: pass if ex: log.warn('pyc.Main err:\n' + ex.ToString()) log.warn('type {} or System Type {}'.format(type(ex), errtyp)) log.warn('Error: {}'.format(ex)) print 'ex-err' return False if rslt: return True else: po = subprocess.Popen(strCmd, stdout=PIPE, stderr=PIPE) stdout, stderr = po.communicate() po.wait() if stderr: log.warn('ERR\n {}:\n\t compiling with {}'.format(stderr, cmpfile)) po.kill() gsBuild.OK=False return False else: if gsBuild.Verbose or not gsBuild.INFO: log.info('\n - STDOUT - \n{}'.format(stdout)) po.kill() if dotExt and opex(opj(opd(compiler.mainoutdir), opb(cmpfile).replace('.py', dotExt))): log.FILE('Build Created: {}'.format(cmpfile.replace('.py', dotExt))) return True elif opex(cmpfile): log.FILE('Build Created: {}'.format(cmpfile)) return True else: gsBuild.OK = False return False
self.stack.append(fullname) if fnmatch.fnmatch(file, self.pattern): return fullname #""" #Build StdLib.DLL gb = glob.glob(r".\Lib\*.py") gb += glob.glob(r".\Lib\ctypes\*.py") gb += glob.glob(r".\Lib\json\*.py") gb += glob.glob(r".\Lib\encodings\*.py") gb.append("/out:StdLib") print[ "/target:dll", ] + gb pyc.Main(["/embed", "/platform:x86", "/target:dll"] + gb) print "Done Lib" #""" #Build EXE # for DEBUG #gb=["/main:QATracking.py","AddQACase.py","DBManager.py","JIRAParser.py","/embed","/standalone","/target:winexe"] # the "/standalone" option does not works properly, so use separated dlls #gb=["/main:3DSVideoConverter.py", "/embed","/platform:x86","/target:exe"] gb = [ "/main:3DSVideoConverter.py", "/embed", "/platform:x86", "/target:winexe" ] pyc.Main(gb) #CopyFiles to Release Directory #doscopy("PrivacyKeeper.ico") doscopy("WizardDialog.xaml")