bpo-35872 and bpo-35873: Clears __PYVENV_LAUNCHER__ variable (GH-11745)

After reading __PYVENV_LAUNCHER__ we now set sys._base_executable value for later use.
Make the same changes for macOS to avoid extra platform checks.
This commit is contained in:
Steve Dower 2019-02-03 23:19:38 -08:00 committed by GitHub
parent 2f6fae6e51
commit a8474d025c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 23 deletions

View file

@ -52,10 +52,7 @@ class BaseTest(unittest.TestCase):
self.bindir = 'bin'
self.lib = ('lib', 'python%d.%d' % sys.version_info[:2])
self.include = 'include'
if sys.platform == 'darwin' and '__PYVENV_LAUNCHER__' in os.environ:
executable = os.environ['__PYVENV_LAUNCHER__']
else:
executable = sys.executable
executable = getattr(sys, '_base_executable', sys.executable)
self.exe = os.path.split(executable)[-1]
def tearDown(self):
@ -100,11 +97,7 @@ class BasicTest(BaseTest):
else:
self.assertFalse(os.path.exists(p))
data = self.get_text_file_contents('pyvenv.cfg')
if sys.platform == 'darwin' and ('__PYVENV_LAUNCHER__'
in os.environ):
executable = os.environ['__PYVENV_LAUNCHER__']
else:
executable = sys.executable
executable = getattr(sys, '_base_executable', sys.executable)
path = os.path.dirname(executable)
self.assertIn('home = %s' % path, data)
fn = self.get_env_file(self.bindir, self.exe)