setup.py
branchstable
changeset 6836 fb3633142d8f
parent 6537 308037210dab
child 7879 9aae456abab5
equal deleted inserted replaced
6835:87e2641d75f7 6836:fb3633142d8f
   192         # monkey patch: Crack SandboxViolation verification
   192         # monkey patch: Crack SandboxViolation verification
   193         from setuptools.sandbox import DirectorySandbox as DS
   193         from setuptools.sandbox import DirectorySandbox as DS
   194         old_ok = DS._ok
   194         old_ok = DS._ok
   195         def _ok(self, path):
   195         def _ok(self, path):
   196             """Return True if ``path`` can be written during installation."""
   196             """Return True if ``path`` can be written during installation."""
   197             out = old_ok(self, path)
   197             out = old_ok(self, path) # here for side effect from setuptools
   198             realpath = os.path.normcase(os.path.realpath(path))
   198             realpath = os.path.normcase(os.path.realpath(path))
   199             if realpath.startswith(sys.prefix):
   199             allowed_path = os.path.normcase(sys.prefix)
       
   200             if realpath.startswith(allowed_path):
   200                 out = True
   201                 out = True
   201             return out
   202             return out
   202         DS._ok = _ok
   203         DS._ok = _ok
   203     except ImportError:
   204     except ImportError:
   204         pass
   205         pass