From d4d93d9ea2487dad1fcb66bdef9b214d0233614e Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Thu, 27 Jul 2023 09:54:07 -0600 Subject: Further fix issue #4376 posix platform Oops, missed that SCons/Platform/virtualenvTests.py needed the same hack as SCons/Platform/PlatformTests.py (in PR #4381) Signed-off-by: Mats Wichmann --- SCons/Platform/virtualenvTests.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/SCons/Platform/virtualenvTests.py b/SCons/Platform/virtualenvTests.py index 9591063..e256520 100644 --- a/SCons/Platform/virtualenvTests.py +++ b/SCons/Platform/virtualenvTests.py @@ -21,6 +21,15 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# TODO: issue #4376: since Python 3.12, CPython's posixpath.py does a test +# import of 'posix', expecting it to fail on win32. However, if +# SCons/Platform is in sys.path, it will find our posix module instead. +# This happens in this unittest, since it's the script path. Remove +# it before the stdlib imports. Better way to handle this problem? +import sys +if 'Platform' in sys.path[0]: + platpath = sys.path.pop(0) +# pylint: disable=wrong-import-position import collections import unittest import os @@ -29,6 +38,7 @@ import sys import SCons.compat import SCons.Platform.virtualenv import SCons.Util +# pylint: enable=wrong-import-position class Environment(collections.UserDict): def Detect(self, cmd): -- cgit v0.12