Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bash activator should have no extension #1508 #1509

Merged
merged 1 commit into from
Jan 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)