本文整理汇总了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)