verbose_mode from config.py
Also, no return value supposed for execute_stdout
This commit is contained in:
parent
b88824a70c
commit
0f29d9f30f
1 changed files with 5 additions and 11 deletions
|
@ -12,7 +12,7 @@ import urllib2
|
||||||
import os
|
import os
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
verbose_mode = False
|
from config import is_verbose_mode
|
||||||
|
|
||||||
def tempdir(prefix=''):
|
def tempdir(prefix=''):
|
||||||
directory = tempfile.mkdtemp(prefix=prefix)
|
directory = tempfile.mkdtemp(prefix=prefix)
|
||||||
|
@ -20,12 +20,6 @@ def tempdir(prefix=''):
|
||||||
return directory
|
return directory
|
||||||
|
|
||||||
|
|
||||||
def enable_verbose_execute():
|
|
||||||
print 'Running in verbose mode'
|
|
||||||
global verbose_mode
|
|
||||||
verbose_mode = True
|
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def scoped_cwd(path):
|
def scoped_cwd(path):
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
|
@ -132,11 +126,11 @@ def safe_mkdir(path):
|
||||||
|
|
||||||
|
|
||||||
def execute(argv):
|
def execute(argv):
|
||||||
if verbose_mode:
|
if is_verbose_mode():
|
||||||
print ' '.join(argv)
|
print ' '.join(argv)
|
||||||
try:
|
try:
|
||||||
output = subprocess.check_output(argv, stderr=subprocess.STDOUT)
|
output = subprocess.check_output(argv, stderr=subprocess.STDOUT)
|
||||||
if verbose_mode:
|
if is_verbose_mode():
|
||||||
print output
|
print output
|
||||||
return output
|
return output
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
|
@ -145,7 +139,7 @@ def execute(argv):
|
||||||
|
|
||||||
|
|
||||||
def execute_stdout(argv):
|
def execute_stdout(argv):
|
||||||
if verbose_mode:
|
if is_verbose_mode():
|
||||||
print ' '.join(argv)
|
print ' '.join(argv)
|
||||||
try:
|
try:
|
||||||
subprocess.check_call(argv)
|
subprocess.check_call(argv)
|
||||||
|
@ -153,7 +147,7 @@ def execute_stdout(argv):
|
||||||
print e.output
|
print e.output
|
||||||
raise e
|
raise e
|
||||||
else:
|
else:
|
||||||
return execute(argv)
|
execute(argv)
|
||||||
|
|
||||||
|
|
||||||
def get_atom_shell_version():
|
def get_atom_shell_version():
|
||||||
|
|
Loading…
Reference in a new issue