Rev 5180: (vila, for gz) Use signal only where available in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Apr 23 14:47:35 BST 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5180 [merge]
revision-id: pqm at pqm.ubuntu.com-20100423134732-e01c947fwuvjwtl2
parent: pqm at pqm.ubuntu.com-20100423111122-a5zc2qm7v9qrcxmf
parent: v.ladeuil+lp at free.fr-20100423115706-92becetyxzu3j147
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2010-04-23 14:47:32 +0100
message:
(vila, for gz) Use signal only where available
modified:
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py 2010-04-14 06:47:18 +0000
+++ b/bzrlib/osutils.py 2010-04-23 09:28:29 +0000
@@ -39,7 +39,6 @@
from shutil import (
rmtree,
)
-import signal
import socket
import subprocess
import tempfile
@@ -1366,7 +1365,12 @@
platform or Python version.
"""
try:
+ import signal
siginterrupt = signal.siginterrupt
+ except ImportError:
+ # This python implementation doesn't provide signal support, hence no
+ # handler exists
+ return None
except AttributeError:
# siginterrupt doesn't exist on this platform, or for this version
# of Python.
@@ -1483,18 +1487,20 @@
_registered_sigwinch = False
-
def watch_sigwinch():
- """Register for SIGWINCH, once and only once."""
+ """Register for SIGWINCH, once and only once.
+
+ Do nothing if the signal module is not available.
+ """
global _registered_sigwinch
if not _registered_sigwinch:
- if sys.platform == 'win32':
- # Martin (gz) mentioned WINDOW_BUFFER_SIZE_RECORD from
- # ReadConsoleInput but I've no idea how to plug that in
- # the current design -- vila 20091216
+ try:
+ import signal
+ if getattr(signal, "SIGWINCH", None) is not None:
+ set_signal_handler(signal.SIGWINCH, _terminal_size_changed)
+ except ImportError:
+ # python doesn't provide signal support, nothing we can do about it
pass
- else:
- set_signal_handler(signal.SIGWINCH, _terminal_size_changed)
_registered_sigwinch = True
More information about the bazaar-commits
mailing list