Changeset 391 for python/trunk/Lib/lib-tk/FixTk.py
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Lib/lib-tk/FixTk.py
r2 r391 20 20 else: 21 21 def convert_path(s): 22 if isinstance(s, str):23 s= s.decode("mbcs")22 assert isinstance(s, str) # sys.prefix contains only bytes 23 udir = s.decode("mbcs") 24 24 hdir = ctypes.windll.kernel32.\ 25 CreateFileW( s, 0x80,# FILE_READ_ATTRIBUTES25 CreateFileW(udir, 0x80, # FILE_READ_ATTRIBUTES 26 26 1, # FILE_SHARE_READ 27 27 None, 3, # OPEN_EXISTING … … 39 39 # Conversion failed (e.g. network location) 40 40 return s 41 s = buf[:res] 41 s = buf[:res].encode("mbcs") 42 42 # Ignore leading \\?\ 43 if s.startswith( u"\\\\?\\"):43 if s.startswith("\\\\?\\"): 44 44 s = s[4:] 45 if s.startswith("UNC"): 46 s = "\\" + s[3:] 45 47 return s 46 48 … … 53 55 if os.path.exists(prefix): 54 56 prefix = convert_path(prefix) 55 if not os.environ.has_key("TCL_LIBRARY"):57 if "TCL_LIBRARY" not in os.environ: 56 58 for name in os.listdir(prefix): 57 59 if name.startswith("tcl"): … … 63 65 import _tkinter 64 66 ver = str(_tkinter.TCL_VERSION) 65 if not os.environ.has_key("TK_LIBRARY"):67 if "TK_LIBRARY" not in os.environ: 66 68 v = os.path.join(prefix, 'tk'+ver) 67 69 if os.path.exists(os.path.join(v, "tclIndex")): … … 69 71 # We don't know the Tix version, so we must search the entire 70 72 # directory 71 if not os.environ.has_key("TIX_LIBRARY"):73 if "TIX_LIBRARY" not in os.environ: 72 74 for name in os.listdir(prefix): 73 75 if name.startswith("tix"):
Note:
See TracChangeset
for help on using the changeset viewer.