如何从 python 创建支持多个 OSX 版本的 Mac .pkg

发布于 2025-01-07 18:53:48 字数 491 浏览 2 评论 0原文

我正在尝试为 python 应用程序(特别是 Spyderlib)创建一个 .pkg 安装程序。这不是一个应用程序,而是一个 python 包和一个命令行可执行文件,必须复制到特定位置。

但是,该位置取决于 OSX 的版本。我只针对 10.6 和 10.7,但它们附带不同版本的 python(2.6 和 2.7),因此安装路径不同。

使用 bdist_mpkg 我能够在 10.7 中创建一个 Mac mpkg,它可以正确安装并且可以使用 PackageMaker 进行编辑。现在我想知道如何编辑这个包,以便它检测 OSX 的版本并正确设置安装目标路径。

我知道我可以使用 shell 脚本来执行安装前和安装后作业,但是我无法找到如何执行此操作以及脚本如何用于设置 mpkg 中文件的安装目标的示例。

或者,这可能可以直接从 PackageMaker 完成,但我看不到任何与此效果相关的内容(并且文档似乎非常肤浅)。

所以我想知道如何做到这一点。查看其他软件包的一些示例也会非常有帮助。

I am trying to create a .pkg installer for a python application (specifically Spyderlib). This is not an app but a python package and a command line executable that have to be copied to specific locations.

However, the location depends on the version of OSX. I'm only targeting 10.6 and 10.7 but they come with different versions of python (2.6 and 2.7) so the install path is different.

Using bdist_mpkg I was able to create a Mac mpkg in 10.7 which installs correctly and can be edited with PackageMaker. Now I want to know how I can edit this package so that it detects the version of OSX and sets the install target path correctly.

I understand that I can use shell scripts to do pre and post-installation jobs, however I haven't been able to find examples of how to do this and how a script could but used to set the install target for the files in the mpkg.

Alternatively, it may be that this is possible to do directly from PackageMaker, but i was not able to see anything to this effect (and the documentation seems quite superficial).

So I would like to know how this could be done. It would also be really helpful to see some examples for other software packages.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

勿忘心安 2025-01-14 18:53:48

您不需要任何脚本 - 您可以单独使用包管理器来完成此操作 - 包管理器 GUI 允许您将包标记为可安装(已启用)并根据操作系统版本等条件进行选择(在 Choices 中)在要求下)

You don't need any scripts - you can do that with Package Manager alone - the Package Manager GUI allows you to tag packages as installable (enabled) and selected based on conditions such as OS version (in Choices under Requirements)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文