From 0bece0f5e4c056c68d7fe44b1bc56551eaf827cc Mon Sep 17 00:00:00 2001 From: Andy Kipp Date: Sat, 29 Jun 2024 08:51:10 +0200 Subject: [PATCH] refactoring: move jobs to procs (#5547) #5538 Co-authored-by: a <1@1.1> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- CHANGELOG.rst | 2 +- docs/api/index.rst | 1 - tests/test_jobs.py | 2 +- tests/test_pipelines.py | 2 +- xonsh/aliases.py | 2 +- xonsh/main.py | 2 +- xonsh/{ => procs}/jobs.py | 0 xonsh/procs/pipelines.py | 2 +- xonsh/procs/posix.py | 2 +- xonsh/procs/specs.py | 2 +- xonsh/pytest/plugin.py | 2 +- 11 files changed, 9 insertions(+), 10 deletions(-) rename xonsh/{ => procs}/jobs.py (100%) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1160072fa..6cfeb2fe6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2488,7 +2488,7 @@ v0.8.10 terminal to close. This was problematic for certain command pipelines. For example, ``pv /dev/urandom | head`` now works. * Prevents recursive errors from being raised when there is no child process - in ``xonsh.jobs.wait_for_active_job()``. + in ``xonsh.procs.jobs.wait_for_active_job()``. * Tweaked ``xonsh.completers.commands.complete_skipper()`` to insert a space following certain tokens (``&&``, ``||``, ``|``, ``and``, ``or``) to avoid overwriting existing tokens with completer output. diff --git a/docs/api/index.rst b/docs/api/index.rst index 4b7aaa092..f2e56c37a 100644 --- a/docs/api/index.rst +++ b/docs/api/index.rst @@ -31,7 +31,6 @@ For those of you who want the gritty details. xonsh.environ xonsh.aliases xonsh.dirstack - xonsh.jobs xonsh.procs xonsh.inspectors xonsh.history diff --git a/tests/test_jobs.py b/tests/test_jobs.py index 71da0826f..aa374ed95 100644 --- a/tests/test_jobs.py +++ b/tests/test_jobs.py @@ -1,6 +1,6 @@ import pytest -from xonsh import jobs +from xonsh.procs import jobs @pytest.mark.parametrize( diff --git a/tests/test_pipelines.py b/tests/test_pipelines.py index 1cf35d965..089760ecb 100644 --- a/tests/test_pipelines.py +++ b/tests/test_pipelines.py @@ -13,7 +13,7 @@ from xonsh.pytest.tools import skip_if_on_unix, skip_if_on_windows @pytest.fixture(autouse=True) def patched_events(monkeypatch, xonsh_events, xonsh_session): - from xonsh.jobs import get_tasks + from xonsh.procs.jobs import get_tasks get_tasks().clear() # needed for ci tests diff --git a/xonsh/aliases.py b/xonsh/aliases.py index 416ca36ad..036f6d361 100644 --- a/xonsh/aliases.py +++ b/xonsh/aliases.py @@ -20,7 +20,6 @@ from xonsh.cli_utils import Annotated, Arg, ArgParserAlias from xonsh.dirstack import _get_cwd, cd, dirs, popd, pushd from xonsh.environ import locate_binary, make_args_env from xonsh.foreign_shells import foreign_shell_data -from xonsh.jobs import bg, clean_jobs, disown, fg, jobs from xonsh.lazyasd import lazyobject from xonsh.platform import ( IN_APPIMAGE, @@ -32,6 +31,7 @@ from xonsh.platform import ( ON_OPENBSD, ON_WINDOWS, ) +from xonsh.procs.jobs import bg, clean_jobs, disown, fg, jobs from xonsh.procs.specs import SpecAttrModifierAlias, SpecModifierAlias from xonsh.timings import timeit_alias from xonsh.tools import ( diff --git a/xonsh/main.py b/xonsh/main.py index 3037a0edf..2ec3c9bd8 100644 --- a/xonsh/main.py +++ b/xonsh/main.py @@ -17,11 +17,11 @@ from xonsh.environ import get_home_xonshrc_path, make_args_env, xonshrc_context from xonsh.events import events from xonsh.execer import Execer from xonsh.imphooks import install_import_hooks -from xonsh.jobs import ignore_sigtstp from xonsh.lazyasd import lazyobject from xonsh.lazyimps import pyghooks, pygments from xonsh.lib.pretty import pretty from xonsh.platform import HAS_PYGMENTS, ON_WINDOWS +from xonsh.procs.jobs import ignore_sigtstp from xonsh.shell import Shell from xonsh.timings import setup_timings from xonsh.tools import ( diff --git a/xonsh/jobs.py b/xonsh/procs/jobs.py similarity index 100% rename from xonsh/jobs.py rename to xonsh/procs/jobs.py diff --git a/xonsh/procs/pipelines.py b/xonsh/procs/pipelines.py index 6262c5c06..bb0ed8a77 100644 --- a/xonsh/procs/pipelines.py +++ b/xonsh/procs/pipelines.py @@ -9,9 +9,9 @@ import sys import threading import time -import xonsh.jobs as xj import xonsh.lazyasd as xl import xonsh.platform as xp +import xonsh.procs.jobs as xj import xonsh.tools as xt from xonsh.built_ins import XSH from xonsh.procs.readers import ConsoleParallelReader, NonBlockingFDReader, safe_fdclose diff --git a/xonsh/procs/posix.py b/xonsh/procs/posix.py index 209d4d2a4..fa561026f 100644 --- a/xonsh/procs/posix.py +++ b/xonsh/procs/posix.py @@ -14,7 +14,7 @@ import xonsh.lazyimps as xli import xonsh.platform as xp import xonsh.tools as xt from xonsh.built_ins import XSH -from xonsh.jobs import proc_untraced_waitpid +from xonsh.procs.jobs import proc_untraced_waitpid from xonsh.procs.readers import ( BufferedFDParallelReader, NonBlockingFDReader, diff --git a/xonsh/procs/specs.py b/xonsh/procs/specs.py index 0d31396ba..f51789319 100644 --- a/xonsh/procs/specs.py +++ b/xonsh/procs/specs.py @@ -13,10 +13,10 @@ import subprocess import sys import xonsh.environ as xenv -import xonsh.jobs as xj import xonsh.lazyasd as xl import xonsh.lazyimps as xli import xonsh.platform as xp +import xonsh.procs.jobs as xj import xonsh.tools as xt from xonsh.built_ins import XSH from xonsh.procs.pipelines import ( diff --git a/xonsh/pytest/plugin.py b/xonsh/pytest/plugin.py index 08aff1798..c073918e7 100644 --- a/xonsh/pytest/plugin.py +++ b/xonsh/pytest/plugin.py @@ -19,9 +19,9 @@ from xonsh.built_ins import XSH, XonshSession from xonsh.completer import Completer from xonsh.events import events from xonsh.execer import Execer -from xonsh.jobs import get_tasks from xonsh.main import setup from xonsh.parsers.completion_context import CompletionContextParser +from xonsh.procs.jobs import get_tasks from .tools import DummyHistory, DummyShell, copy_env, sp