From e1c7d88c5c61f952c1589fe5b2df4b13fb26c00c Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Mon, 16 Aug 2021 10:46:12 +0100 Subject: [PATCH 01/65] nushell activation scripts --- src/virtualenv/activation/__init__.py | 2 ++ src/virtualenv/activation/nushell/__init__.py | 13 ++++++++ src/virtualenv/activation/nushell/activate.nu | 32 +++++++++++++++++++ .../activation/nushell/deactivate.nu | 7 ++++ 4 files changed, 54 insertions(+) create mode 100644 src/virtualenv/activation/nushell/__init__.py create mode 100644 src/virtualenv/activation/nushell/activate.nu create mode 100644 src/virtualenv/activation/nushell/deactivate.nu diff --git a/src/virtualenv/activation/__init__.py b/src/virtualenv/activation/__init__.py index 962cdf794..9120935f2 100644 --- a/src/virtualenv/activation/__init__.py +++ b/src/virtualenv/activation/__init__.py @@ -6,6 +6,7 @@ from .fish import FishActivator from .powershell import PowerShellActivator from .python import PythonActivator +from .nushell import NushellActivator __all__ = [ "BashActivator", @@ -14,4 +15,5 @@ "PythonActivator", "BatchActivator", "FishActivator", + "NushellActivator", ] diff --git a/src/virtualenv/activation/nushell/__init__.py b/src/virtualenv/activation/nushell/__init__.py new file mode 100644 index 000000000..aae050f16 --- /dev/null +++ b/src/virtualenv/activation/nushell/__init__.py @@ -0,0 +1,13 @@ +from __future__ import absolute_import, unicode_literals + +from virtualenv.util.path import Path + +from ..via_template import ViaTemplateActivator + + +class NushellActivator(ViaTemplateActivator): + def templates(self): + yield Path("activate.nu") + + def as_name(self, template): + return template.stem diff --git a/src/virtualenv/activation/nushell/activate.nu b/src/virtualenv/activation/nushell/activate.nu new file mode 100644 index 000000000..8d38f5603 --- /dev/null +++ b/src/virtualenv/activation/nushell/activate.nu @@ -0,0 +1,32 @@ +# Setting all environment variables for the venv +let virtual_env = __VIRTUAL_ENV__ + +let is_windows = (sys).host.name == "Windows" +let path-sep = (if $is_windows { ";" } { ":" }) + +let venv-abs-dir = ($virtual_env | path expand) +let venv-name = ($venv-abs-dir | path basename) +let old-path = ($nu.path | str collect ($path-sep)) + +let new-path = (if ($is_windows) { + let venv-path = ([$virtual_env "__BIN_NAME__"] | path join) + let new-path = ($nu.path | prepend $venv-path | str collect ($path-sep)) + + [[name, value]; [Path $new-path]] +} { + let venv-path = ([$virtual_env "bin"] | path join) + let new-path = ($nu.path | prepend $venv-path | str collect ($path-sep)) + + [[name, value]; [PATH $new-path]] +} +) + +let new-env = [[name, value]; [VENV_OLD_PATH $old-path] [VIRTUAL_ENV $venv-name]] + +load-env ($new-env | append $new-path) + +# Creating the new prompt for the session +let virtual_prompt = __VIRTUAL_PROMPT__ + +let new_prompt = ($"build-string '($virtual_prompt) ' (config get prompt | str find-replace "build-string" "")") +let-env PROMPT_STRING = $new_prompt diff --git a/src/virtualenv/activation/nushell/deactivate.nu b/src/virtualenv/activation/nushell/deactivate.nu new file mode 100644 index 000000000..20dd90096 --- /dev/null +++ b/src/virtualenv/activation/nushell/deactivate.nu @@ -0,0 +1,7 @@ +# Setting the old path +let-env $path-name = $nu.env.VENV_OLD_PATH + +# Unleting the environment variables that where created when activating the env +unlet-env VIRTUAL_ENV +unlet-env VENV_OLD_PATH +unlet-env PROMPT_STRING From 880c067a08d2efcbe74889338ec48f20631b0d9e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 16 Aug 2021 10:36:47 +0000 Subject: [PATCH 02/65] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/virtualenv/activation/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/virtualenv/activation/__init__.py b/src/virtualenv/activation/__init__.py index 9120935f2..e9296d86e 100644 --- a/src/virtualenv/activation/__init__.py +++ b/src/virtualenv/activation/__init__.py @@ -4,9 +4,9 @@ from .batch import BatchActivator from .cshell import CShellActivator from .fish import FishActivator +from .nushell import NushellActivator from .powershell import PowerShellActivator from .python import PythonActivator -from .nushell import NushellActivator __all__ = [ "BashActivator", From 1dd281e77d43c74190285fd2807a6c575a7bc317 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Tue, 17 Aug 2021 16:00:15 +0100 Subject: [PATCH 03/65] nushell activate template --- setup.cfg | 2 ++ src/virtualenv/activation/nushell/__init__.py | 4 +-- src/virtualenv/activation/nushell/activate.nu | 11 +++++--- .../activation/nushell/deactivate.nu | 1 + tests/unit/activation/test_nushell.py | 25 +++++++++++++++++++ 5 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 tests/unit/activation/test_nushell.py diff --git a/setup.cfg b/setup.cfg index 6baf8e16d..46539a995 100644 --- a/setup.cfg +++ b/setup.cfg @@ -66,6 +66,7 @@ virtualenv.activate = fish = virtualenv.activation.fish:FishActivator powershell = virtualenv.activation.powershell:PowerShellActivator python = virtualenv.activation.python:PythonActivator + nushell = virtualenv.activation.nushell:NushellActivator virtualenv.create = venv = virtualenv.create.via_global_ref.venv:Venv cpython3-posix = virtualenv.create.via_global_ref.builtin.cpython.cpython3:CPython3Posix @@ -109,6 +110,7 @@ virtualenv.activation.batch = *.bat virtualenv.activation.cshell = *.csh virtualenv.activation.fish = *.fish virtualenv.activation.powershell = *.ps1 +virtualenv.activation.nushell = *.nu virtualenv.seed.wheels.embed = *.whl [sdist] diff --git a/src/virtualenv/activation/nushell/__init__.py b/src/virtualenv/activation/nushell/__init__.py index aae050f16..8d019ca05 100644 --- a/src/virtualenv/activation/nushell/__init__.py +++ b/src/virtualenv/activation/nushell/__init__.py @@ -8,6 +8,4 @@ class NushellActivator(ViaTemplateActivator): def templates(self): yield Path("activate.nu") - - def as_name(self, template): - return template.stem + yield Path("deactivate.nu") diff --git a/src/virtualenv/activation/nushell/activate.nu b/src/virtualenv/activation/nushell/activate.nu index 8d38f5603..5b09895e6 100644 --- a/src/virtualenv/activation/nushell/activate.nu +++ b/src/virtualenv/activation/nushell/activate.nu @@ -1,5 +1,5 @@ # Setting all environment variables for the venv -let virtual_env = __VIRTUAL_ENV__ +let virtual_env = "__VIRTUAL_ENV__" let is_windows = (sys).host.name == "Windows" let path-sep = (if $is_windows { ";" } { ":" }) @@ -26,7 +26,12 @@ let new-env = [[name, value]; [VENV_OLD_PATH $old-path] [VIRTUAL_ENV $venv-name] load-env ($new-env | append $new-path) # Creating the new prompt for the session -let virtual_prompt = __VIRTUAL_PROMPT__ +let virtual_prompt = (if ("__VIRTUAL_PROMPT__" != "") { + "__VIRTUAL_PROMPT__" +} { + $virtual_env | path basename +} +) -let new_prompt = ($"build-string '($virtual_prompt) ' (config get prompt | str find-replace "build-string" "")") +let new_prompt = ($"build-string '(char lparen)' '($virtual_prompt)' '(char rparen) ' (config get prompt | str find-replace "build-string" "")") let-env PROMPT_STRING = $new_prompt diff --git a/src/virtualenv/activation/nushell/deactivate.nu b/src/virtualenv/activation/nushell/deactivate.nu index 20dd90096..3a0e314d6 100644 --- a/src/virtualenv/activation/nushell/deactivate.nu +++ b/src/virtualenv/activation/nushell/deactivate.nu @@ -1,4 +1,5 @@ # Setting the old path +let path-name = (if ((sys).host.name == "Windows") { "Path" } { "PATH" }) let-env $path-name = $nu.env.VENV_OLD_PATH # Unleting the environment variables that where created when activating the env diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py new file mode 100644 index 000000000..2889aebcb --- /dev/null +++ b/tests/unit/activation/test_nushell.py @@ -0,0 +1,25 @@ +from __future__ import absolute_import, unicode_literals + +import pytest + +from virtualenv.activation import NushellActivator, nushell +from virtualenv.info import IS_WIN + + +#@pytest.mark.skipif(IS_WIN, reason="Github Actions ships with WSL bash") +def test_nushell(activation_tester_class, activation_tester): + + class Nushell(activation_tester_class): + def __init__(self, session): + super(Nushell, self).__init__(NushellActivator, session, "nu", "activate.nu", "nu") + self.activate_cmd = "source" + self.deactivate = "source deactivate.nu" + + + activation_tester(Nushell) + + +# @elferherrera You could use this to get the name of the latest release +# tarball: curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep 'browser_' | cut -d\" -f4 | grep .tar.gz. +# You call wget $(curl ...) to actually download it. Source: https://stackoverflow.com/questions/24085978/github-url-for-latest-release-of-the-download-file + From aa53639603112fbc27e03d8e908b3aed0911dc68 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 17 Aug 2021 17:37:43 +0000 Subject: [PATCH 04/65] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- setup.cfg | 2 +- tests/unit/activation/test_nushell.py | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/setup.cfg b/setup.cfg index 46539a995..f093ca460 100644 --- a/setup.cfg +++ b/setup.cfg @@ -109,8 +109,8 @@ virtualenv.activation.bash = *.sh virtualenv.activation.batch = *.bat virtualenv.activation.cshell = *.csh virtualenv.activation.fish = *.fish -virtualenv.activation.powershell = *.ps1 virtualenv.activation.nushell = *.nu +virtualenv.activation.powershell = *.ps1 virtualenv.seed.wheels.embed = *.whl [sdist] diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index 2889aebcb..73d205c71 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -6,20 +6,17 @@ from virtualenv.info import IS_WIN -#@pytest.mark.skipif(IS_WIN, reason="Github Actions ships with WSL bash") +# @pytest.mark.skipif(IS_WIN, reason="Github Actions ships with WSL bash") def test_nushell(activation_tester_class, activation_tester): - class Nushell(activation_tester_class): def __init__(self, session): super(Nushell, self).__init__(NushellActivator, session, "nu", "activate.nu", "nu") self.activate_cmd = "source" self.deactivate = "source deactivate.nu" - activation_tester(Nushell) # @elferherrera You could use this to get the name of the latest release # tarball: curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep 'browser_' | cut -d\" -f4 | grep .tar.gz. # You call wget $(curl ...) to actually download it. Source: https://stackoverflow.com/questions/24085978/github-url-for-latest-release-of-the-download-file - From 76990f12869ba2f8270090f936ba030d7a423ce3 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Thu, 19 Aug 2021 10:36:44 +0100 Subject: [PATCH 05/65] alias in activate --- src/virtualenv/activation/nushell/activate.nu | 3 +++ src/virtualenv/activation/nushell/deactivate.nu | 5 ++++- tests/unit/activation/test_nushell.py | 14 ++++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/virtualenv/activation/nushell/activate.nu b/src/virtualenv/activation/nushell/activate.nu index 5b09895e6..e82f47b34 100644 --- a/src/virtualenv/activation/nushell/activate.nu +++ b/src/virtualenv/activation/nushell/activate.nu @@ -35,3 +35,6 @@ let virtual_prompt = (if ("__VIRTUAL_PROMPT__" != "") { let new_prompt = ($"build-string '(char lparen)' '($virtual_prompt)' '(char rparen) ' (config get prompt | str find-replace "build-string" "")") let-env PROMPT_STRING = $new_prompt + +alias pydoc = python -m pydoc +alias deactivate = source "__VIRTUAL_ENV__\__BIN_NAME__\deactivate.nu" diff --git a/src/virtualenv/activation/nushell/deactivate.nu b/src/virtualenv/activation/nushell/deactivate.nu index 3a0e314d6..2243968c8 100644 --- a/src/virtualenv/activation/nushell/deactivate.nu +++ b/src/virtualenv/activation/nushell/deactivate.nu @@ -2,7 +2,10 @@ let path-name = (if ((sys).host.name == "Windows") { "Path" } { "PATH" }) let-env $path-name = $nu.env.VENV_OLD_PATH -# Unleting the environment variables that where created when activating the env +# Unleting the environment variables that were created when activating the env unlet-env VIRTUAL_ENV unlet-env VENV_OLD_PATH unlet-env PROMPT_STRING + +unalias pydoc +unalias deactivate diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index 2889aebcb..0130e4d4b 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -6,20 +6,22 @@ from virtualenv.info import IS_WIN -#@pytest.mark.skipif(IS_WIN, reason="Github Actions ships with WSL bash") +# @pytest.mark.skipif(IS_WIN, reason="Github Actions ships with WSL bash") def test_nushell(activation_tester_class, activation_tester): - class Nushell(activation_tester_class): def __init__(self, session): - super(Nushell, self).__init__(NushellActivator, session, "nu", "activate.nu", "nu") + cmd = "C:\\Users\Benzaa\\Documents\\cargo-target\\debug\\nu" + # cmd = "nu" + super(Nushell, self).__init__(NushellActivator, session, cmd, "activate.nu", "nu") self.activate_cmd = "source" - self.deactivate = "source deactivate.nu" + deactivate = session.creator.dest / session.creator.bin_dir / "deactivate.nu" + self.deactivate = "source '{}'".format(deactivate) activation_tester(Nushell) # @elferherrera You could use this to get the name of the latest release # tarball: curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep 'browser_' | cut -d\" -f4 | grep .tar.gz. -# You call wget $(curl ...) to actually download it. Source: https://stackoverflow.com/questions/24085978/github-url-for-latest-release-of-the-download-file - +# You call wget $(curl ...) to actually download it. +# Source: https://stackoverflow.com/questions/24085978/github-url-for-latest-release-of-the-download-file From 8c0210846b923a2fa48c2001edc32dfdeebbd8d8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 19 Aug 2021 09:38:19 +0000 Subject: [PATCH 06/65] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/unit/activation/test_nushell.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index 8bdbd78b0..a2b761a2b 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -10,7 +10,7 @@ def test_nushell(activation_tester_class, activation_tester): class Nushell(activation_tester_class): def __init__(self, session): - cmd = "C:\\Users\Benzaa\\Documents\\cargo-target\\debug\\nu" + cmd = "C:\\Users\\Benzaa\\Documents\\cargo-target\\debug\\nu" # cmd = "nu" super(Nushell, self).__init__(NushellActivator, session, cmd, "activate.nu", "nu") self.activate_cmd = "source" From e61421409dd2668399387a16a6348829fcac33af Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Thu, 19 Aug 2021 10:38:33 +0100 Subject: [PATCH 07/65] correction in text --- tests/unit/activation/test_nushell.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index 8bdbd78b0..0130e4d4b 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -23,9 +23,5 @@ def __init__(self, session): # @elferherrera You could use this to get the name of the latest release # tarball: curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep 'browser_' | cut -d\" -f4 | grep .tar.gz. -<<<<<<< HEAD # You call wget $(curl ...) to actually download it. # Source: https://stackoverflow.com/questions/24085978/github-url-for-latest-release-of-the-download-file -======= -# You call wget $(curl ...) to actually download it. Source: https://stackoverflow.com/questions/24085978/github-url-for-latest-release-of-the-download-file ->>>>>>> aa53639603112fbc27e03d8e908b3aed0911dc68 From 463e77b9f5c2742bdc86fec6014c5cd76bdbdb13 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Thu, 19 Aug 2021 11:08:55 +0100 Subject: [PATCH 08/65] dealias of pydoc and deactivate --- src/virtualenv/activation/nushell/__init__.py | 18 ++++++++++++++++++ src/virtualenv/activation/nushell/activate.nu | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/virtualenv/activation/nushell/__init__.py b/src/virtualenv/activation/nushell/__init__.py index 8d019ca05..a515f4b60 100644 --- a/src/virtualenv/activation/nushell/__init__.py +++ b/src/virtualenv/activation/nushell/__init__.py @@ -1,6 +1,8 @@ from __future__ import absolute_import, unicode_literals +import os from virtualenv.util.path import Path +from virtualenv.util.six import ensure_text from ..via_template import ViaTemplateActivator @@ -9,3 +11,19 @@ class NushellActivator(ViaTemplateActivator): def templates(self): yield Path("activate.nu") yield Path("deactivate.nu") + + def replacements(self, creator, dest_folder): + # Due to nushell scoping, it isn't easy to create a function that will + # deactivate the environment. For that reason a __DEACTIVATE_PATH__ + # replacement pointing to the deactivate.nu file is created + virtual_env = ensure_text(str(creator.dest)) + bin_name = ensure_text(str(creator.bin_dir.relative_to(creator.dest))) + + return { + "__VIRTUAL_PROMPT__": "" if self.flag_prompt is None else self.flag_prompt, + "__VIRTUAL_ENV__": virtual_env, + "__VIRTUAL_NAME__": creator.env_name, + "__BIN_NAME__": bin_name, + "__PATH_SEP__": ensure_text(os.pathsep), + "__DEACTIVATE_PATH__": str(Path(virtual_env, bin_name, "deactivate.nu")), + } diff --git a/src/virtualenv/activation/nushell/activate.nu b/src/virtualenv/activation/nushell/activate.nu index e82f47b34..f3f023d14 100644 --- a/src/virtualenv/activation/nushell/activate.nu +++ b/src/virtualenv/activation/nushell/activate.nu @@ -37,4 +37,4 @@ let new_prompt = ($"build-string '(char lparen)' '($virtual_prompt)' '(char rpar let-env PROMPT_STRING = $new_prompt alias pydoc = python -m pydoc -alias deactivate = source "__VIRTUAL_ENV__\__BIN_NAME__\deactivate.nu" +alias deactivate = source "__DEACTIVATE_PATH__" From fa89fc518dd13f8594a1691b48031bf60992b38e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 19 Aug 2021 10:09:17 +0000 Subject: [PATCH 09/65] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/virtualenv/activation/nushell/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/virtualenv/activation/nushell/__init__.py b/src/virtualenv/activation/nushell/__init__.py index a515f4b60..8e4a9cb57 100644 --- a/src/virtualenv/activation/nushell/__init__.py +++ b/src/virtualenv/activation/nushell/__init__.py @@ -1,6 +1,7 @@ from __future__ import absolute_import, unicode_literals import os + from virtualenv.util.path import Path from virtualenv.util.six import ensure_text From 9abbbfea13ae4639ae8f233a586ad54e40ebfda0 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Fri, 20 Aug 2021 09:34:39 +0100 Subject: [PATCH 10/65] using dest_folder for variables --- src/virtualenv/activation/nushell/__init__.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/virtualenv/activation/nushell/__init__.py b/src/virtualenv/activation/nushell/__init__.py index a515f4b60..064f9edc0 100644 --- a/src/virtualenv/activation/nushell/__init__.py +++ b/src/virtualenv/activation/nushell/__init__.py @@ -16,14 +16,12 @@ def replacements(self, creator, dest_folder): # Due to nushell scoping, it isn't easy to create a function that will # deactivate the environment. For that reason a __DEACTIVATE_PATH__ # replacement pointing to the deactivate.nu file is created - virtual_env = ensure_text(str(creator.dest)) - bin_name = ensure_text(str(creator.bin_dir.relative_to(creator.dest))) return { "__VIRTUAL_PROMPT__": "" if self.flag_prompt is None else self.flag_prompt, - "__VIRTUAL_ENV__": virtual_env, + "__VIRTUAL_ENV__": ensure_text(str(creator.dest)), "__VIRTUAL_NAME__": creator.env_name, - "__BIN_NAME__": bin_name, + "__BIN_NAME__": ensure_text(str(creator.bin_dir.relative_to(creator.dest))), "__PATH_SEP__": ensure_text(os.pathsep), - "__DEACTIVATE_PATH__": str(Path(virtual_env, bin_name, "deactivate.nu")), + "__DEACTIVATE_PATH__": str(Path(dest_folder, "deactivate.nu")), } From ac8eb3b5839fac0912f38a6976193f9dcb2ec1d3 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Sat, 21 Aug 2021 08:48:48 +0100 Subject: [PATCH 11/65] activation and deactivation scripts for nu --- src/virtualenv/activation/nushell/activate.nu | 38 +++++++++---------- .../activation/nushell/deactivate.nu | 5 ++- tests/unit/activation/test_nushell.py | 6 +-- 3 files changed, 23 insertions(+), 26 deletions(-) diff --git a/src/virtualenv/activation/nushell/activate.nu b/src/virtualenv/activation/nushell/activate.nu index f3f023d14..8385ba31d 100644 --- a/src/virtualenv/activation/nushell/activate.nu +++ b/src/virtualenv/activation/nushell/activate.nu @@ -1,40 +1,38 @@ # Setting all environment variables for the venv -let virtual_env = "__VIRTUAL_ENV__" +let virtual-env = "__VIRTUAL_ENV__" +let bin = "__BIN_NAME__" +let path-sep = "__PATH_SEP__" -let is_windows = (sys).host.name == "Windows" -let path-sep = (if $is_windows { ";" } { ":" }) - -let venv-abs-dir = ($virtual_env | path expand) -let venv-name = ($venv-abs-dir | path basename) let old-path = ($nu.path | str collect ($path-sep)) -let new-path = (if ($is_windows) { - let venv-path = ([$virtual_env "__BIN_NAME__"] | path join) - let new-path = ($nu.path | prepend $venv-path | str collect ($path-sep)) - - [[name, value]; [Path $new-path]] -} { - let venv-path = ([$virtual_env "bin"] | path join) - let new-path = ($nu.path | prepend $venv-path | str collect ($path-sep)) +let venv-path = ([$virtual-env $bin] | path join) +let new-path = ($nu.path | prepend $venv-path | str collect ($path-sep)) - [[name, value]; [PATH $new-path]] -} -) +let python_executable = ([$virtual-env $bin "python.exe"] | path join) -let new-env = [[name, value]; [VENV_OLD_PATH $old-path] [VIRTUAL_ENV $venv-name]] +# environment variables that will be batched loaded to the virtual env +let new-env = ([ + [name, value]; + [PATH $new-path] + [_OLD_VIRTUAL_PATH $old-path] + [VIRTUAL_ENV $virtual-env] + [PYTHONEXECUTABLE $python_executable] +]) -load-env ($new-env | append $new-path) +load-env $new-env # Creating the new prompt for the session let virtual_prompt = (if ("__VIRTUAL_PROMPT__" != "") { "__VIRTUAL_PROMPT__" } { - $virtual_env | path basename + $virtual-env | path basename } ) let new_prompt = ($"build-string '(char lparen)' '($virtual_prompt)' '(char rparen) ' (config get prompt | str find-replace "build-string" "")") let-env PROMPT_STRING = $new_prompt +# We are using alias as the function definitions because only aliases can be +# removed from the scope alias pydoc = python -m pydoc alias deactivate = source "__DEACTIVATE_PATH__" diff --git a/src/virtualenv/activation/nushell/deactivate.nu b/src/virtualenv/activation/nushell/deactivate.nu index 2243968c8..9c92040cc 100644 --- a/src/virtualenv/activation/nushell/deactivate.nu +++ b/src/virtualenv/activation/nushell/deactivate.nu @@ -1,11 +1,12 @@ # Setting the old path let path-name = (if ((sys).host.name == "Windows") { "Path" } { "PATH" }) -let-env $path-name = $nu.env.VENV_OLD_PATH +let-env $path-name = $nu.env._OLD_VIRTUAL_PATH # Unleting the environment variables that were created when activating the env unlet-env VIRTUAL_ENV -unlet-env VENV_OLD_PATH +unlet-env _OLD_VIRTUAL_PATH unlet-env PROMPT_STRING +unlet-env PYTHONEXECUTABLE unalias pydoc unalias deactivate diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index 885d67f9c..950016144 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -6,13 +6,11 @@ from virtualenv.info import IS_WIN -# @pytest.mark.skipif(IS_WIN, reason="Github Actions ships with WSL bash") +@pytest.mark.skipif(IS_WIN, reason="Github Actions ships with WSL bash") def test_nushell(activation_tester_class, activation_tester): class Nushell(activation_tester_class): def __init__(self, session): - cmd = "C:\\Users\\Benzaa\\Documents\\cargo-target\\debug\\nu" - # cmd = "nu" - super(Nushell, self).__init__(NushellActivator, session, cmd, "activate.nu", "nu") + super(Nushell, self).__init__(NushellActivator, session, "nu", "activate.nu", "nu") self.activate_cmd = "source" deactivate = session.creator.dest / session.creator.bin_dir / "deactivate.nu" From 41ae37651b9d732af8b753f0fb6ab0f305669d50 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Sat, 21 Aug 2021 09:00:45 +0100 Subject: [PATCH 12/65] removed comments --- tests/unit/activation/test_nushell.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index 950016144..54298a542 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -17,9 +17,3 @@ def __init__(self, session): self.deactivate = "source '{}'".format(deactivate) activation_tester(Nushell) - - -# @elferherrera You could use this to get the name of the latest release -# tarball: curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep 'browser_' | cut -d\" -f4 | grep .tar.gz. -# You call wget $(curl ...) to actually download it. -# Source: https://stackoverflow.com/questions/24085978/github-url-for-latest-release-of-the-download-file From 3e46b20a60f8cd7c07d6562acffa622b49bbce35 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Tue, 24 Aug 2021 08:18:45 +0100 Subject: [PATCH 13/65] install nushell for test --- .github/workflows/check.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 163fe8347..8eda9e460 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -40,8 +40,17 @@ jobs: run: | for i in 1 2 3; do echo "try $i" && \ - ${{ runner.os == 'Linux' && 'sudo apt-get update -y && sudo apt-get install fish csh' || true}} && \ - ${{ runner.os == 'macOS' && 'brew install fish tcsh' || true}} && \ + ${{ runner.os == 'Linux' && 'sudo apt-get update -y && sudo apt-get install fish csh && + apt-get install curl wget -y && + nushell_url=$(curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep "browser_" | cut -d\" -f4 | grep .tar.gz) && + folder_name=$(echo $nushell_url | awk -F"/" "{ print $9 }" | cut -d "." -f 1) && + version=$(echo $nushell_url | awk -F"/" "{ print $8 }") && + wget -O nushell.tar.gz $nushell_url && + mkdir nushell && + tar -xzf nushell.tar.gz -C nushell && + export PATH="nushell/$folder_name/nushell-$version":$PATH' + || true}} && \ + ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true}} && \ exit 0 || true; done exit 1 From 11c82b6c94b56184e67febc5b5ad7bb260e88948 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Thu, 26 Aug 2021 19:46:25 +0100 Subject: [PATCH 14/65] added sudo in workflow --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 8eda9e460..4427823c9 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -41,7 +41,7 @@ jobs: for i in 1 2 3; do echo "try $i" && \ ${{ runner.os == 'Linux' && 'sudo apt-get update -y && sudo apt-get install fish csh && - apt-get install curl wget -y && + sudo apt-get install curl wget -y && nushell_url=$(curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep "browser_" | cut -d\" -f4 | grep .tar.gz) && folder_name=$(echo $nushell_url | awk -F"/" "{ print $9 }" | cut -d "." -f 1) && version=$(echo $nushell_url | awk -F"/" "{ print $8 }") && From 287f758e8fb457ebce3b8193d9b63704bae6b9c0 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Sat, 28 Aug 2021 09:33:03 +0100 Subject: [PATCH 15/65] removed unused import --- tests/unit/activation/test_nushell.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index 54298a542..d4bc3e3f5 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -2,7 +2,7 @@ import pytest -from virtualenv.activation import NushellActivator, nushell +from virtualenv.activation import NushellActivator from virtualenv.info import IS_WIN From dfe9ae685ce68098bf4be9ed497b0da973ec1962 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Sat, 28 Aug 2021 10:04:13 +0100 Subject: [PATCH 16/65] print path --- .github/workflows/check.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 4427823c9..04d964cbd 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -48,7 +48,9 @@ jobs: wget -O nushell.tar.gz $nushell_url && mkdir nushell && tar -xzf nushell.tar.gz -C nushell && - export PATH="nushell/$folder_name/nushell-$version":$PATH' + export PATH="nushell/$folder_name/nushell-$version":$PATH' && + echo $PATH && + ls nushell || true}} && \ ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true}} && \ exit 0 || true; From ecf147b54dcd0e91c0c8473a38691ece09e6dceb Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Sat, 28 Aug 2021 10:19:56 +0100 Subject: [PATCH 17/65] removed awk for cut in workflow --- .github/workflows/check.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 04d964cbd..2c5d83891 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -43,14 +43,12 @@ jobs: ${{ runner.os == 'Linux' && 'sudo apt-get update -y && sudo apt-get install fish csh && sudo apt-get install curl wget -y && nushell_url=$(curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep "browser_" | cut -d\" -f4 | grep .tar.gz) && - folder_name=$(echo $nushell_url | awk -F"/" "{ print $9 }" | cut -d "." -f 1) && - version=$(echo $nushell_url | awk -F"/" "{ print $8 }") && + folder_name=$(echo $nushell_url | cut -d"/" -f9 | cut -d"." -f 1) && + version=$(echo $nushell_url | cut -d"/" -f8) && wget -O nushell.tar.gz $nushell_url && mkdir nushell && tar -xzf nushell.tar.gz -C nushell && export PATH="nushell/$folder_name/nushell-$version":$PATH' && - echo $PATH && - ls nushell || true}} && \ ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true}} && \ exit 0 || true; From bbe1d75f5cc8f2ce502e617d5cde27fb5a4b61a8 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Sat, 28 Aug 2021 13:24:42 +0100 Subject: [PATCH 18/65] original workflow file --- .github/workflows/check.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 2c5d83891..f2aaaa35e 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -40,16 +40,7 @@ jobs: run: | for i in 1 2 3; do echo "try $i" && \ - ${{ runner.os == 'Linux' && 'sudo apt-get update -y && sudo apt-get install fish csh && - sudo apt-get install curl wget -y && - nushell_url=$(curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep "browser_" | cut -d\" -f4 | grep .tar.gz) && - folder_name=$(echo $nushell_url | cut -d"/" -f9 | cut -d"." -f 1) && - version=$(echo $nushell_url | cut -d"/" -f8) && - wget -O nushell.tar.gz $nushell_url && - mkdir nushell && - tar -xzf nushell.tar.gz -C nushell && - export PATH="nushell/$folder_name/nushell-$version":$PATH' && - || true}} && \ + ${{ runner.os == 'Linux' && 'sudo apt-get update -y && sudo apt-get install fish csh || true}} && \ ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true}} && \ exit 0 || true; done From 8396948c55ab2671d98552b2a80cb39ed01d6eb3 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Sat, 28 Aug 2021 14:09:30 +0100 Subject: [PATCH 19/65] nushell workflow --- .github/workflows/check.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index f2aaaa35e..2c5d83891 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -40,7 +40,16 @@ jobs: run: | for i in 1 2 3; do echo "try $i" && \ - ${{ runner.os == 'Linux' && 'sudo apt-get update -y && sudo apt-get install fish csh || true}} && \ + ${{ runner.os == 'Linux' && 'sudo apt-get update -y && sudo apt-get install fish csh && + sudo apt-get install curl wget -y && + nushell_url=$(curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep "browser_" | cut -d\" -f4 | grep .tar.gz) && + folder_name=$(echo $nushell_url | cut -d"/" -f9 | cut -d"." -f 1) && + version=$(echo $nushell_url | cut -d"/" -f8) && + wget -O nushell.tar.gz $nushell_url && + mkdir nushell && + tar -xzf nushell.tar.gz -C nushell && + export PATH="nushell/$folder_name/nushell-$version":$PATH' && + || true}} && \ ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true}} && \ exit 0 || true; done From 7ac93164cf40273a3454e8dbc33217d14319d785 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Sat, 28 Aug 2021 15:01:20 +0100 Subject: [PATCH 20/65] empty commit --- tests/unit/activation/test_nushell.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index d4bc3e3f5..73b10756c 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -14,6 +14,7 @@ def __init__(self, session): self.activate_cmd = "source" deactivate = session.creator.dest / session.creator.bin_dir / "deactivate.nu" + self.deactivate = "source '{}'".format(deactivate) activation_tester(Nushell) From 1b79414d666aaede9872f5eb0973a407c29416ce Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Sat, 28 Aug 2021 16:34:17 +0100 Subject: [PATCH 21/65] correctec check.yml file --- .github/workflows/check.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 2c5d83891..400be8bf2 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -48,8 +48,7 @@ jobs: wget -O nushell.tar.gz $nushell_url && mkdir nushell && tar -xzf nushell.tar.gz -C nushell && - export PATH="nushell/$folder_name/nushell-$version":$PATH' && - || true}} && \ + export PATH="nushell/$folder_name/nushell-$version":$PATH' || true}} && \ ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true}} && \ exit 0 || true; done From 5e519aed3f72c10665703b7b4b56a6050581d010 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Sat, 28 Aug 2021 17:37:31 +0100 Subject: [PATCH 22/65] copy nu to bin folder instead of PATH --- .github/workflows/check.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 400be8bf2..606e89fba 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -48,7 +48,8 @@ jobs: wget -O nushell.tar.gz $nushell_url && mkdir nushell && tar -xzf nushell.tar.gz -C nushell && - export PATH="nushell/$folder_name/nushell-$version":$PATH' || true}} && \ + cp nushell/$folder_name/nushell-$version/nu /usr/bin && + cp nushell/$folder_name/nushell-$version/nu_plugin_sys /usr/bin || true}} && \ ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true}} && \ exit 0 || true; done From c78e504722f34357e523992a3d7ad7c1a8c2afdf Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Mon, 30 Aug 2021 17:55:29 +0100 Subject: [PATCH 23/65] added more explicit runner.os for context --- .github/workflows/check.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 606e89fba..ec5cdeaf4 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -40,17 +40,17 @@ jobs: run: | for i in 1 2 3; do echo "try $i" && \ - ${{ runner.os == 'Linux' && 'sudo apt-get update -y && sudo apt-get install fish csh && - sudo apt-get install curl wget -y && - nushell_url=$(curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep "browser_" | cut -d\" -f4 | grep .tar.gz) && - folder_name=$(echo $nushell_url | cut -d"/" -f9 | cut -d"." -f 1) && - version=$(echo $nushell_url | cut -d"/" -f8) && - wget -O nushell.tar.gz $nushell_url && - mkdir nushell && - tar -xzf nushell.tar.gz -C nushell && - cp nushell/$folder_name/nushell-$version/nu /usr/bin && - cp nushell/$folder_name/nushell-$version/nu_plugin_sys /usr/bin || true}} && \ - ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true}} && \ + ${{ runner.os == 'Linux' && 'sudo apt-get update -y && sudo apt-get install fish csh -y' || true }} && \ + ${{ runner.os == 'Linux' && 'sudo apt-get install curl wget -y' || true }} && \ + ${{ runner.os == 'Linux' && 'nushell_url=$(curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep "browser_" | cut -d\" -f4 | grep .tar.gz)' || true }} && \ + ${{ runner.os == 'Linux' && 'folder_name=$(echo $nushell_url | cut -d"/" -f9 | cut -d"." -f 1)' || true }} && \ + ${{ runner.os == 'Linux' && 'version=$(echo $nushell_url | cut -d"/" -f8)' || true }} && \ + ${{ runner.os == 'Linux' && 'wget -O nushell.tar.gz $nushell_url' || true }} && \ + ${{ runner.os == 'Linux' && 'mkdir nushell' || true }} && \ + ${{ runner.os == 'Linux' && 'tar -xzf nushell.tar.gz -C nushell' || true }} && \ + ${{ runner.os == 'Linux' && 'cp nushell/$folder_name/nushell-$version/nu /usr/bin' || true }} && \ + ${{ runner.os == 'Linux' && 'cp nushell/$folder_name/nushell-$version/nu_plugin_sys /usr/bin' || true}} && \ + ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true }} && \ exit 0 || true; done exit 1 From 1eae3b0f755707626d922db4bf7e3f4ca0d25758 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Mon, 30 Aug 2021 18:54:38 +0100 Subject: [PATCH 24/65] strip components during untar --- .github/workflows/check.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index ec5cdeaf4..f4326c28e 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -43,13 +43,11 @@ jobs: ${{ runner.os == 'Linux' && 'sudo apt-get update -y && sudo apt-get install fish csh -y' || true }} && \ ${{ runner.os == 'Linux' && 'sudo apt-get install curl wget -y' || true }} && \ ${{ runner.os == 'Linux' && 'nushell_url=$(curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep "browser_" | cut -d\" -f4 | grep .tar.gz)' || true }} && \ - ${{ runner.os == 'Linux' && 'folder_name=$(echo $nushell_url | cut -d"/" -f9 | cut -d"." -f 1)' || true }} && \ - ${{ runner.os == 'Linux' && 'version=$(echo $nushell_url | cut -d"/" -f8)' || true }} && \ ${{ runner.os == 'Linux' && 'wget -O nushell.tar.gz $nushell_url' || true }} && \ - ${{ runner.os == 'Linux' && 'mkdir nushell' || true }} && \ - ${{ runner.os == 'Linux' && 'tar -xzf nushell.tar.gz -C nushell' || true }} && \ - ${{ runner.os == 'Linux' && 'cp nushell/$folder_name/nushell-$version/nu /usr/bin' || true }} && \ - ${{ runner.os == 'Linux' && 'cp nushell/$folder_name/nushell-$version/nu_plugin_sys /usr/bin' || true}} && \ + ${{ runner.os == 'Linux' && 'tar -xzf nushell.tar.gz --strip-components=1' || true }} && \ + ${{ runner.os == 'Linux' && 'version=$(echo $nushell_url | cut -d"/" -f8)' || true }} && \ + ${{ runner.os == 'Linux' && 'sudo cp nushell-$version/nu /usr/bin' || true }} && \ + ${{ runner.os == 'Linux' && 'sudo cp nushell-$version/nu_plugin_sys /usr/bin' || true}} && \ ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true }} && \ exit 0 || true; done From 564dd19e8b63308e024c365bd37bd3796adda489 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Mon, 30 Aug 2021 19:01:04 +0100 Subject: [PATCH 25/65] untar to nushell folder --- .github/workflows/check.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index f4326c28e..dd9e69b48 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -44,10 +44,9 @@ jobs: ${{ runner.os == 'Linux' && 'sudo apt-get install curl wget -y' || true }} && \ ${{ runner.os == 'Linux' && 'nushell_url=$(curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep "browser_" | cut -d\" -f4 | grep .tar.gz)' || true }} && \ ${{ runner.os == 'Linux' && 'wget -O nushell.tar.gz $nushell_url' || true }} && \ - ${{ runner.os == 'Linux' && 'tar -xzf nushell.tar.gz --strip-components=1' || true }} && \ - ${{ runner.os == 'Linux' && 'version=$(echo $nushell_url | cut -d"/" -f8)' || true }} && \ - ${{ runner.os == 'Linux' && 'sudo cp nushell-$version/nu /usr/bin' || true }} && \ - ${{ runner.os == 'Linux' && 'sudo cp nushell-$version/nu_plugin_sys /usr/bin' || true}} && \ + ${{ runner.os == 'Linux' && 'tar -zxf nushell.tar.gz --one-top-level=nushell --strip-components=2' || true }} && \ + ${{ runner.os == 'Linux' && 'sudo cp nushell/nu /usr/bin' || true }} && \ + ${{ runner.os == 'Linux' && 'sudo cp nushell/nu_plugin_sys /usr/bin' || true}} && \ ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true }} && \ exit 0 || true; done From b1c2e4172af5df2b58840bec2cc909a3454ad2e6 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Tue, 31 Aug 2021 07:57:03 +0100 Subject: [PATCH 26/65] adding option for lack of prompt --- src/virtualenv/activation/nushell/activate.nu | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/virtualenv/activation/nushell/activate.nu b/src/virtualenv/activation/nushell/activate.nu index 8385ba31d..6d1d27536 100644 --- a/src/virtualenv/activation/nushell/activate.nu +++ b/src/virtualenv/activation/nushell/activate.nu @@ -29,7 +29,12 @@ let virtual_prompt = (if ("__VIRTUAL_PROMPT__" != "") { } ) -let new_prompt = ($"build-string '(char lparen)' '($virtual_prompt)' '(char rparen) ' (config get prompt | str find-replace "build-string" "")") +# If there is no default prompt, then only the env is printed in the prompt +let new_prompt = (if ( config | select prompt | empty? ) { + ($"build-string '(char lparen)' '($virtual_prompt)' '(char rparen) ' ") +} { + ($"build-string '(char lparen)' '($virtual_prompt)' '(char rparen) ' (config get prompt | str find-replace "build-string" "")") +}) let-env PROMPT_STRING = $new_prompt # We are using alias as the function definitions because only aliases can be From 5f68d53374ee54afe877d92b3c91b1c1573ebf36 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Tue, 31 Aug 2021 11:46:28 +0100 Subject: [PATCH 27/65] use ensure_text on DEACTIVATE_PATH --- src/virtualenv/activation/nushell/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/virtualenv/activation/nushell/__init__.py b/src/virtualenv/activation/nushell/__init__.py index 507bf9fe4..f663fbbb3 100644 --- a/src/virtualenv/activation/nushell/__init__.py +++ b/src/virtualenv/activation/nushell/__init__.py @@ -24,5 +24,5 @@ def replacements(self, creator, dest_folder): "__VIRTUAL_NAME__": creator.env_name, "__BIN_NAME__": ensure_text(str(creator.bin_dir.relative_to(creator.dest))), "__PATH_SEP__": ensure_text(os.pathsep), - "__DEACTIVATE_PATH__": str(Path(dest_folder, "deactivate.nu")), + "__DEACTIVATE_PATH__": ensure_text(str(Path(dest_folder, "deactivate.nu"))), } From 2c252b5deaeea931f6c479afb33b42c4bf6e4395 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Tue, 31 Aug 2021 12:44:16 +0100 Subject: [PATCH 28/65] simplify deactivate in test --- tests/unit/activation/test_nushell.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index 73b10756c..558251c6c 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -11,10 +11,5 @@ def test_nushell(activation_tester_class, activation_tester): class Nushell(activation_tester_class): def __init__(self, session): super(Nushell, self).__init__(NushellActivator, session, "nu", "activate.nu", "nu") - self.activate_cmd = "source" - - deactivate = session.creator.dest / session.creator.bin_dir / "deactivate.nu" - - self.deactivate = "source '{}'".format(deactivate) activation_tester(Nushell) From 93a0cbc0316961c86b444981819aa852896b6cfb Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Tue, 31 Aug 2021 13:56:54 +0100 Subject: [PATCH 29/65] windows nu install with scoop --- .github/workflows/check.yml | 3 +++ tests/unit/activation/test_nushell.py | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index dd9e69b48..133325833 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -48,6 +48,9 @@ jobs: ${{ runner.os == 'Linux' && 'sudo cp nushell/nu /usr/bin' || true }} && \ ${{ runner.os == 'Linux' && 'sudo cp nushell/nu_plugin_sys /usr/bin' || true}} && \ ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true }} && \ + ${{ runner.os == 'Windows' && 'iwr -useb get.scoop.sh | iex' || true }} && \ + ${{ runner.os == 'Windows' && 'Set-ExecutionPolicy RemoteSigned -scope CurrentUser' || true }} && \ + ${{ runner.os == 'Windows' && 'scoop install nu' || true }} && \ exit 0 || true; done exit 1 diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index 558251c6c..b63c440fd 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -6,7 +6,6 @@ from virtualenv.info import IS_WIN -@pytest.mark.skipif(IS_WIN, reason="Github Actions ships with WSL bash") def test_nushell(activation_tester_class, activation_tester): class Nushell(activation_tester_class): def __init__(self, session): From 4953b741f595747373343a0ac19167a1be6a98f2 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Tue, 31 Aug 2021 14:01:28 +0100 Subject: [PATCH 30/65] removed unused import --- tests/unit/activation/test_nushell.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index b63c440fd..315c2e03e 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -1,7 +1,5 @@ from __future__ import absolute_import, unicode_literals -import pytest - from virtualenv.activation import NushellActivator from virtualenv.info import IS_WIN From f5619106f97aa110af80c97b30826d2403c8cdc1 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Tue, 31 Aug 2021 14:02:20 +0100 Subject: [PATCH 31/65] removed unused import --- tests/unit/activation/test_nushell.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index 315c2e03e..3607d324e 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -1,7 +1,6 @@ from __future__ import absolute_import, unicode_literals from virtualenv.activation import NushellActivator -from virtualenv.info import IS_WIN def test_nushell(activation_tester_class, activation_tester): From 4a934db0037f2476e1ced9bb8e8965567971041a Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Tue, 31 Aug 2021 18:54:59 +0100 Subject: [PATCH 32/65] expanded commands to install scoop --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 133325833..132e69888 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -48,7 +48,7 @@ jobs: ${{ runner.os == 'Linux' && 'sudo cp nushell/nu /usr/bin' || true }} && \ ${{ runner.os == 'Linux' && 'sudo cp nushell/nu_plugin_sys /usr/bin' || true}} && \ ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true }} && \ - ${{ runner.os == 'Windows' && 'iwr -useb get.scoop.sh | iex' || true }} && \ + ${{ runner.os == 'Windows' && 'Invoke-Expression (New-Object System.Net.WebClient).DownloadString("https://get.scoop.sh")' || true }} && \ ${{ runner.os == 'Windows' && 'Set-ExecutionPolicy RemoteSigned -scope CurrentUser' || true }} && \ ${{ runner.os == 'Windows' && 'scoop install nu' || true }} && \ exit 0 || true; From 87a6b26c9be85e508b4f0b8f1d9e7e626fd8f392 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Tue, 31 Aug 2021 19:25:05 +0100 Subject: [PATCH 33/65] install nushell with choco --- .github/workflows/check.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 132e69888..8cb223c9c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -48,9 +48,7 @@ jobs: ${{ runner.os == 'Linux' && 'sudo cp nushell/nu /usr/bin' || true }} && \ ${{ runner.os == 'Linux' && 'sudo cp nushell/nu_plugin_sys /usr/bin' || true}} && \ ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true }} && \ - ${{ runner.os == 'Windows' && 'Invoke-Expression (New-Object System.Net.WebClient).DownloadString("https://get.scoop.sh")' || true }} && \ - ${{ runner.os == 'Windows' && 'Set-ExecutionPolicy RemoteSigned -scope CurrentUser' || true }} && \ - ${{ runner.os == 'Windows' && 'scoop install nu' || true }} && \ + ${{ runner.os == 'Windows' && 'choco install nushell' || true }} && \ exit 0 || true; done exit 1 From c340d7cab2f7ac81541637b45d7d0abd24b8d00a Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Wed, 1 Sep 2021 09:51:57 +0100 Subject: [PATCH 34/65] change name of cmd for windows --- tests/unit/activation/test_nushell.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index 3607d324e..10151659a 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -1,11 +1,13 @@ from __future__ import absolute_import, unicode_literals from virtualenv.activation import NushellActivator +import sys def test_nushell(activation_tester_class, activation_tester): class Nushell(activation_tester_class): def __init__(self, session): - super(Nushell, self).__init__(NushellActivator, session, "nu", "activate.nu", "nu") + cmd = "c:\\program files\\nu\\bin\\nu.exe" if sys.platform == "win32" else "nu" + super(Nushell, self).__init__(NushellActivator, session, cmd, "activate.nu", "nu") activation_tester(Nushell) From 52fc190ceffb25f980951ae6089d6c210344e4ec Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 1 Sep 2021 08:52:22 +0000 Subject: [PATCH 35/65] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/unit/activation/test_nushell.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index 10151659a..2f3f81618 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -1,8 +1,9 @@ from __future__ import absolute_import, unicode_literals -from virtualenv.activation import NushellActivator import sys +from virtualenv.activation import NushellActivator + def test_nushell(activation_tester_class, activation_tester): class Nushell(activation_tester_class): From 9dd4828679cf55523484557c9bed7c21fdab0fd8 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Wed, 1 Sep 2021 11:29:55 +0100 Subject: [PATCH 36/65] linux line ending change --- tests/unit/activation/test_nushell.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index 10151659a..bdc9cf628 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -1,13 +1,17 @@ from __future__ import absolute_import, unicode_literals -from virtualenv.activation import NushellActivator import sys +from virtualenv.activation import NushellActivator +from virtualenv.info import IS_WIN + def test_nushell(activation_tester_class, activation_tester): class Nushell(activation_tester_class): def __init__(self, session): - cmd = "c:\\program files\\nu\\bin\\nu.exe" if sys.platform == "win32" else "nu" + cmd = "c:\\program files\\nu\\bin\\nu.exe" if IS_WIN else "nu" super(Nushell, self).__init__(NushellActivator, session, cmd, "activate.nu", "nu") + self.unix_line_ending = not IS_WIN + activation_tester(Nushell) From f6416787fc41d3ea6bf822c51d70d1cfd4d653b3 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Wed, 1 Sep 2021 12:20:33 +0100 Subject: [PATCH 37/65] use os path join for 2.7 --- src/virtualenv/activation/nushell/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/virtualenv/activation/nushell/__init__.py b/src/virtualenv/activation/nushell/__init__.py index f663fbbb3..53d57c435 100644 --- a/src/virtualenv/activation/nushell/__init__.py +++ b/src/virtualenv/activation/nushell/__init__.py @@ -24,5 +24,5 @@ def replacements(self, creator, dest_folder): "__VIRTUAL_NAME__": creator.env_name, "__BIN_NAME__": ensure_text(str(creator.bin_dir.relative_to(creator.dest))), "__PATH_SEP__": ensure_text(os.pathsep), - "__DEACTIVATE_PATH__": ensure_text(str(Path(dest_folder, "deactivate.nu"))), + "__DEACTIVATE_PATH__": ensure_text(os.path.join(dest_folder, "deactivate.nu")), } From 8c1463ff04884fc0cb5d652ee0528c418926c8ac Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Wed, 1 Sep 2021 13:10:54 +0100 Subject: [PATCH 38/65] trigger with comment --- src/virtualenv/activation/nushell/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/virtualenv/activation/nushell/__init__.py b/src/virtualenv/activation/nushell/__init__.py index 53d57c435..6a1ab8b27 100644 --- a/src/virtualenv/activation/nushell/__init__.py +++ b/src/virtualenv/activation/nushell/__init__.py @@ -17,6 +17,7 @@ def replacements(self, creator, dest_folder): # Due to nushell scoping, it isn't easy to create a function that will # deactivate the environment. For that reason a __DEACTIVATE_PATH__ # replacement pointing to the deactivate.nu file is created + # return { "__VIRTUAL_PROMPT__": "" if self.flag_prompt is None else self.flag_prompt, From 9704d2ca4768657e516642628b5de5b37bb85832 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Wed, 1 Sep 2021 13:23:41 +0100 Subject: [PATCH 39/65] using Path to join --- src/virtualenv/activation/nushell/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/virtualenv/activation/nushell/__init__.py b/src/virtualenv/activation/nushell/__init__.py index 6a1ab8b27..f5611cbd1 100644 --- a/src/virtualenv/activation/nushell/__init__.py +++ b/src/virtualenv/activation/nushell/__init__.py @@ -17,7 +17,6 @@ def replacements(self, creator, dest_folder): # Due to nushell scoping, it isn't easy to create a function that will # deactivate the environment. For that reason a __DEACTIVATE_PATH__ # replacement pointing to the deactivate.nu file is created - # return { "__VIRTUAL_PROMPT__": "" if self.flag_prompt is None else self.flag_prompt, @@ -25,5 +24,5 @@ def replacements(self, creator, dest_folder): "__VIRTUAL_NAME__": creator.env_name, "__BIN_NAME__": ensure_text(str(creator.bin_dir.relative_to(creator.dest))), "__PATH_SEP__": ensure_text(os.pathsep), - "__DEACTIVATE_PATH__": ensure_text(os.path.join(dest_folder, "deactivate.nu")), + "__DEACTIVATE_PATH__": ensure_text(str(Path(dest_folder) / Path("deactivate.nu"))), } From 1bcc292618370e83f4c7c73ffaece5bc40a0032e Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Wed, 1 Sep 2021 13:59:21 +0100 Subject: [PATCH 40/65] only windows workflow --- .github/workflows/check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 8cb223c9c..932e2406f 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -20,9 +20,9 @@ jobs: fail-fast: false matrix: os: - - ubuntu-latest + #- ubuntu-latest - windows-latest - - macos-latest + #- macos-latest py: - 3.10.0-rc.1 - 3.9 From 393c331f8aa885cd734149659c9d1713f5ca003a Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Wed, 1 Sep 2021 17:54:17 +0100 Subject: [PATCH 41/65] all tests --- .github/workflows/check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 932e2406f..8cb223c9c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -20,9 +20,9 @@ jobs: fail-fast: false matrix: os: - #- ubuntu-latest + - ubuntu-latest - windows-latest - #- macos-latest + - macos-latest py: - 3.10.0-rc.1 - 3.9 From c0be11c38cdfc9359ea36e21ec971090b4345530 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Wed, 1 Sep 2021 20:29:18 +0100 Subject: [PATCH 42/65] brew nu 0.36 --- .github/workflows/check.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 8cb223c9c..b86a3440e 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -20,8 +20,8 @@ jobs: fail-fast: false matrix: os: - - ubuntu-latest - - windows-latest + #- ubuntu-latest + #- windows-latest - macos-latest py: - 3.10.0-rc.1 @@ -47,7 +47,7 @@ jobs: ${{ runner.os == 'Linux' && 'tar -zxf nushell.tar.gz --one-top-level=nushell --strip-components=2' || true }} && \ ${{ runner.os == 'Linux' && 'sudo cp nushell/nu /usr/bin' || true }} && \ ${{ runner.os == 'Linux' && 'sudo cp nushell/nu_plugin_sys /usr/bin' || true}} && \ - ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true }} && \ + ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell@0.36.0' || true }} && \ ${{ runner.os == 'Windows' && 'choco install nushell' || true }} && \ exit 0 || true; done From 10411dab9525ab0d2bdb99201cbc3be3052a3da5 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Wed, 1 Sep 2021 20:32:42 +0100 Subject: [PATCH 43/65] brew nu 0.36 --- .github/workflows/check.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b86a3440e..991c74bde 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -25,14 +25,14 @@ jobs: - macos-latest py: - 3.10.0-rc.1 - - 3.9 - - 3.8 - - 3.7 - - 3.6 - - 3.5 - - pypy3 - - 2.7 - - pypy2 + #- 3.9 + #- 3.8 + #- 3.7 + #- 3.6 + #- 3.5 + #- pypy3 + #- 2.7 + #- pypy2 include: - { os: macos-latest, py: brew@py3 } steps: @@ -47,7 +47,7 @@ jobs: ${{ runner.os == 'Linux' && 'tar -zxf nushell.tar.gz --one-top-level=nushell --strip-components=2' || true }} && \ ${{ runner.os == 'Linux' && 'sudo cp nushell/nu /usr/bin' || true }} && \ ${{ runner.os == 'Linux' && 'sudo cp nushell/nu_plugin_sys /usr/bin' || true}} && \ - ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell@0.36.0' || true }} && \ + ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell @ 0.36.0' || true }} && \ ${{ runner.os == 'Windows' && 'choco install nushell' || true }} && \ exit 0 || true; done From ace3fbd0cdc1bcb03300d884644e6608642a7575 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Wed, 1 Sep 2021 20:47:29 +0100 Subject: [PATCH 44/65] from binaries --- .github/workflows/check.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 991c74bde..032173f25 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -47,8 +47,14 @@ jobs: ${{ runner.os == 'Linux' && 'tar -zxf nushell.tar.gz --one-top-level=nushell --strip-components=2' || true }} && \ ${{ runner.os == 'Linux' && 'sudo cp nushell/nu /usr/bin' || true }} && \ ${{ runner.os == 'Linux' && 'sudo cp nushell/nu_plugin_sys /usr/bin' || true}} && \ - ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell @ 0.36.0' || true }} && \ ${{ runner.os == 'Windows' && 'choco install nushell' || true }} && \ + ${{ runner.os == 'macOS' && 'brew install fish tcsh' || true }} && \ + ${{ runner.os == 'macOS' && 'brew install wget' || true }} && \ + ${{ runner.os == 'macOS' && 'nushell_url=$(curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep "browser_" | cut -d\" -f4 | grep .tar.gz)' || true }} && \ + ${{ runner.os == 'macOS' && 'wget -O nushell.tar.gz $nushell_url' || true }} && \ + ${{ runner.os == 'macOS' && 'tar -zxf nushell.tar.gz --one-top-level=nushell --strip-components=2' || true }} && \ + ${{ runner.os == 'macOS' && 'cp nushell/nu /usr/bin' || true }} && \ + ${{ runner.os == 'macOS' && 'cp nushell/nu_plugin_sys /usr/bin' || true}} && \ exit 0 || true; done exit 1 From edb4e61a9f4fac05b8607edc3dfc241c783a4716 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Wed, 1 Sep 2021 20:51:01 +0100 Subject: [PATCH 45/65] from binaries --- .github/workflows/check.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 032173f25..408b9e73e 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -49,7 +49,6 @@ jobs: ${{ runner.os == 'Linux' && 'sudo cp nushell/nu_plugin_sys /usr/bin' || true}} && \ ${{ runner.os == 'Windows' && 'choco install nushell' || true }} && \ ${{ runner.os == 'macOS' && 'brew install fish tcsh' || true }} && \ - ${{ runner.os == 'macOS' && 'brew install wget' || true }} && \ ${{ runner.os == 'macOS' && 'nushell_url=$(curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep "browser_" | cut -d\" -f4 | grep .tar.gz)' || true }} && \ ${{ runner.os == 'macOS' && 'wget -O nushell.tar.gz $nushell_url' || true }} && \ ${{ runner.os == 'macOS' && 'tar -zxf nushell.tar.gz --one-top-level=nushell --strip-components=2' || true }} && \ From 0af1c066a105349425421eb181fbb119b96e0a76 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Wed, 1 Sep 2021 21:08:53 +0100 Subject: [PATCH 46/65] from binaries --- .github/workflows/check.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 408b9e73e..b04c76931 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -49,9 +49,13 @@ jobs: ${{ runner.os == 'Linux' && 'sudo cp nushell/nu_plugin_sys /usr/bin' || true}} && \ ${{ runner.os == 'Windows' && 'choco install nushell' || true }} && \ ${{ runner.os == 'macOS' && 'brew install fish tcsh' || true }} && \ + ${{ runner.os == 'macOS' && 'echo "curl github"' || true }} && \ ${{ runner.os == 'macOS' && 'nushell_url=$(curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep "browser_" | cut -d\" -f4 | grep .tar.gz)' || true }} && \ + ${{ runner.os == 'macOS' && 'echo "wget"' || true }} && \ ${{ runner.os == 'macOS' && 'wget -O nushell.tar.gz $nushell_url' || true }} && \ + ${{ runner.os == 'macOS' && 'echo "untar"' || true }} && \ ${{ runner.os == 'macOS' && 'tar -zxf nushell.tar.gz --one-top-level=nushell --strip-components=2' || true }} && \ + ${{ runner.os == 'macOS' && 'echo "cp files"' || true }} && \ ${{ runner.os == 'macOS' && 'cp nushell/nu /usr/bin' || true }} && \ ${{ runner.os == 'macOS' && 'cp nushell/nu_plugin_sys /usr/bin' || true}} && \ exit 0 || true; From 75766261bc9707ff95b36208c5d8d4702d74d4ac Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Wed, 1 Sep 2021 21:11:51 +0100 Subject: [PATCH 47/65] from binaries --- .github/workflows/check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b04c76931..df383b672 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -49,6 +49,7 @@ jobs: ${{ runner.os == 'Linux' && 'sudo cp nushell/nu_plugin_sys /usr/bin' || true}} && \ ${{ runner.os == 'Windows' && 'choco install nushell' || true }} && \ ${{ runner.os == 'macOS' && 'brew install fish tcsh' || true }} && \ + ${{ runner.os == 'macOS' && 'brew install tar' || true }} && \ ${{ runner.os == 'macOS' && 'echo "curl github"' || true }} && \ ${{ runner.os == 'macOS' && 'nushell_url=$(curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep "browser_" | cut -d\" -f4 | grep .tar.gz)' || true }} && \ ${{ runner.os == 'macOS' && 'echo "wget"' || true }} && \ From 2f88684bda429368acc4f05ea2677f79496ba8cd Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Wed, 1 Sep 2021 21:13:20 +0100 Subject: [PATCH 48/65] from binaries --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index df383b672..42f2d6701 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -49,7 +49,7 @@ jobs: ${{ runner.os == 'Linux' && 'sudo cp nushell/nu_plugin_sys /usr/bin' || true}} && \ ${{ runner.os == 'Windows' && 'choco install nushell' || true }} && \ ${{ runner.os == 'macOS' && 'brew install fish tcsh' || true }} && \ - ${{ runner.os == 'macOS' && 'brew install tar' || true }} && \ + ${{ runner.os == 'macOS' && 'brew install gnu-tar' || true }} && \ ${{ runner.os == 'macOS' && 'echo "curl github"' || true }} && \ ${{ runner.os == 'macOS' && 'nushell_url=$(curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep "browser_" | cut -d\" -f4 | grep .tar.gz)' || true }} && \ ${{ runner.os == 'macOS' && 'echo "wget"' || true }} && \ From f8955e1a8ed710eb31a9b13169183877650ab243 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Wed, 1 Sep 2021 21:18:51 +0100 Subject: [PATCH 49/65] from binaries --- .github/workflows/check.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 42f2d6701..b04c76931 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -49,7 +49,6 @@ jobs: ${{ runner.os == 'Linux' && 'sudo cp nushell/nu_plugin_sys /usr/bin' || true}} && \ ${{ runner.os == 'Windows' && 'choco install nushell' || true }} && \ ${{ runner.os == 'macOS' && 'brew install fish tcsh' || true }} && \ - ${{ runner.os == 'macOS' && 'brew install gnu-tar' || true }} && \ ${{ runner.os == 'macOS' && 'echo "curl github"' || true }} && \ ${{ runner.os == 'macOS' && 'nushell_url=$(curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep "browser_" | cut -d\" -f4 | grep .tar.gz)' || true }} && \ ${{ runner.os == 'macOS' && 'echo "wget"' || true }} && \ From 374afbaa324f1958efd1e96c17f37ca5685a63ac Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Wed, 1 Sep 2021 21:21:58 +0100 Subject: [PATCH 50/65] using brew --- .github/workflows/check.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b04c76931..612952a9f 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -48,16 +48,7 @@ jobs: ${{ runner.os == 'Linux' && 'sudo cp nushell/nu /usr/bin' || true }} && \ ${{ runner.os == 'Linux' && 'sudo cp nushell/nu_plugin_sys /usr/bin' || true}} && \ ${{ runner.os == 'Windows' && 'choco install nushell' || true }} && \ - ${{ runner.os == 'macOS' && 'brew install fish tcsh' || true }} && \ - ${{ runner.os == 'macOS' && 'echo "curl github"' || true }} && \ - ${{ runner.os == 'macOS' && 'nushell_url=$(curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep "browser_" | cut -d\" -f4 | grep .tar.gz)' || true }} && \ - ${{ runner.os == 'macOS' && 'echo "wget"' || true }} && \ - ${{ runner.os == 'macOS' && 'wget -O nushell.tar.gz $nushell_url' || true }} && \ - ${{ runner.os == 'macOS' && 'echo "untar"' || true }} && \ - ${{ runner.os == 'macOS' && 'tar -zxf nushell.tar.gz --one-top-level=nushell --strip-components=2' || true }} && \ - ${{ runner.os == 'macOS' && 'echo "cp files"' || true }} && \ - ${{ runner.os == 'macOS' && 'cp nushell/nu /usr/bin' || true }} && \ - ${{ runner.os == 'macOS' && 'cp nushell/nu_plugin_sys /usr/bin' || true}} && \ + ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true }} && \ exit 0 || true; done exit 1 From 18a00feccf163a696a6e322060e62adaee181cc6 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Wed, 1 Sep 2021 21:26:26 +0100 Subject: [PATCH 51/65] using brew --- .github/workflows/check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 612952a9f..b10952771 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -48,6 +48,7 @@ jobs: ${{ runner.os == 'Linux' && 'sudo cp nushell/nu /usr/bin' || true }} && \ ${{ runner.os == 'Linux' && 'sudo cp nushell/nu_plugin_sys /usr/bin' || true}} && \ ${{ runner.os == 'Windows' && 'choco install nushell' || true }} && \ + ${{ runner.os == 'macOS' && 'brew update' || true }} && \ ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true }} && \ exit 0 || true; done From 3483f64a9fbbdce7f4edae8cb185600d085946df Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Wed, 1 Sep 2021 21:31:28 +0100 Subject: [PATCH 52/65] testing all --- .github/workflows/check.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b10952771..e34542a8d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -20,19 +20,19 @@ jobs: fail-fast: false matrix: os: - #- ubuntu-latest - #- windows-latest + - ubuntu-latest + - windows-latest - macos-latest py: - 3.10.0-rc.1 - #- 3.9 - #- 3.8 - #- 3.7 - #- 3.6 - #- 3.5 - #- pypy3 - #- 2.7 - #- pypy2 + - 3.9 + - 3.8 + - 3.7 + - 3.6 + - 3.5 + - pypy3 + - 2.7 + - pypy2 include: - { os: macos-latest, py: brew@py3 } steps: From 53523dca97bd964aa8f79f9013c2e44d61a3f131 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Thu, 2 Sep 2021 09:13:28 +0100 Subject: [PATCH 53/65] testing brew --- .github/workflows/check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index e34542a8d..5a9f4e29d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -20,8 +20,8 @@ jobs: fail-fast: false matrix: os: - - ubuntu-latest - - windows-latest + #- ubuntu-latest + #- windows-latest - macos-latest py: - 3.10.0-rc.1 From b91a7c96441f6661de89639500fe1bfb2c5c2378 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Thu, 2 Sep 2021 17:51:08 +0100 Subject: [PATCH 54/65] testing brew --- .github/workflows/check.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 5a9f4e29d..99abeb682 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -48,8 +48,7 @@ jobs: ${{ runner.os == 'Linux' && 'sudo cp nushell/nu /usr/bin' || true }} && \ ${{ runner.os == 'Linux' && 'sudo cp nushell/nu_plugin_sys /usr/bin' || true}} && \ ${{ runner.os == 'Windows' && 'choco install nushell' || true }} && \ - ${{ runner.os == 'macOS' && 'brew update' || true }} && \ - ${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true }} && \ + ${{ runner.os == 'macOS' && ''brew update && brew install fish tcsh nushell' || true }} && \ exit 0 || true; done exit 1 From e36488cf79f80a51ef5c7bc6c237f2eb9fb0febe Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Thu, 2 Sep 2021 17:51:23 +0100 Subject: [PATCH 55/65] testing brew --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 99abeb682..bfadc555a 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -48,7 +48,7 @@ jobs: ${{ runner.os == 'Linux' && 'sudo cp nushell/nu /usr/bin' || true }} && \ ${{ runner.os == 'Linux' && 'sudo cp nushell/nu_plugin_sys /usr/bin' || true}} && \ ${{ runner.os == 'Windows' && 'choco install nushell' || true }} && \ - ${{ runner.os == 'macOS' && ''brew update && brew install fish tcsh nushell' || true }} && \ + ${{ runner.os == 'macOS' && 'brew update && brew install fish tcsh nushell' || true }} && \ exit 0 || true; done exit 1 From b309243459a96c59a7111aa546a599f1b3248b49 Mon Sep 17 00:00:00 2001 From: Lily Mara Date: Wed, 15 Sep 2021 23:02:17 -0700 Subject: [PATCH 56/65] Remove the PYTHONEXECUTABLE variable from nushell scripts PYTHONEXECUTABLE is not used by any of the other shell activation scripts, setting it directly will require this script to walk the path and determine the OS. We should not be setting it. This resolves test failures on macOS, since the previous version added the windows-specific `.exe` suffix. --- src/virtualenv/activation/nushell/activate.nu | 3 --- src/virtualenv/activation/nushell/deactivate.nu | 1 - 2 files changed, 4 deletions(-) diff --git a/src/virtualenv/activation/nushell/activate.nu b/src/virtualenv/activation/nushell/activate.nu index 6d1d27536..d31b1ae2d 100644 --- a/src/virtualenv/activation/nushell/activate.nu +++ b/src/virtualenv/activation/nushell/activate.nu @@ -8,15 +8,12 @@ let old-path = ($nu.path | str collect ($path-sep)) let venv-path = ([$virtual-env $bin] | path join) let new-path = ($nu.path | prepend $venv-path | str collect ($path-sep)) -let python_executable = ([$virtual-env $bin "python.exe"] | path join) - # environment variables that will be batched loaded to the virtual env let new-env = ([ [name, value]; [PATH $new-path] [_OLD_VIRTUAL_PATH $old-path] [VIRTUAL_ENV $virtual-env] - [PYTHONEXECUTABLE $python_executable] ]) load-env $new-env diff --git a/src/virtualenv/activation/nushell/deactivate.nu b/src/virtualenv/activation/nushell/deactivate.nu index 9c92040cc..1ce964eb2 100644 --- a/src/virtualenv/activation/nushell/deactivate.nu +++ b/src/virtualenv/activation/nushell/deactivate.nu @@ -6,7 +6,6 @@ let-env $path-name = $nu.env._OLD_VIRTUAL_PATH unlet-env VIRTUAL_ENV unlet-env _OLD_VIRTUAL_PATH unlet-env PROMPT_STRING -unlet-env PYTHONEXECUTABLE unalias pydoc unalias deactivate From e173b3b2faf7f3c002f1027e211f3ced7cd4b655 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Thu, 16 Sep 2021 07:39:31 +0100 Subject: [PATCH 57/65] change command_prompt to command_script --- src/virtualenv/activation/nushell/activate.nu | 2 +- src/virtualenv/activation/nushell/deactivate.nu | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/virtualenv/activation/nushell/activate.nu b/src/virtualenv/activation/nushell/activate.nu index 6d1d27536..73bf87266 100644 --- a/src/virtualenv/activation/nushell/activate.nu +++ b/src/virtualenv/activation/nushell/activate.nu @@ -35,7 +35,7 @@ let new_prompt = (if ( config | select prompt | empty? ) { } { ($"build-string '(char lparen)' '($virtual_prompt)' '(char rparen) ' (config get prompt | str find-replace "build-string" "")") }) -let-env PROMPT_STRING = $new_prompt +let-env PROMPT_COMMAND = $new_prompt # We are using alias as the function definitions because only aliases can be # removed from the scope diff --git a/src/virtualenv/activation/nushell/deactivate.nu b/src/virtualenv/activation/nushell/deactivate.nu index 9c92040cc..d1b1a601c 100644 --- a/src/virtualenv/activation/nushell/deactivate.nu +++ b/src/virtualenv/activation/nushell/deactivate.nu @@ -5,7 +5,7 @@ let-env $path-name = $nu.env._OLD_VIRTUAL_PATH # Unleting the environment variables that were created when activating the env unlet-env VIRTUAL_ENV unlet-env _OLD_VIRTUAL_PATH -unlet-env PROMPT_STRING +unlet-env PROMPT_PROMPT unlet-env PYTHONEXECUTABLE unalias pydoc From 4dade588d6ac615d1549bd553952950552efc0f4 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Thu, 16 Sep 2021 07:43:38 +0100 Subject: [PATCH 58/65] all tests enabled --- .github/workflows/check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index bfadc555a..cc2e972b9 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -20,8 +20,8 @@ jobs: fail-fast: false matrix: os: - #- ubuntu-latest - #- windows-latest + - ubuntu-latest + - windows-latest - macos-latest py: - 3.10.0-rc.1 From dbdff01e01cafd319f0dcff225bb424f691ecdcd Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Thu, 16 Sep 2021 07:50:57 +0100 Subject: [PATCH 59/65] removed sys plugin --- .github/workflows/check.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index cc2e972b9..6ec364e3b 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -46,7 +46,6 @@ jobs: ${{ runner.os == 'Linux' && 'wget -O nushell.tar.gz $nushell_url' || true }} && \ ${{ runner.os == 'Linux' && 'tar -zxf nushell.tar.gz --one-top-level=nushell --strip-components=2' || true }} && \ ${{ runner.os == 'Linux' && 'sudo cp nushell/nu /usr/bin' || true }} && \ - ${{ runner.os == 'Linux' && 'sudo cp nushell/nu_plugin_sys /usr/bin' || true}} && \ ${{ runner.os == 'Windows' && 'choco install nushell' || true }} && \ ${{ runner.os == 'macOS' && 'brew update && brew install fish tcsh nushell' || true }} && \ exit 0 || true; From 8f654a4fd507a4d8d4daadca0d20b1e6ffc8bf69 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Thu, 16 Sep 2021 09:20:58 +0100 Subject: [PATCH 60/65] get path using shutil --- src/virtualenv/activation/nushell/__init__.py | 2 +- tests/unit/activation/test_nushell.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/virtualenv/activation/nushell/__init__.py b/src/virtualenv/activation/nushell/__init__.py index f5611cbd1..994c1fb6b 100644 --- a/src/virtualenv/activation/nushell/__init__.py +++ b/src/virtualenv/activation/nushell/__init__.py @@ -24,5 +24,5 @@ def replacements(self, creator, dest_folder): "__VIRTUAL_NAME__": creator.env_name, "__BIN_NAME__": ensure_text(str(creator.bin_dir.relative_to(creator.dest))), "__PATH_SEP__": ensure_text(os.pathsep), - "__DEACTIVATE_PATH__": ensure_text(str(Path(dest_folder) / Path("deactivate.nu"))), + "__DEACTIVATE_PATH__": ensure_text(str(Path(dest_folder) / "deactivate.nu")), } diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index 8705cfee2..e7c75e007 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -1,3 +1,4 @@ +import shutil from __future__ import absolute_import, unicode_literals from virtualenv.activation import NushellActivator @@ -7,7 +8,10 @@ def test_nushell(activation_tester_class, activation_tester): class Nushell(activation_tester_class): def __init__(self, session): - cmd = "c:\\program files\\nu\\bin\\nu.exe" if IS_WIN else "nu" + cmd = shutil.which("nu") + if cmd is None and IS_WIN: + cmd = "c:\\program files\\nu\\bin\\nu.exe" + super(Nushell, self).__init__(NushellActivator, session, cmd, "activate.nu", "nu") self.unix_line_ending = not IS_WIN From 7d7a3db6af01d6f57323056c7726ef2bdc229ea2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 16 Sep 2021 08:21:20 +0000 Subject: [PATCH 61/65] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/unit/activation/test_nushell.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index e7c75e007..4f026cd8a 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -1,6 +1,7 @@ -import shutil from __future__ import absolute_import, unicode_literals +import shutil + from virtualenv.activation import NushellActivator from virtualenv.info import IS_WIN From 80e7165348c4757dc7bdb48e5a5e2a8554f9de07 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Thu, 16 Sep 2021 09:51:37 +0100 Subject: [PATCH 62/65] import lint --- tests/unit/activation/test_nushell.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index e7c75e007..f2e570017 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -1,4 +1,5 @@ import shutil + from __future__ import absolute_import, unicode_literals from virtualenv.activation import NushellActivator From 0d7dbede909b3f31bcc3028d32b8288bcfa442c7 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Thu, 16 Sep 2021 11:10:10 +0100 Subject: [PATCH 63/65] using find executable --- tests/unit/activation/test_nushell.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index 4f026cd8a..ea0b6bbab 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -1,6 +1,6 @@ from __future__ import absolute_import, unicode_literals -import shutil +from distutils.spawn import find_executable from virtualenv.activation import NushellActivator from virtualenv.info import IS_WIN @@ -9,7 +9,7 @@ def test_nushell(activation_tester_class, activation_tester): class Nushell(activation_tester_class): def __init__(self, session): - cmd = shutil.which("nu") + cmd = find_executable("nu") if cmd is None and IS_WIN: cmd = "c:\\program files\\nu\\bin\\nu.exe" From aed2af8ef84015b5aef347b5774a5d373070ac09 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Thu, 16 Sep 2021 11:33:05 +0100 Subject: [PATCH 64/65] change to prompt_command --- src/virtualenv/activation/nushell/deactivate.nu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/virtualenv/activation/nushell/deactivate.nu b/src/virtualenv/activation/nushell/deactivate.nu index 1ce964eb2..405243803 100644 --- a/src/virtualenv/activation/nushell/deactivate.nu +++ b/src/virtualenv/activation/nushell/deactivate.nu @@ -5,7 +5,7 @@ let-env $path-name = $nu.env._OLD_VIRTUAL_PATH # Unleting the environment variables that were created when activating the env unlet-env VIRTUAL_ENV unlet-env _OLD_VIRTUAL_PATH -unlet-env PROMPT_STRING +unlet-env PROMPT_COMMAND unalias pydoc unalias deactivate From 96795f95513416d06d19d92c6ebd0af09bb55dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Thu, 16 Sep 2021 11:42:22 +0100 Subject: [PATCH 65/65] Ammend command discovery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We should only use deprected API if we must. Signed-off-by: Bernát Gábor --- tests/unit/activation/test_nushell.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/unit/activation/test_nushell.py b/tests/unit/activation/test_nushell.py index ea0b6bbab..6eb50ba52 100644 --- a/tests/unit/activation/test_nushell.py +++ b/tests/unit/activation/test_nushell.py @@ -1,6 +1,12 @@ from __future__ import absolute_import, unicode_literals -from distutils.spawn import find_executable +import sys + +if sys.version_info > (3,): + from shutil import which +else: + from distutils.spawn import find_executable as which + from virtualenv.activation import NushellActivator from virtualenv.info import IS_WIN @@ -9,7 +15,7 @@ def test_nushell(activation_tester_class, activation_tester): class Nushell(activation_tester_class): def __init__(self, session): - cmd = find_executable("nu") + cmd = which("nu") if cmd is None and IS_WIN: cmd = "c:\\program files\\nu\\bin\\nu.exe"