mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 15:57:43 +03:00
pycompat: add empty and queue to handle py3 divergence
While the pycompat module will actually handle divergence, please access these properties from the util module: util.queue = Queue.Queue / queue.Queue util.empty = Queue.Empty / queue.Empty
This commit is contained in:
parent
3e185dc2e6
commit
9bbc2a69f1
18
mercurial/pycompat.py
Normal file
18
mercurial/pycompat.py
Normal file
@ -0,0 +1,18 @@
|
||||
# pycompat.py - portability shim for python 3
|
||||
#
|
||||
# This software may be used and distributed according to the terms of the
|
||||
# GNU General Public License version 2 or any later version.
|
||||
|
||||
"""Mercurial portability shim for python 3.
|
||||
|
||||
This contains aliases to hide python version-specific details from the core.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
try:
|
||||
import Queue as _queue
|
||||
except ImportError:
|
||||
import queue as _queue
|
||||
empty = _queue.Empty
|
||||
queue = _queue.Queue
|
@ -43,8 +43,15 @@ from . import (
|
||||
i18n,
|
||||
osutil,
|
||||
parsers,
|
||||
pycompat,
|
||||
)
|
||||
|
||||
for attr in (
|
||||
'empty',
|
||||
'queue',
|
||||
):
|
||||
globals()[attr] = getattr(pycompat, attr)
|
||||
|
||||
if os.name == 'nt':
|
||||
from . import windows as platform
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user