Make help commands in settings compatible with Python 3.4
This commit is contained in:
parent
9ee6f631dc
commit
fa462f885d
@ -38,10 +38,11 @@ class BaseInfo:
|
||||
@classmethod
|
||||
def help_params(cls, executable):
|
||||
try:
|
||||
p = subprocess.run([executable, '-h'], universal_newlines=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
||||
env=dict(os.environ, COLUMNS='125'))
|
||||
text = p.stdout
|
||||
text = subprocess.check_output([executable, '-h'], universal_newlines=True,
|
||||
stderr=subprocess.STDOUT,
|
||||
env=dict(os.environ, COLUMNS='125'))
|
||||
except subprocess.CalledProcessError as e:
|
||||
text = e.output
|
||||
except OSError:
|
||||
text = '{} executable not found!'.format(executable)
|
||||
return text
|
||||
|
@ -46,17 +46,15 @@ class Info(BaseInfo):
|
||||
@classmethod
|
||||
def help_device(cls, executable, device):
|
||||
try:
|
||||
text = ''
|
||||
p = subprocess.run([executable, '--detect'], universal_newlines=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
|
||||
env=dict(os.environ, COLUMNS='125'))
|
||||
text += p.stdout + '\n'
|
||||
|
||||
if p.returncode == 0:
|
||||
p = subprocess.run([executable, '--device', device, '--info'], universal_newlines=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
|
||||
env=dict(os.environ, COLUMNS='125'))
|
||||
text += p.stdout
|
||||
text = subprocess.check_output([executable, '--detect'], universal_newlines=True,
|
||||
stderr=subprocess.DEVNULL,
|
||||
env=dict(os.environ, COLUMNS='125'))
|
||||
text += '\n'
|
||||
text += subprocess.check_output([executable, '--device', device, '--info'], universal_newlines=True,
|
||||
stderr=subprocess.DEVNULL,
|
||||
env=dict(os.environ, COLUMNS='125'))
|
||||
except subprocess.CalledProcessError as e:
|
||||
text = e.output
|
||||
except OSError:
|
||||
text = '{} executable not found!'.format(executable)
|
||||
return text
|
||||
|
Loading…
Reference in New Issue
Block a user