home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / Calibre / calibre-0.8.18.msi / file_262 / os2emxpath.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2011-09-09  |  3.3 KB  |  142 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.7)
  3.  
  4. import os
  5. import stat
  6. from genericpath import *
  7. from ntpath import expanduser, expandvars, isabs, islink, splitdrive, splitext, split, walk
  8. __all__ = [
  9.     'normcase',
  10.     'isabs',
  11.     'join',
  12.     'splitdrive',
  13.     'split',
  14.     'splitext',
  15.     'basename',
  16.     'dirname',
  17.     'commonprefix',
  18.     'getsize',
  19.     'getmtime',
  20.     'getatime',
  21.     'getctime',
  22.     'islink',
  23.     'exists',
  24.     'lexists',
  25.     'isdir',
  26.     'isfile',
  27.     'ismount',
  28.     'walk',
  29.     'expanduser',
  30.     'expandvars',
  31.     'normpath',
  32.     'abspath',
  33.     'splitunc',
  34.     'curdir',
  35.     'pardir',
  36.     'sep',
  37.     'pathsep',
  38.     'defpath',
  39.     'altsep',
  40.     'extsep',
  41.     'devnull',
  42.     'realpath',
  43.     'supports_unicode_filenames']
  44. curdir = '.'
  45. pardir = '..'
  46. extsep = '.'
  47. sep = '/'
  48. altsep = '\\'
  49. pathsep = ';'
  50. defpath = '.;C:\\bin'
  51. devnull = 'nul'
  52.  
  53. def normcase(s):
  54.     return s.replace('\\', '/').lower()
  55.  
  56.  
  57. def join(a, *p):
  58.     path = a
  59.     for b in p:
  60.         if isabs(b):
  61.             path = b
  62.             continue
  63.         if path == '' or path[-1:] in '/\\:':
  64.             path = path + b
  65.             continue
  66.         path = path + '/' + b
  67.     
  68.     return path
  69.  
  70.  
  71. def splitunc(p):
  72.     if p[1:2] == ':':
  73.         return ('', p)
  74.     firstTwo = None[0:2]
  75.     if firstTwo == '//' or firstTwo == '\\\\':
  76.         normp = normcase(p)
  77.         index = normp.find('/', 2)
  78.         if index == -1:
  79.             return ('', p)
  80.         index = None.find('/', index + 1)
  81.         if index == -1:
  82.             index = len(p)
  83.         return (p[:index], p[index:])
  84.     return (None, p)
  85.  
  86.  
  87. def basename(p):
  88.     return split(p)[1]
  89.  
  90.  
  91. def dirname(p):
  92.     return split(p)[0]
  93.  
  94. lexists = exists
  95.  
  96. def ismount(path):
  97.     (unc, rest) = splitunc(path)
  98.     if unc:
  99.         return rest in ('', '/', '\\')
  100.     p = None(path)[1]
  101.     if len(p) == 1:
  102.         pass
  103.     return p[0] in '/\\'
  104.  
  105.  
  106. def normpath(path):
  107.     path = path.replace('\\', '/')
  108.     (prefix, path) = splitdrive(path)
  109.     while path[:1] == '/':
  110.         prefix = prefix + '/'
  111.         path = path[1:]
  112.     comps = path.split('/')
  113.     i = 0
  114.     while i < len(comps):
  115.         if comps[i] == '.':
  116.             del comps[i]
  117.             continue
  118.         if comps[i] == '..' and i > 0 and comps[i - 1] not in ('', '..'):
  119.             del comps[i - 1:i + 1]
  120.             i = i - 1
  121.             continue
  122.         if comps[i] == '' and i > 0 and comps[i - 1] != '':
  123.             del comps[i]
  124.             continue
  125.         i = i + 1
  126.     if not prefix and not comps:
  127.         comps.append('.')
  128.     return prefix + '/'.join(comps)
  129.  
  130.  
  131. def abspath(path):
  132.     if not isabs(path):
  133.         if isinstance(path, unicode):
  134.             cwd = os.getcwdu()
  135.         else:
  136.             cwd = os.getcwd()
  137.         path = join(cwd, path)
  138.     return normpath(path)
  139.  
  140. realpath = abspath
  141. supports_unicode_filenames = False
  142.