| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 46f63c3 commit b424f87
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,7 @@ | |||
| 4 | 4 | # This module is part of GitPython and is released under | |
| 5 | 5 | # the BSD License: http://www.opensource.org/licenses/bsd-license.php | |
| 6 | 6 | ||
| 7 | - import os, sys, platform, time | ||
| 7 | + import os, sys | ||
| 8 | 8 | from util import * | |
| 9 | 9 | from exc import GitCommandError | |
| 10 | 10 | ||
@@ -87,11 +87,7 @@ def wait(self): | |||
| 87 | 87 | """Wait for the process and return its status code. | |
| 88 | 88 | ||
| 89 | 89 | :raise GitCommandError: if the return status is not 0""" | |
| 90 | - | ||
| 91 | - #HACK: These two lines are necessary because OSX raises an error if you try to .wait() right after creating the process object. | ||
| 92 | - # It is only necessary when using GUI frameworks to instantiate an application. | ||
| 93 | - if platform.system().startswith("Darwin") and "pyside" in sys.modules.keys() or "PySide" in sys.modules.keys(): | ||
| 94 | - time.sleep(0.1) | ||
| 90 | + sleep_on_gui_present_osx_crashfix() | ||
| 95 | 91 | status = self.proc.wait() | |
| 96 | 92 | if status != 0: | |
| 97 | 93 | raise GitCommandError(self.args, status, self.proc.stderr.read()) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,6 +10,8 @@ | |||
| 10 | 10 | from exc import GitCommandError | |
| 11 | 11 | ||
| 12 | 12 | from gitdb.util import hex_to_bin | |
| 13 | + | ||
| 14 | + from util import sleep_on_gui_present_osx_crashfix | ||
| 13 | 15 | ||
| 14 | 16 | __all__ = ('Diffable', 'DiffIndex', 'Diff') | |
| 15 | 17 | ||
@@ -99,6 +101,7 @@ def diff(self, other=Index, paths=None, create_patch=False, **kwargs): | |||
| 99 | 101 | diff_method = Diff._index_from_patch_format | |
| 100 | 102 | index = diff_method(self.repo, proc.stdout) | |
| 101 | 103 | ||
| 104 | + sleep_on_gui_present_osx_crashfix() | ||
| 102 | 105 | status = proc.wait() | |
| 103 | 106 | return index | |
| 104 | 107 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,7 @@ | |||
| 21 | 21 | ) | |
| 22 | 22 | ||
| 23 | 23 | __all__ = ( "stream_copy", "join_path", "to_native_path_windows", "to_native_path_linux", | |
| 24 | - "join_path_native", "Stats", "IndexFileSHA1Writer", "Iterable", "IterableList", | ||
| 24 | + "join_path_native", "sleep_on_gui_present_osx_crashfix", "Stats", "IndexFileSHA1Writer", "Iterable", "IterableList", | ||
| 25 | 25 | "BlockingLockFile", "LockFile", 'Actor', 'get_user_id', 'assure_directory_exists', | |
| 26 | 26 | 'RemoteProgress') | |
| 27 | 27 | ||
@@ -101,6 +101,14 @@ def get_user_id(): | |||
| 101 | 101 | # END get username from login | |
| 102 | 102 | return "%s@%s" % (username, platform.node()) | |
| 103 | 103 | ||
| 104 | + def sleep_on_gui_present_osx_crashfix(): | ||
| 105 | + """This fixes a crash which appears when using pyside on OS X.""" | ||
| 106 | + | ||
| 107 | + #HACK: These two lines are necessary because OSX raises an error if you try to .wait() right after creating the process object. | ||
| 108 | + # It is only necessary when using GUI frameworks to instantiate an application. | ||
| 109 | + if platform.system().startswith("Darwin") and "PySide" in sys.modules.keys(): | ||
| 110 | + time.sleep(0.1) | ||
| 111 | + | ||
| 104 | 112 | #} END utilities | |
| 105 | 113 | ||
| 106 | 114 | #{ Classes | |
| Back | FazBrowse Home | New Git URL |
0 commit comments