Skip to content

Commit c864ca9

Browse files
author
Tymoteusz Jankowski
committed
Move is_exec_found(..) to dvc/dagascii.py
1 parent 8977958 commit c864ca9

File tree

3 files changed

+1
-17
lines changed

3 files changed

+1
-17
lines changed

dvc/dagascii.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from grandalf.routing import route_with_lines
1717

1818
from dvc.env import DVC_PAGER
19-
from dvc.utils import is_exec_found
2019

2120

2221
logger = logging.getLogger(__name__)
@@ -32,7 +31,7 @@ def find_pager():
3231
if not sys.stdout.isatty():
3332
return pydoc.plainpager
3433

35-
if is_exec_found(DEFAULT_PAGER):
34+
if os.system("({}) 2>{}".format(DEFAULT_PAGER, os.devnull)) == 0:
3635
pager_cmd = os.getenv(DVC_PAGER, DEFAULT_PAGER_FORMATTED)
3736

3837
def less_pager(text):

dvc/utils/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,3 @@ def resolve_output(inp, out):
420420
if os.path.isdir(out):
421421
return os.path.join(out, name)
422422
return out
423-
424-
425-
def is_exec_found(exec_name):
426-
cmd = "({}) 2>{}".format(exec_name, os.devnull)
427-
return os.system(cmd) == 0

tests/func/test_utils.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,3 @@ def test_makedirs_permissions(tmpdir):
8888

8989
assert stat.S_IMODE(os.stat(test_dir).st_mode) == dir_mode
9090
assert stat.S_IMODE(os.stat(intermediate_dir).st_mode) == dir_mode
91-
92-
93-
def test_is_exec_found_returns_true_when_program_exists():
94-
result = utils.is_exec_found("echo")
95-
assert result is True
96-
97-
98-
def test_is_exec_found_returns_false_when_program_is_missing():
99-
result = utils.is_exec_found("some-missing-program")
100-
assert result is False

0 commit comments

Comments
 (0)