本文整理汇总了Python中bbfreeze.Freezer类的典型用法代码示例。如果您正苦于以下问题:Python Freezer类的具体用法?Python Freezer怎么用?Python Freezer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Freezer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
def run(self, wininst=False):
# import bbfreeze only thenabout to run the command
from bbfreeze import Freezer
# get information from egg_info
ei = self.get_finalized_command("egg_info")
target = normalize_path(self.bdist_base)
dist = Distribution(
target,
PathMetadata(target, os.path.abspath(ei.egg_info)),
project_name=ei.egg_name)
# install wrapper_Scripts into self.bdist_base == self.script_dir
self.install_wrapper_scripts(dist)
# now get a Freezer()
f = Freezer(os.path.join(self.dist_dir,
"%s-%s" % (ei.egg_name, ei.egg_version)))
f.include_py = self.include_py
# freeze each of the scripts
for args in get_script_args(dist, wininst=wininst):
name = args[0]
if name.endswith('.exe') or name.endswith(".exe.manifest"):
# skip .exes
continue
log.info('bbfreezing %s', os.path.join(self.script_dir, name))
f.addScript(os.path.join(self.script_dir, name),
gui_only=name.endswith('.pyw'))
# starts the freezing process
f()
示例2: _createBinaryDistribution
def _createBinaryDistribution(self, startScripts):
"""
Creates a binary DataFinder distribution for Linux/Windows platforms
including the Python interpreter.
@param startScripts: Contains a list of start scripts for which executables are generated. The scripts
are described by tuples of script path and a boolean indicating whether
on the Windows platform a console window is visible or not.
@type startScripts: C{list} of C{tuple} (C{unicode}/C{string}, C{bool})
"""
forcedIncludes = _forcedIncludes[:]
forcedIncludes.extend(_qtSpecificForcedIncludes)
if sys.platform == "win32":
forcedIncludes.extend(_win32ForcedIncludes)
freezer = Freezer(self.destinationPath, includes=forcedIncludes)
freezer.include_py = not self.excludepythonshell
for scriptPath, guiOnly in startScripts:
freezer.addScript(scriptPath, gui_only=guiOnly)
# create distribution
freezer()
# copy readme, license, changes files
shutil.copy(self.__buildConfiguration.readmeFile, self.destinationPath)
shutil.copy(self.__buildConfiguration.licenseFile, self.destinationPath)
shutil.copy(self.__buildConfiguration.changesFile, self.destinationPath)
# copy image, example script files
destinationImagePath = os.path.join(self.destinationPath, self.__buildConfiguration.imageDirectory)
os.makedirs(destinationImagePath)
baseImageDir = self.__buildConfiguration.imageDirectory
for imageName in os.listdir(baseImageDir):
if imageName.endswith(".ico"):
shutil.copy(os.path.join(baseImageDir, imageName), destinationImagePath)
scriptsExampleDir = self.__buildConfiguration.scriptExamplesDirectory
shutil.copytree(scriptsExampleDir, os.path.join(self.destinationPath, scriptsExampleDir))
docDir = "doc"
shutil.copytree(docDir, os.path.join(self.destinationPath, docDir))
shutil.rmtree(docDir)
# create manifest files
if sys.platform == "win32":
scriptNames = [startScript[0] for startScript in startScripts]
if not self.excludepythonshell:
scriptNames.append("py.py")
for scriptName in scriptNames:
fileExtension = ".exe.manifest"
content = _MANIFEST_FILE_CONTENT
fileBaseName = os.path.basename(scriptName).replace(".py", fileExtension)
filePath = os.path.join(self.destinationPath, fileBaseName)
fileHandle = open(filePath, "wb")
fileHandle.write(content)
fileHandle.close()
示例3: main
def main():
#includes = ['requests', 'email.utils']
includes = ['requests', 'email.utils']
excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl', 'tk'
'Tkconstants', 'Tkinter',]
frz = Freezer(destDir, includes=includes, excludes=excludes)
#frz.addScript("meteor.py", gui_only=True)
frz.addScript("play_development.py")
frz.addScript("play_fullscreen.py", gui_only=True)
frz.addScript("play_windowed.py", gui_only=True)
#frz.addScript("gameassets.py")
#frz.addScript("geoip.py")
#frz.addScript("shipsprite.py")
#frz.addScript("sprites.py")
#frz.addScript("timevars.py")
#frz.addScript("vector.py")
frz.use_compression = 0
frz.include_py = True
frz()
addFile('config.json')
addFile('avbin.dll')
#addDir('images')
#addDir('fonts')
#addDir('sounds')
addDir('themes')
示例4: do_build_exe
def do_build_exe(self):
Freezer.__init__(self, self.dist_dir,
includes=self.includes,
excludes=self.excludes,
)
self.addScript(SCRIPT_NAME, gui_only=True)
self.setIcon('pixmaps/app-o-cloud-32.ico')
Freezer.__call__(self)
if self.distribution.has_data_files():
print "*** copy data files ***"
install_data = self.reinitialize_command('install_data')
install_data.install_dir = self.dist_dir
install_data.ensure_finalized()
install_data.run()
示例5: run
def run(self):
from bbfreeze import Freezer
freezer = Freezer(distdir = self.dist_dir,
includes = self.includes,
excludes = self.excludes)
freezer.include_py = self.include_py
if self.distribution.scripts:
for script in self.distribution.scripts:
freezer.addScript(script, gui_only = False)
# execute freeze
freezer()
# include extra libs - hack for Unix
if self.extra_libs:
print "extra_libs: ", self.extra_libs
for lib in self.extra_libs:
shutil.copy(lib, self.dist_dir)
# include data_files
if self.data_files:
print "data_files: ", self.data_files
for df in self.data_files:
shutil.copy(df, self.dist_dir)
示例6: Freezer
#!/usr/bin/env python
from bbfreeze import Freezer
includes = ['zmq', 'zmq.utils.strtypes', 'zmq.utils.jsonapi']
excludes = ['Tkinter', 'tcl', 'Tkconstants']
fre = Freezer(distdir="bb_salt", includes=includes, excludes=excludes)
fre.addScript('/usr/bin/salt-minion')
fre.use_compression = 0
fre.include_py = True
fre()
示例7: Freezer
from bbfreeze import Freezer
f = Freezer('youkuv', excludes=('twisted',))
f.addScript("youkuv.py")
f()
示例8: Freezer
#!/usr/bin/env python
import os
import shutil
import sys
from bbfreeze import Freezer
build_version = "1.4.3"
python_path = sys.prefix
script = os.path.join(python_path, "Scripts\\livestreamer-script.py")
script_exe = os.path.join(python_path, "Scripts\\livestreamer.py")
shutil.copy(script, script_exe)
includes = ("requests", "re", "xml", "xml.dom.minidom",
"zlib", "ctypes", "argparse", "hmac", "tempfile",
"os", "sys", "subprocess", "getpass", "msvcrt",
"urllib", "urlparse", "pkgutil", "imp")
dst = "..\\build-win32\\livestreamer-bbfreeze-" + build_version + "\\"
f = Freezer(dst, includes=includes)
f.include_py = False
f.addScript(script_exe, gui_only=False)
f()
示例9: setup
setup(
windows = windows,
options = options,
version=_appVersion,
description=_appDescription,
author=_authorName,
author_email=_authorEmail,
url=_authorURL,
data_files=matplotlibdata_files+data_files,
)
if sys.platform.startswith("2linux"):
# bb_setup.py
from bbfreeze import Freezer
f = Freezer(distdir="bb-binary")
f.addScript("RemoteViewer.py")
f()
if sys.platform.startswith("linux"):
### example command: python setup.py build
includes = ['matplotlib','mpl_toolkits','matplotlib.backends.backend_tkagg']
includefiles = []
from cx_Freeze import setup, Executable
### use to get rid of library.zip and move into the executable, along with appendScriptToLibrary and appendScriptToExe
#buildOptions = dict(create_shared_zip = False)
setup(
name = _appName,
version=_appVersion,
示例10: Freezer
#!/usr/bin/env python
from bbfreeze import Freezer
f = Freezer("miasmod")
f.addScript("miasmod.py", gui_only=True)
# f.addScript("miasmod.py", gui_only=False)
f()
# vi:noexpandtab:sw=8:ts=8
示例11: Freezer
from distutils.core import setup
from bbfreeze import Freezer
import os
#vers=os.system('svnversion -n')
#print vers
#Binary dist
f = Freezer("../bin")
f.addScript("GLOFRIS.py")
#f.addScript("GLOFRIS_utils.py")
#f.addScript("changeGLCC.py")
#f.addScript("GLCC2PCRGLOB.py")
#f.addScript("GLOFRIS_risk.py")
#f.addScript("post_proc.py")
f() # starts the freezing process
示例12: Freezer
from bbfreeze import Freezer
import shutil
distdir = "dist"
freeze = Freezer(
distdir=distdir, includes=("enthought.tvtk.pyface.ui.wx.decorated_scene", "enthought.tvtk.tvtk", "vtk")
)
freeze.addScript("app.py", gui_only=True)
freeze()
shutil.copytree("./examples", distdir + "/examples")
示例13: Freezer
#!/usr/bin/env python
build_version = "1.3.2"
python_path = "C:\\Python27\\"
import os
import glob
import shutil
from bbfreeze import Freezer
shutil.copy(python_path + "Scripts\livestreamer-script.py", python_path + "Scripts\livestreamer.py")
includes = ("pbs", "requests", "re", "xml", "xml.dom.minidom",
"zlib", "ctypes", "argparse", "hmac", "tempfile",
"os", "sys", "subprocess", "getpass", "msvcrt",
"urllib", "urlparse", "pkgutil", "imp")
dst = "..\\build-win32\\livestreamer-bbfreeze-" + build_version + "\\"
f = Freezer(dst, includes=includes)
f.include_py = False
f.addScript(python_path + "Scripts\livestreamer.py", gui_only=False)
f()
示例14: find_n_fix_missing
from bbfreeze import Freezer
import shutil, glob, os, sys, subprocess
def find_n_fix_missing(libs):
missing = []
for f in libs:
output = subprocess.Popen(['otool', '-XL', f], stdout=subprocess.PIPE).communicate()[0]
for line in output.splitlines():
libpath = line.strip().split(" ")[0]
if libpath != f and libpath[0] != "/" and libpath[0] != "@":
if not libpath in missing and not '.framework' in libpath:
missing.append(libpath)
shutil.copy(os.path.join('/usr/lib', libpath), libpath)
subprocess.Popen(['install_name_tool', '-change', libpath, "@executable_path/" + libpath, f])
if missing:
find_n_fix_missing(missing)
includes = []
excludes = ['Tkinter', 'readline']
freezer = Freezer('dist/freeze/Config_Editor', includes=includes, excludes=excludes)
freezer.addScript('src/configeditor.py', gui_only=True)
freezer.include_py = False
freezer.use_compression = True
freezer()
if sys.platform == 'darwin':
os.chdir(freezer.distdir)
find_n_fix_missing(glob.glob("*.so") + glob.glob("*.dylib"))
示例15: Freezer
#easy_install bbfreeze
from bbfreeze import Freezer
f = Freezer("dist")
f.addScript('pyroller/pyroller.py')
f()
#python setup.py
#creates a dsit directory wtih libs, using root fil pyroller/pyroller.py
#matplotlib.numerix import error fix
#in file /usr/local/lib/python2.7/dist-packages/bbfreeze-1.1.3-py2.7.egg/bbfreeze/recipes
#wrap this lline mf.import_hook("matplotlib.numerix.random_array", m)
#in an try/except ImportError