← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:setup-no-pip-build-env into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:setup-no-pip-build-env into launchpad:master.

Commit message:
setup.py: Filter out pip-build-env-* directories from system paths

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/406527

I've occasionally seen pip-build-env-* directories leaking into `sys.path` at the point when Launchpad's setup.py is run, which results in picking up fragments of `sitecustomize.py` which then refer to directories that no longer exist after `pip` exits, resulting in a broken installation.  It's not completely clear to me why this happens, but it's very confusing when it does, so filter those out.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:setup-no-pip-build-env into launchpad:master.
diff --git a/setup.py b/setup.py
index 874a893..aee5410 100644
--- a/setup.py
+++ b/setup.py
@@ -66,7 +66,8 @@ class lp_develop(develop):
     def _get_orig_sitecustomize(self):
         env_top = os.path.join(os.path.dirname(__file__), "env")
         system_paths = [
-            path for path in sys.path if not path.startswith(env_top)]
+            path for path in sys.path
+            if not path.startswith(env_top) and "pip-build-env-" not in path]
         try:
             fp, orig_sitecustomize_path, _ = (
                 imp.find_module("sitecustomize", system_paths))