本文整理匯總了Python中cx_Freeze.setup方法的典型用法代碼示例。如果您正苦於以下問題:Python cx_Freeze.setup方法的具體用法?Python cx_Freeze.setup怎麽用?Python cx_Freeze.setup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cx_Freeze
的用法示例。
在下文中一共展示了cx_Freeze.setup方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: build_cx_freeze
# 需要導入模塊: import cx_Freeze [as 別名]
# 或者: from cx_Freeze import setup [as 別名]
def build_cx_freeze(
self, cleanup=True, create_archive=None
):
"""Build executable with cx_Freeze
cleanup: remove 'build/dist' directories before building distribution
create_archive (requires the executable `zip`):
* None or False: do nothing
* 'add': add target directory to a ZIP archive
* 'move': move target directory to a ZIP archive
"""
assert (
not self._py2exe_is_loaded
), "cx_Freeze can't be executed after py2exe"
from cx_Freeze import setup
if cleanup:
self.__cleanup()
sys.argv += ["build"]
build_exe = dict(
include_files=to_include_files(self.data_files),
includes=self.includes,
excludes=self.excludes,
bin_excludes=self.bin_excludes,
bin_includes=self.bin_includes,
bin_path_includes=self.bin_path_includes,
bin_path_excludes=self.bin_path_excludes,
build_exe=self.target_dir,
)
setup(
name=self.name,
version=self.version,
description=self.description,
executables=self.executables,
options=dict(build_exe=build_exe),
)
if create_archive:
self.__create_archive(create_archive)
示例2: main
# 需要導入模塊: import cx_Freeze [as 別名]
# 或者: from cx_Freeze import setup [as 別名]
def main():
"""main"""
cx_Freeze.setup(**SETUP_ARGS)
示例3: build_py2exe
# 需要導入模塊: import cx_Freeze [as 別名]
# 或者: from cx_Freeze import setup [as 別名]
def build_py2exe(
self,
cleanup=True,
compressed=2,
optimize=2,
company_name=None,
copyright=None,
create_archive=None,
):
"""Build executable with py2exe
cleanup: remove 'build/dist' directories before building distribution
create_archive (requires the executable `zip`):
* None or False: do nothing
* 'add': add target directory to a ZIP archive
* 'move': move target directory to a ZIP archive
"""
from distutils.core import setup
import py2exe # Patching distutils -- analysis:ignore
self._py2exe_is_loaded = True
if cleanup:
self.__cleanup()
sys.argv += ["py2exe"]
options = dict(
compressed=compressed,
optimize=optimize,
includes=self.includes,
excludes=self.excludes,
dll_excludes=self.bin_excludes,
dist_dir=self.target_dir,
)
windows = dict(
name=self.name,
description=self.description,
script=self.script,
icon_resources=[(0, self.icon)],
bitmap_resources=[],
other_resources=[],
dest_base=osp.splitext(self.target_name)[0],
version=self.version,
company_name=company_name,
copyright=copyright,
)
setup(
data_files=self.data_files,
windows=[windows],
options=dict(py2exe=options),
)
if create_archive:
self.__create_archive(create_archive)