如何从 python 创建支持多个 OSX 版本的 Mac .pkg
我正在尝试为 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不需要任何脚本 - 您可以单独使用包管理器来完成此操作 - 包管理器 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
underRequirements
)