Switch to py3k absolute imports in _util module.
parent
79e3f6f6f5
commit
a4ffcebff8
18
src/_util.py
18
src/_util.py
|
@ -15,32 +15,36 @@
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Affero General Public License for more details.
|
# GNU Affero General Public License for more details.
|
||||||
'''
|
'''util.py
|
||||||
util.py
|
|
||||||
----------
|
----------
|
||||||
Extra utilities for python-gnupg.
|
Extra utilities for python-gnupg.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from inspect import currentframe
|
||||||
|
from inspect import getabsfile
|
||||||
from socket import gethostname
|
from socket import gethostname
|
||||||
|
from time import gmtime
|
||||||
|
from time import mktime
|
||||||
|
|
||||||
import codecs
|
import codecs
|
||||||
import encodings
|
import encodings
|
||||||
import os
|
import os
|
||||||
import time
|
|
||||||
import threading
|
import threading
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import _logger
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
|
|
||||||
|
from . import _logger
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
unicode
|
unicode
|
||||||
_py3k = False
|
_py3k = False
|
||||||
|
@ -321,7 +325,7 @@ def _make_passphrase(length=None, save=False, file=None):
|
||||||
if save:
|
if save:
|
||||||
ruid, euid, suid = os.getresuid()
|
ruid, euid, suid = os.getresuid()
|
||||||
gid = os.getgid()
|
gid = os.getgid()
|
||||||
now = time.mktime(time.gmtime())
|
now = mktime(gmtime())
|
||||||
|
|
||||||
if not file:
|
if not file:
|
||||||
filename = str('passphrase-%s-%s' % uid, now)
|
filename = str('passphrase-%s-%s' % uid, now)
|
||||||
|
@ -379,7 +383,7 @@ def _threaded_copy_data(instream, outstream):
|
||||||
|
|
||||||
def _utc_epoch():
|
def _utc_epoch():
|
||||||
"""Get the seconds since epoch for UTC."""
|
"""Get the seconds since epoch for UTC."""
|
||||||
return int(time.mktime(time.gmtime()))
|
return int(mktime(gmtime()))
|
||||||
|
|
||||||
def _which(executable, flags=os.X_OK):
|
def _which(executable, flags=os.X_OK):
|
||||||
"""Borrowed from Twisted's :mod:twisted.python.proutils .
|
"""Borrowed from Twisted's :mod:twisted.python.proutils .
|
||||||
|
|
Loading…
Reference in New Issue