summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernát Gábor <bgabor8@bloomberg.net>2020-01-28 14:35:26 +0000
committerGitHub <noreply@github.com>2020-01-28 14:35:26 +0000
commit0f6d7de738507074341e12b2deba9b1725dbb88c (patch)
tree51c189d1903cd7c8fa93132cf6c406795090db38
parent599907870e9a501224cf603af863c712e581c752 (diff)
downloadvirtualenv-0f6d7de738507074341e12b2deba9b1725dbb88c.tar.gz
Bash activator should have no extension #1508 (#1509)
This is how things worked without the rewrite and in venv so consolidating. Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
-rw-r--r--src/virtualenv/activation/bash/__init__.py3
-rw-r--r--src/virtualenv/activation/via_template.py6
-rw-r--r--tests/unit/activation/test_bash.py2
3 files changed, 9 insertions, 2 deletions
diff --git a/src/virtualenv/activation/bash/__init__.py b/src/virtualenv/activation/bash/__init__.py
index c89b42e..df3f772 100644
--- a/src/virtualenv/activation/bash/__init__.py
+++ b/src/virtualenv/activation/bash/__init__.py
@@ -12,3 +12,6 @@ class BashActivator(ViaTemplateActivator):
def templates(self):
yield Path("activate.sh")
+
+ def as_name(self, template):
+ return template.stem
diff --git a/src/virtualenv/activation/via_template.py b/src/virtualenv/activation/via_template.py
index 3f6b46b..d9d0a14 100644
--- a/src/virtualenv/activation/via_template.py
+++ b/src/virtualenv/activation/via_template.py
@@ -39,7 +39,11 @@ class ViaTemplateActivator(Activator):
def _generate(self, replacements, templates, to_folder, creator):
for template in templates:
text = self.instantiate_template(replacements, template, creator)
- (to_folder / template).write_text(text, encoding="utf-8")
+ dest = to_folder / self.as_name(template)
+ dest.write_text(text, encoding="utf-8")
+
+ def as_name(self, template):
+ return template.name
def instantiate_template(self, replacements, template, creator):
# read text and do replacements
diff --git a/tests/unit/activation/test_bash.py b/tests/unit/activation/test_bash.py
index d5d8ad9..b5ff928 100644
--- a/tests/unit/activation/test_bash.py
+++ b/tests/unit/activation/test_bash.py
@@ -7,7 +7,7 @@ def test_bash(raise_on_non_source_class, activation_tester):
class Bash(raise_on_non_source_class):
def __init__(self, session):
super(Bash, self).__init__(
- BashActivator, session, "bash", "activate.sh", "sh", "You must source this script: $ source "
+ BashActivator, session, "bash", "activate", "sh", "You must source this script: $ source "
)
activation_tester(Bash)