equal
deleted
inserted
replaced
28 pycompat, |
28 pycompat, |
29 ) |
29 ) |
30 |
30 |
31 osutil = policy.importmod(r'osutil') |
31 osutil = policy.importmod(r'osutil') |
32 |
32 |
33 posixfile = open |
|
34 normpath = os.path.normpath |
33 normpath = os.path.normpath |
35 samestat = os.path.samestat |
34 samestat = os.path.samestat |
36 try: |
35 try: |
37 oslink = os.link |
36 oslink = os.link |
38 except AttributeError: |
37 except AttributeError: |
49 removedirs = os.removedirs |
48 removedirs = os.removedirs |
50 expandglobs = False |
49 expandglobs = False |
51 |
50 |
52 umask = os.umask(0) |
51 umask = os.umask(0) |
53 os.umask(umask) |
52 os.umask(umask) |
|
53 |
|
54 if not pycompat.ispy3: |
|
55 def posixfile(name, mode=r'r', buffering=-1): |
|
56 fp = open(name, mode=mode, buffering=buffering) |
|
57 # The position when opening in append mode is implementation defined, so |
|
58 # make it consistent by always seeking to the end. |
|
59 if r'a' in mode: |
|
60 fp.seek(0, os.SEEK_END) |
|
61 return fp |
|
62 else: |
|
63 # The underlying file object seeks as required in Python 3: |
|
64 # https://github.com/python/cpython/blob/v3.7.3/Modules/_io/fileio.c#L474 |
|
65 posixfile = open |
54 |
66 |
55 def split(p): |
67 def split(p): |
56 '''Same as posixpath.split, but faster |
68 '''Same as posixpath.split, but faster |
57 |
69 |
58 >>> import posixpath |
70 >>> import posixpath |