Skip to content

Commit

Permalink
Bash activator should have no extension #1508 (#1509)
Browse files Browse the repository at this point in the history
This is how things worked without the rewrite and in
venv so consolidating.

Signed-off-by: Bernat Gabor <[email protected]>
  • Loading branch information
gaborbernat authored Jan 28, 2020
1 parent 5999078 commit 0f6d7de
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/virtualenv/activation/bash/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ def supports(cls, interpreter):

def templates(self):
yield Path("activate.sh")

def as_name(self, template):
return template.stem
6 changes: 5 additions & 1 deletion src/virtualenv/activation/via_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/activation/test_bash.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 0f6d7de

Please sign in to comment.