updates to support 2/3 along with not using vcmd c extension
This commit is contained in:
parent
864c7b69a1
commit
ecc63f4abb
22 changed files with 680 additions and 636 deletions
|
@ -2,6 +2,7 @@
|
|||
Miscellaneous utility functions, wrappers around some subprocess procedures.
|
||||
"""
|
||||
|
||||
import fcntl
|
||||
import importlib
|
||||
import inspect
|
||||
import logging
|
||||
|
@ -10,8 +11,6 @@ import shlex
|
|||
import subprocess
|
||||
import sys
|
||||
|
||||
import fcntl
|
||||
|
||||
from core import CoreCommandError
|
||||
|
||||
DEVNULL = open(os.devnull, "wb")
|
||||
|
@ -126,7 +125,7 @@ def make_tuple_fromstr(s, value_type):
|
|||
"""
|
||||
Create a tuple from a string.
|
||||
|
||||
:param str|unicode s: string to convert to a tuple
|
||||
:param str s: string to convert to a tuple
|
||||
:param value_type: type of values to be contained within tuple
|
||||
:return: tuple from string
|
||||
:rtype: tuple
|
||||
|
@ -148,7 +147,9 @@ def split_args(args):
|
|||
:return: shell-like syntax list
|
||||
:rtype: list
|
||||
"""
|
||||
if isinstance(args, basestring):
|
||||
logging.info("split args: %s - %s", args, type(args))
|
||||
if isinstance(args, str):
|
||||
logging.info("splitting args")
|
||||
args = shlex.split(args)
|
||||
return args
|
||||
|
||||
|
@ -231,7 +232,7 @@ def check_cmd(args, **kwargs):
|
|||
status = p.wait()
|
||||
if status != 0:
|
||||
raise CoreCommandError(status, args, stdout)
|
||||
return stdout.strip()
|
||||
return stdout.decode("utf-8").strip()
|
||||
except OSError:
|
||||
raise CoreCommandError(-1, args)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue