From c9561390279e700be87c0993b2379be52f193601 Mon Sep 17 00:00:00 2001 From: Bernat Gabor Date: Thu, 9 Jan 2020 16:56:01 +0000 Subject: [PATCH] with json.dump we can enable black on activate_this Signed-off-by: Bernat Gabor --- src/virtualenv/activation/python/activate_this.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/virtualenv/activation/python/activate_this.py b/src/virtualenv/activation/python/activate_this.py index 3311fe813..19e373ba8 100644 --- a/src/virtualenv/activation/python/activate_this.py +++ b/src/virtualenv/activation/python/activate_this.py @@ -34,20 +34,18 @@ def set_env(key, value, encoding): # add the virtual environments site-packages to the host python import mechanism prev = set(sys.path) -# fmt: off -# turn formatter off as json dumps will contain " characters - so we really need here ' black -site_packages = r''' +site_packages = r""" __SITE_PACKAGES__ -''' +""" for site_package in json.loads(site_packages): if sys.version_info[0] == 2: - site_package = site_package.encode('utf-8').decode(sys.getfilesystemencoding()) + site_package = site_package.encode("utf-8").decode(sys.getfilesystemencoding()) path = os.path.realpath(os.path.join(os.path.dirname(__file__), site_package)) if sys.version_info[0] == 2: path = path.encode(sys.getfilesystemencoding()) site.addsitedir(path) -# fmt: on + sys.real_prefix = sys.prefix sys.prefix = base