MCPcopy Index your code
hub / github.com/RustPython/RustPython / _create_underpth_exe

Method _create_underpth_exe

Lib/test/test_site.py:668–686  ·  view source on GitHub ↗
(self, lines, exe_pth=True)

Source from the content-addressed store, hash-verified

666
667 if sys.platform == 'win32':
668 def _create_underpth_exe(self, lines, exe_pth=True):
669 import _winapi
670 temp_dir = tempfile.mkdtemp()
671 self.addCleanup(os_helper.rmtree, temp_dir)
672 exe_file = os.path.join(temp_dir, os.path.split(sys.executable)[1])
673 dll_src_file = _winapi.GetModuleFileName(sys.dllhandle)
674 dll_file = os.path.join(temp_dir, os.path.split(dll_src_file)[1])
675 shutil.copy(sys.executable, exe_file)
676 shutil.copy(dll_src_file, dll_file)
677 for fn in glob.glob(os.path.join(os.path.split(dll_src_file)[0], "vcruntime*.dll")):
678 shutil.copy(fn, os.path.join(temp_dir, os.path.split(fn)[1]))
679 if exe_pth:
680 _pth_file = os.path.splitext(exe_file)[0] + '._pth'
681 else:
682 _pth_file = os.path.splitext(dll_file)[0] + '._pth'
683 with open(_pth_file, 'w', encoding='utf8') as f:
684 for line in lines:
685 print(line, file=f)
686 return exe_file
687 else:
688 def _create_underpth_exe(self, lines, exe_pth=True):
689 if not exe_pth:

Callers 4

test_underpth_basicMethod · 0.95
test_underpth_fileMethod · 0.95

Calls 9

mkdtempMethod · 0.80
addCleanupMethod · 0.80
splitextMethod · 0.80
openFunction · 0.50
printFunction · 0.50
joinMethod · 0.45
splitMethod · 0.45
copyMethod · 0.45
globMethod · 0.45

Tested by

no test coverage detected