comparison mercurial/util.py @ 4516:96d8a56d4ef9

Removed trailing whitespace and tabs from python files
author Thomas Arendsen Hein <thomas@intevation.de>
date Wed, 06 Jun 2007 20:22:52 +0200
parents 0026ccc2bf23
children 36abb07c79d4
comparison
equal deleted inserted replaced
4515:86a66cce9566 4516:96d8a56d4ef9
821 return self.fp.write(s) 821 return self.fp.write(s)
822 except IOError, inst: 822 except IOError, inst:
823 if inst.errno != 0: raise 823 if inst.errno != 0: raise
824 self.close() 824 self.close()
825 raise IOError(errno.EPIPE, 'Broken pipe') 825 raise IOError(errno.EPIPE, 'Broken pipe')
826 826
827 def flush(self): 827 def flush(self):
828 try: 828 try:
829 return self.fp.flush() 829 return self.fp.flush()
830 except IOError, inst: 830 except IOError, inst:
831 if inst.errno != errno.EINVAL: raise 831 if inst.errno != errno.EINVAL: raise
910 910
911 # if you change this stub into a real check, please try to implement the 911 # if you change this stub into a real check, please try to implement the
912 # username and groupname functions above, too. 912 # username and groupname functions above, too.
913 def isowner(fp, st=None): 913 def isowner(fp, st=None):
914 return True 914 return True
915 915
916 def find_in_path(name, path, default=None): 916 def find_in_path(name, path, default=None):
917 '''find name in search path. path can be string (will be split 917 '''find name in search path. path can be string (will be split
918 with os.pathsep), or iterable thing that returns strings. if name 918 with os.pathsep), or iterable thing that returns strings. if name
919 found, return path to name. else return default. name is looked up 919 found, return path to name. else return default. name is looked up
920 using cmd.exe rules, using PATHEXT.''' 920 using cmd.exe rules, using PATHEXT.'''
921 if isinstance(path, str): 921 if isinstance(path, str):
922 path = path.split(os.pathsep) 922 path = path.split(os.pathsep)
923 923
924 pathext = os.environ.get('PATHEXT', '.COM;.EXE;.BAT;.CMD') 924 pathext = os.environ.get('PATHEXT', '.COM;.EXE;.BAT;.CMD')
925 pathext = pathext.lower().split(os.pathsep) 925 pathext = pathext.lower().split(os.pathsep)
926 isexec = os.path.splitext(name)[1].lower() in pathext 926 isexec = os.path.splitext(name)[1].lower() in pathext
927 927
928 for p in path: 928 for p in path:
929 p_name = os.path.join(p, name) 929 p_name = os.path.join(p, name)
930 930
931 if isexec and os.path.exists(p_name): 931 if isexec and os.path.exists(p_name):
932 return p_name 932 return p_name
933 933
934 for ext in pathext: 934 for ext in pathext:
935 p_name_ext = p_name + ext 935 p_name_ext = p_name + ext
936 if os.path.exists(p_name_ext): 936 if os.path.exists(p_name_ext):
937 return p_name_ext 937 return p_name_ext
938 return default 938 return default
1072 The return value of a util.fstat(f) may be passed as the st argument. 1072 The return value of a util.fstat(f) may be passed as the st argument.
1073 """ 1073 """
1074 if st is None: 1074 if st is None:
1075 st = fstat(fp) 1075 st = fstat(fp)
1076 return st.st_uid == os.getuid() 1076 return st.st_uid == os.getuid()
1077 1077
1078 def find_in_path(name, path, default=None): 1078 def find_in_path(name, path, default=None):
1079 '''find name in search path. path can be string (will be split 1079 '''find name in search path. path can be string (will be split
1080 with os.pathsep), or iterable thing that returns strings. if name 1080 with os.pathsep), or iterable thing that returns strings. if name
1081 found, return path to name. else return default.''' 1081 found, return path to name. else return default.'''
1082 if isinstance(path, str): 1082 if isinstance(path, str):