py2app处方

2024-04-24 23:04:18 发布

您现在位置:Python中文网/ 问答频道 /正文

py2app documentation提到了由__boot__.py在主python脚本之前运行的脚本。我找不到一个简单的方法来指定设置.py文件或生成过程。在

不过,我确实设法手动地“黑改”__boot__.py,并在我的主_run(main_script)之前添加了另一个_run(prescript)命令,它似乎工作得很好。不过,使用标准的py2app构建过程会更好。在

我基本上想做的是对我的网站进行猴子补丁-软件包.zip在启动主脚本之前。这个脚本基本上检查服务器上的更新,如果有,下载它们,然后覆盖站点-软件包.zip文件。比从头开始重新安装应用程序要快得多。在

有什么想法吗?在


Tags: 文件方法runpy脚本main过程documentation
1条回答
网友
1楼 · 发布于 2024-04-24 23:04:18

请参见the docs:您的py2app.recipes包必须包含一个配方,该配方的check方法返回一个dict,包括'prescripts'键,其值为,我引用

A list of additional Python scripts to run before initializing the main script. This is often used to monkey-patch included modules so that they work in a frozen environment. The prescripts may be module names, file names, or file-like objects containing Python code (e.g. StringIO). Note that if a file-like object is used, it will not currently be scanned for additional dependencies.

有关示例,请参见the built-in recipes sources。你需要自己的食谱安装在你的机器上。在

相关问题 更多 >