Commit b8ce54e6 authored by Seppo Yli-Olli's avatar Seppo Yli-Olli Committed by Freedesktop SDK Merge Bot

Refactor a bit to make sure we don't emit errors

parent b73baeb2
Pipeline #59488182 passed with stages
in 142 minutes and 32 seconds
...@@ -2,10 +2,15 @@ import sys ...@@ -2,10 +2,15 @@ import sys
import site import site
import os import os
site.USER_BASE = os.environ.get("PYTHONUSERBASE", "/var/data/python")
old_user_site = os.path.abspath(site.USER_SITE) old_user_site = os.path.abspath(site.USER_SITE)
old_index = sys.path.index(old_user_site) try:
sys.path.remove(old_user_site) old_index = sys.path.index(old_user_site)
site.USER_SITE = None except ValueError:
# Unknon what causes this but let's not do anything if this happens
pass
else:
site.USER_BASE = os.environ.get("PYTHONUSERBASE", "/var/data/python")
sys.path.remove(old_user_site)
site.USER_SITE = None
sys.path.insert(old_index, site.getusersitepackages()) sys.path.insert(old_index, site.getusersitepackages())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment