equal
deleted
inserted
replaced
25 import posix as platform |
25 import posix as platform |
26 |
26 |
27 cachestat = platform.cachestat |
27 cachestat = platform.cachestat |
28 checkexec = platform.checkexec |
28 checkexec = platform.checkexec |
29 checklink = platform.checklink |
29 checklink = platform.checklink |
|
30 copymode = platform.copymode |
30 executablepath = platform.executablepath |
31 executablepath = platform.executablepath |
31 expandglobs = platform.expandglobs |
32 expandglobs = platform.expandglobs |
32 explainexit = platform.explainexit |
33 explainexit = platform.explainexit |
33 findexe = platform.findexe |
34 findexe = platform.findexe |
34 gethgcmd = platform.gethgcmd |
35 gethgcmd = platform.gethgcmd |
699 # pure build; use a safe default |
700 # pure build; use a safe default |
700 return True |
701 return True |
701 else: |
702 else: |
702 return os.name == "nt" or os.environ.get("DISPLAY") |
703 return os.name == "nt" or os.environ.get("DISPLAY") |
703 |
704 |
704 def copymode(src, dst, mode=None): |
|
705 '''Copy the file mode from the file at path src to dst. |
|
706 If src doesn't exist, we're using mode instead. If mode is None, we're |
|
707 using umask.''' |
|
708 try: |
|
709 st_mode = os.lstat(src).st_mode & 0777 |
|
710 except OSError, inst: |
|
711 if inst.errno != errno.ENOENT: |
|
712 raise |
|
713 st_mode = mode |
|
714 if st_mode is None: |
|
715 st_mode = ~umask |
|
716 st_mode &= 0666 |
|
717 os.chmod(dst, st_mode) |
|
718 |
|
719 def mktempcopy(name, emptyok=False, createmode=None): |
705 def mktempcopy(name, emptyok=False, createmode=None): |
720 """Create a temporary file with the same contents from name |
706 """Create a temporary file with the same contents from name |
721 |
707 |
722 The permission bits are copied from the original file. |
708 The permission bits are copied from the original file. |
723 |
709 |