File tree Expand file tree Collapse file tree 2 files changed +26
-8
lines changed
Expand file tree Collapse file tree 2 files changed +26
-8
lines changed Original file line number Diff line number Diff line change 11from IPython .core .compilerop import CachingCompiler
22import tempfile
33import os
4+ import sys
45
56
67def murmur2_x86 (data , seed ):
@@ -36,15 +37,33 @@ def murmur2_x86(data, seed):
3637
3738 return h
3839
40+ convert_to_long_pathname = lambda filename :filename
41+
42+ if sys .platform == 'win32' :
43+ try :
44+ import ctypes
45+ from ctypes .wintypes import MAX_PATH , LPCWSTR , LPWSTR , DWORD
46+
47+ _GetLongPathName = ctypes .windll .kernel32 .GetLongPathNameW
48+ _GetLongPathName .argtypes = [LPCWSTR , LPWSTR , DWORD ]
49+ _GetLongPathName .restype = DWORD
50+
51+ def _convert_to_long_pathname (filename ):
52+ buf = ctypes .create_unicode_buffer (MAX_PATH )
53+ rv = _GetLongPathName (filename , buf , MAX_PATH )
54+ if rv != 0 and rv <= MAX_PATH :
55+ filename = buf .value
56+ return filename
57+
58+ # test that it works
59+ _convert_to_long_pathname (__file__ )
60+ except :
61+ pass
62+ else :
63+ convert_to_long_pathname = _convert_to_long_pathname
3964
4065def get_tmp_directory ():
41- tmp_dir = tempfile .gettempdir ()
42- if os .name == 'nt' :
43- try :
44- import win32file
45- tmp_dir = win32file .GetLongPathName (tmp_dir )
46- except :
47- pass
66+ tmp_dir = convert_to_long_pathname (tempfile .gettempdir ())
4867 pid = os .getpid ()
4968 return tmp_dir + os .sep + 'ipykernel_' + str (pid )
5069
Original file line number Diff line number Diff line change @@ -69,7 +69,6 @@ def run(self):
6969 'matplotlib-inline>=0.1.0,<0.2.0' ,
7070 'appnope;platform_system=="Darwin"' ,
7171 'nest_asyncio' ,
72- 'pywin32;platform_system=="Windows"'
7372 ],
7473 extras_require = {
7574 "test" : [
You can’t perform that action at this time.
0 commit comments