如何在 Mac 上安装 python 补丁

发布于 2024-10-20 16:25:24 字数 305 浏览 1 评论 0原文

IDLE 在 mac 上有上下文菜单右键单击错误(Tk 问题)
已经针对此问题发布了补丁:issue 10404
我已经下载了补丁(issue10404-idle_no_context_menus.txt) - 位置和方式我要安装它吗?
提前致谢。

IDLE has the contextual menu right-click bug on mac (Tk problem)
There is already a patch issued for this problem: issue 10404
I've downloaded the patch (issue10404-idle_no_context_menus.txt) - where and how do I install it?
Thanks in advance.

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

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

发布评论

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

评论(2

安穩 2024-10-27 16:25:24

在文件系统中查找 EditorWindow.py 文件(find / -name EditorWindow.py 如果您完全不知道它可能存在的位置); cd 到它所在的目录,然后运行:

patch --dry-run < ~/path/to/issue10401-idle_no_context_menus.txt

如果成功,去掉 --dry-run 并重新运行该命令。如果未成功,请尝试添加 -P2-P3-P1。 ( -P 表示忽略补丁中指定的 目录,我永远记不清它是如何工作的,所以我只是摆弄--dry-run 和选项,直到它起作用:)

如果由于您的版本与补丁文件中的“预”版本不完全匹配而导致补丁无法完全应用,您可以这样做。编辑文件并“手动应用差异”——进行相同类型的更改,但要考虑可能发生的更改。有时只是缩进级别发生了变化,所以这可能很容易,有时整个逻辑不同,尝试使补丁适合是没有意义的。

Find the EditorWindow.py file in your filesystem (find / -name EditorWindow.py if you're completely in the dark about where it might live); cd into it's containing directory, then run:

patch --dry-run < ~/path/to/issue10401-idle_no_context_menus.txt

If it succeeds, take off the --dry-run and re-run the command. If it didn't succeed, try adding -P2, -P3 or -P1. (The -P<n> says to ignore the <n> directories named in the patch, and I can never remember exactly how it works, so I just fiddle with --dry-run and the options until it works. :)

If the patch doesn't cleanly apply because your version doesn't match the 'pre' version in the patch file exactly, you can just edit the file and "apply the diff by hand" -- make the same kinds of changes it does, but accounting for whatever might have changed. Sometimes it is just an indentation level that changed, so it could be easy, sometimes the entire logic is different, and it is pointless to try to make the patch fit.

雨落星ぅ辰 2024-10-27 16:25:24

该补丁与源代码不同。在本例中,它是一个 Python 文件,因此您找到有问题的 Python 文件 (Lib/idlelib/EditorWindow.py) 并使用 patch 命令对其进行修补。

一般来说,这些类型的补丁用于 Python 源代码的开发签出,它们可能需要您签出 Python 源代码并从 svn 编译它。这取决于您安装的版本和补丁通常所基于的主干版本之间代码发生了多少变化。

This patches are diffs against the source code. In this case its a Python file, so you find the Python file in question (Lib/idlelib/EditorWindow.py) and use the patch command to patch it.

In general these kinds of patches are to be used on development checkouts of the Python source code, and they may require you to check out the Python source and compile it from the svn. It depends on how much the code has changed between the version you have installed and the trunk version on which the patch usually is based.

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