From a9fa0d911da6d9f016e96410affd7824691c82ac Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 14 Sep 2024 03:17:28 +0200 Subject: [PATCH] shell/env --- spcd/__init__.py | 4 +--- spcd/__main__.py | 4 ++-- spcd/cmd.py | 2 +- spcd/shell.py | 5 +++++ spcd/util.py | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 spcd/shell.py diff --git a/spcd/__init__.py b/spcd/__init__.py index 11db87f..fbb64e7 100644 --- a/spcd/__init__.py +++ b/spcd/__init__.py @@ -2,7 +2,6 @@ __version__ = "0.0.1" -import importlib import sys from os import environ, pathsep from pathlib import Path @@ -13,10 +12,9 @@ from rwx.ps import run from spcd import cmd from spcd.ci import project, projects +from spcd.shell import env from spcd.util import browse, cat, split, step -env = importlib.import_module("env") - COMMANDS_PREFIX = "spcd-" diff --git a/spcd/__main__.py b/spcd/__main__.py index 520540c..510aeb9 100755 --- a/spcd/__main__.py +++ b/spcd/__main__.py @@ -2,11 +2,11 @@ """Entry point.""" -import importlib import sys +from spcd.shell import env + if __name__ == "__main__": - env = importlib.import_module("env") if env.SPCD_PYTHON_VENV_PACKAGES not in sys.path: sys.path.insert(0, env.SPCD_PYTHON_VENV_PACKAGES) from spcd import main diff --git a/spcd/cmd.py b/spcd/cmd.py index fe00db4..a72287b 100644 --- a/spcd/cmd.py +++ b/spcd/cmd.py @@ -5,8 +5,8 @@ from pathlib import Path from rwx import ps -from spcd import env from spcd.ci import project, projects +from spcd.shell import env from spcd.util import browse diff --git a/spcd/shell.py b/spcd/shell.py new file mode 100644 index 0000000..f9f9b33 --- /dev/null +++ b/spcd/shell.py @@ -0,0 +1,5 @@ +"""Shell for environment module.""" + +import importlib + +env = importlib.import_module("env") diff --git a/spcd/util.py b/spcd/util.py index dd29da4..a77691a 100644 --- a/spcd/util.py +++ b/spcd/util.py @@ -7,7 +7,7 @@ from urllib.parse import urlparse, urlunparse from rwx import fs from rwx.log import stream as log -from spcd import env +from spcd.shell import env def add_url_path(url: str, extra_path: str) -> str: