Skip to content

Commit

Permalink
with json.dump we can enable black on activate_this
Browse files Browse the repository at this point in the history
Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
  • Loading branch information
gaborbernat committed Jan 9, 2020
1 parent 64dc72b commit c956139
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/virtualenv/activation/python/activate_this.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c956139

Please sign in to comment.