Ticket #4324: mc-4.8.25-python3.patch
File mc-4.8.25-python3.patch, 2.1 KB (added by asy, 3 years ago) |
---|
-
mc-4.8.24/src/vfs/extfs/helpers/uc1541
diff -up mc-4.8.24/src/vfs/extfs/helpers/uc1541.python3 mc-4.8.24/src/vfs/extfs/helpers/uc1541
old new 1 #!/usr/bin/env python 1 #!/usr/bin/env python3 2 2 """ 3 3 UC1541 Virtual filesystem 4 4 -
src/vfs/extfs/helpers/s3+.in
a b 153 153 Propagates exception safely. 154 154 """ 155 155 from threading import Thread 156 import Queue156 import queue 157 157 158 158 items = list(iterable) 159 159 nitems = len(items) 160 160 if nitems < 2: 161 return map(fun, items)161 return list(map(fun, items)) 162 162 163 163 # Create and fill input queue 164 input = Queue.Queue()165 output = Queue.Queue()164 input = queue.Queue() 165 output = queue.Queue() 166 166 167 167 for i,item in enumerate(items): 168 168 input.put( (i,item) ) … … 181 181 output.put( (i,result) ) 182 182 except: 183 183 output.put( (None,sys.exc_info()) ) 184 except Queue.Empty:184 except queue.Empty: 185 185 return 186 186 187 187 # Start threads … … 196 196 try: 197 197 i,res = output.get() 198 198 if i == None: 199 raise res[0] ,res[1],res[2]200 except Queue.Empty:199 raise res[0](res[1]).with_traceback(res[2]) 200 except queue.Empty: 201 201 break 202 202 ret.append(res) 203 203 … … 241 241 b = s3.get_bucket(name, validate=False) 242 242 b.get_location() # just to raise an exception on error 243 243 return b 244 except boto.exception.S3ResponseError ,e:244 except boto.exception.S3ResponseError as e: 245 245 # Seems this is the only proper way to switch to the bucket's region. 246 246 # Requesting of the default region for "?location" does not work unfortunately. 247 247 m = re.search(r'<Region>(.*?)</Region>', e.body) … … 340 340 expr = re.compile(r'^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})\.\d{3}Z$') 341 341 def convDate(awsdatetime): 342 342 m = expr.match(awsdatetime) 343 ye,mo,da,ho,mi,se = map(int,m.groups())343 ye,mo,da,ho,mi,se = list(map(int,m.groups())) 344 344 345 345 dt = datetime.datetime(ye,mo,da,ho,mi,se, tzinfo=pytz.utc) 346 346 return dt.astimezone(tz).strftime('%m-%d-%Y %H:%M')