mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 23:10:42 +01:00
Move is_exec_found(..) to dvc/dagascii.py
This commit is contained in:
+1
-2
@@ -16,7 +16,6 @@ from grandalf.routing import EdgeViewer
|
||||
from grandalf.routing import route_with_lines
|
||||
|
||||
from dvc.env import DVC_PAGER
|
||||
from dvc.utils import is_exec_found
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -32,7 +31,7 @@ def find_pager():
|
||||
if not sys.stdout.isatty():
|
||||
return pydoc.plainpager
|
||||
|
||||
if is_exec_found(DEFAULT_PAGER):
|
||||
if os.system("({}) 2>{}".format(DEFAULT_PAGER, os.devnull)) == 0:
|
||||
pager_cmd = os.getenv(DVC_PAGER, DEFAULT_PAGER_FORMATTED)
|
||||
|
||||
def less_pager(text):
|
||||
|
||||
@@ -420,8 +420,3 @@ def resolve_output(inp, out):
|
||||
if os.path.isdir(out):
|
||||
return os.path.join(out, name)
|
||||
return out
|
||||
|
||||
|
||||
def is_exec_found(exec_name):
|
||||
cmd = "({}) 2>{}".format(exec_name, os.devnull)
|
||||
return os.system(cmd) == 0
|
||||
|
||||
@@ -88,13 +88,3 @@ def test_makedirs_permissions(tmpdir):
|
||||
|
||||
assert stat.S_IMODE(os.stat(test_dir).st_mode) == dir_mode
|
||||
assert stat.S_IMODE(os.stat(intermediate_dir).st_mode) == dir_mode
|
||||
|
||||
|
||||
def test_is_exec_found_returns_true_when_program_exists():
|
||||
result = utils.is_exec_found("echo")
|
||||
assert result is True
|
||||
|
||||
|
||||
def test_is_exec_found_returns_false_when_program_is_missing():
|
||||
result = utils.is_exec_found("some-missing-program")
|
||||
assert result is False
|
||||
|
||||
Reference in New Issue
Block a user