diff --git a/src/virtualenv/activation/batch/__init__.py b/src/virtualenv/activation/batch/__init__.py index 4f03555e9..5a9ea626a 100644 --- a/src/virtualenv/activation/batch/__init__.py +++ b/src/virtualenv/activation/batch/__init__.py @@ -22,8 +22,3 @@ def instantiate_template(self, replacements, template, creator): base = super(BatchActivator, self).instantiate_template(replacements, template, creator) return base.replace(os.linesep, "\n").replace("\n", os.linesep) - def replacements(self, creator, dest_folder): - base_replacements = super(BatchActivator, self).replacements(creator, dest_folder) - if not base_replacements["__VIRTUAL_PROMPT__"]: - base_replacements["__VIRTUAL_PROMPT__"] = "(%s) " % creator.env_name - return base_replacements diff --git a/src/virtualenv/activation/batch/activate.bat b/src/virtualenv/activation/batch/activate.bat index 96e835b52..cd4c160c1 100644 --- a/src/virtualenv/activation/batch/activate.bat +++ b/src/virtualenv/activation/batch/activate.bat @@ -13,7 +13,13 @@ if defined _OLD_VIRTUAL_PROMPT ( ) ) if not defined VIRTUAL_ENV_DISABLE_PROMPT ( - set "PROMPT=__VIRTUAL_PROMPT__%PROMPT%" + set ENV_PROMPT=__VIRTUAL_PROMPT__ + if ["%ENV_PROMPT%"] == [""] ( + for %%d in ("%VIRTUAL_ENV%") do set "VIRTUAL_ENV_NAME=%%~nxd" + set "ENV_PROMPT=(%VIRTUAL_ENV_NAME%) " + ) + ) + set "PROMPT=%ENV_PROMPT%%PROMPT%" ) REM Don't use () to avoid problems with them in %PATH%