Skip to content

Commit 339ce7c

Browse files
committed
Work around pip 25/pyproject_hooks 1.2.0 path meddling
pip 25/pyproject_hooks 1.2.0 inserts `_BackendPathFinder` into `sys.meta_path` at index 0, and that makes the import machinery find the directory `platform` as a namespace instead of importing the standrd platform module. Work around by removing this finder from `sys.meta_path` if it is present at index 0. Upstream bug: pypa/pip#13289
1 parent db98255 commit 339ce7c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

setup.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,15 @@
3333
run swig.
3434
'''
3535

36+
# Work around pip 25/pyproject_hooks 1.2.0 path meddling:
37+
import sys
38+
if sys.meta_path[0].__class__.__name__ == '_BackendPathFinder':
39+
sys.meta_path.pop(0)
40+
3641
import os
3742
import platform
3843
import re
3944
import subprocess
40-
import sys
4145
import time
4246

4347

0 commit comments

Comments
 (0)