File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed
Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change 66and will eventually be removed.
77"""
88
9+ import os
910import sys
1011
1112from setuptools .build_meta import _BuildMetaBackend
@@ -25,14 +26,21 @@ def run_setup(self, setup_script='setup.py'):
2526 # In order to maintain compatibility with scripts assuming that
2627 # the setup.py script is in a directory on the PYTHONPATH, inject
2728 # '' into sys.path. (pypa/setuptools#1642)
28- sys_path = list (sys .path ) # Save the old path
29- if '' not in sys .path :
30- sys .path .insert (0 , '' )
31-
32- super (_BuildMetaLegacyBackend ,
33- self ).run_setup (setup_script = setup_script )
34-
35- sys .path = sys_path # Restore the old path
29+ sys_path = list (sys .path ) # Save the original path
30+
31+ try :
32+ if '' not in sys .path :
33+ sys .path .insert (0 , '' )
34+
35+ super (_BuildMetaLegacyBackend ,
36+ self ).run_setup (setup_script = setup_script )
37+ finally :
38+ # While PEP 517 frontends should be calling each hook in a fresh
39+ # subprocess according to the standard (and thus it should not be
40+ # strictly necessary to restore the old sys.path), we'll restore
41+ # the original path so that the path manipulation does not persist
42+ # within the hook after run_setup is called.
43+ sys .path [:] = sys_path
3644
3745
3846_BACKEND = _BuildMetaLegacyBackend ()
You can’t perform that action at this time.
0 commit comments