Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/lib-tk/FixTk.py

    r2 r391  
    2020else:
    2121    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")
    2424        hdir = ctypes.windll.kernel32.\
    25             CreateFileW(s, 0x80,    # FILE_READ_ATTRIBUTES
     25            CreateFileW(udir, 0x80, # FILE_READ_ATTRIBUTES
    2626                        1,          # FILE_SHARE_READ
    2727                        None, 3,    # OPEN_EXISTING
     
    3939            # Conversion failed (e.g. network location)
    4040            return s
    41         s = buf[:res]
     41        s = buf[:res].encode("mbcs")
    4242        # Ignore leading \\?\
    43         if s.startswith(u"\\\\?\\"):
     43        if s.startswith("\\\\?\\"):
    4444            s = s[4:]
     45        if s.startswith("UNC"):
     46            s = "\\" + s[3:]
    4547        return s
    4648
     
    5355if os.path.exists(prefix):
    5456    prefix = convert_path(prefix)
    55     if not os.environ.has_key("TCL_LIBRARY"):
     57    if "TCL_LIBRARY" not in os.environ:
    5658        for name in os.listdir(prefix):
    5759            if name.startswith("tcl"):
     
    6365    import _tkinter
    6466    ver = str(_tkinter.TCL_VERSION)
    65     if not os.environ.has_key("TK_LIBRARY"):
     67    if "TK_LIBRARY" not in os.environ:
    6668        v = os.path.join(prefix, 'tk'+ver)
    6769        if os.path.exists(os.path.join(v, "tclIndex")):
     
    6971    # We don't know the Tix version, so we must search the entire
    7072    # directory
    71     if not os.environ.has_key("TIX_LIBRARY"):
     73    if "TIX_LIBRARY" not in os.environ:
    7274        for name in os.listdir(prefix):
    7375            if name.startswith("tix"):
Note: See TracChangeset for help on using the changeset viewer.