diff --git a/src/virtualenv/activation/bash/__init__.py b/src/virtualenv/activation/bash/__init__.py index c89b42edb..df3f77279 100644 --- a/src/virtualenv/activation/bash/__init__.py +++ b/src/virtualenv/activation/bash/__init__.py @@ -12,3 +12,6 @@ def supports(cls, interpreter): 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 3f6b46bb3..d9d0a14dc 100644 --- a/src/virtualenv/activation/via_template.py +++ b/src/virtualenv/activation/via_template.py @@ -39,7 +39,11 @@ def replacements(self, creator, dest_folder): 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 d5d8ad9b0..b5ff92852 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)