From b43b0c9fad0381c863a76260aeb9a004e106a6c8 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 8 Dec 2019 12:40:37 +0100 Subject: [PATCH] dist: ship regular "distutils" even when in PyPI "virtualenv" env Fixes #747 --- direct/src/dist/FreezeTool.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/direct/src/dist/FreezeTool.py b/direct/src/dist/FreezeTool.py index 18ecbf109a..9c318b8438 100644 --- a/direct/src/dist/FreezeTool.py +++ b/direct/src/dist/FreezeTool.py @@ -2372,6 +2372,17 @@ class PandaModuleFinder(modulefinder.ModuleFinder): path = self.path + if fullname == 'distutils' and hasattr(sys, 'real_prefix'): + # The PyPI version of virtualenv inserts a special version of + # distutils that does some bizarre stuff that won't work in our + # deployed application. Force it to find the regular one. + try: + fp, fn, stuff = self.find_module('opcode') + if fn: + path = [os.path.dirname(fn)] + path + except ImportError: + pass + # Look for the module on the search path. for dir_path in path: basename = os.path.join(dir_path, name.split('.')[-1])