Date: Monday, March 16, 2020 @ 21:32:28
  Author: bgyorgy
Revision: 599874

upgpkg: mc 4.8.24-2: Port s3 support to python3 (patch taken from Fedora)

Added:
  mc/trunk/mc-python3.patch
Modified:
  mc/trunk/PKGBUILD

------------------+
 PKGBUILD         |   15 ++++++-----
 mc-python3.patch |   70 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+), 7 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2020-03-16 21:17:07 UTC (rev 599873)
+++ PKGBUILD    2020-03-16 21:32:28 UTC (rev 599874)
@@ -4,7 +4,7 @@
 
 pkgname=mc
 pkgver=4.8.24
-pkgrel=1
+pkgrel=2
 pkgdesc="A file manager that emulates Norton Commander"
 arch=('x86_64')
 url="https://midnight-commander.org/";
@@ -20,8 +20,8 @@
             'mtools: a+ extfs'
             'p7zip: support for 7zip archives'
             'perl: needed by several extfs scripts'
-            'python2-boto: s3+ extfs'
-            'python2-pytz: s3+ extfs'
+            'python-boto: s3+ extfs'
+            'python-pytz: s3+ extfs'
             'samba: VFS support'
             'unace: uace extfs'
             'unarj: uarj extfs'
@@ -36,18 +36,19 @@
         'etc/mc/sfs.ini')
 options=('!emptydirs')
 source=("http://ftp.midnight-commander.org/${pkgname}-${pkgver}.tar.xz";
-        "mc-mksh-subshell-v2.patch")
+        "mc-mksh-subshell-v2.patch"
+        "mc-python3.patch")
 sha256sums=('859f1cc070450bf6eb4d319ffcb6a5ac29deb0ac0d81559fb2e71242b1176d46'
-            '5147afa3f9dfc00d8b7b36bbb144bcdb78d86301a0f8196686262a9eee41fb96')
+            '5147afa3f9dfc00d8b7b36bbb144bcdb78d86301a0f8196686262a9eee41fb96'
+            '10ab8b8c03770f8fe51f0bdbf0d66a44313bf2eed687cf769397909c07d8e8d5')
 
 prepare() {
   cd ${pkgname}-${pkgver}
   patch -p1 < "$srcdir"/mc-mksh-subshell-v2.patch
+  patch -p1 < "$srcdir"/mc-python3.patch
 }
 
 build() {
-  export PYTHON=/usr/bin/python2
-
   cd ${pkgname}-${pkgver}
   ./configure \
       --prefix=/usr \

Added: mc-python3.patch
===================================================================
--- mc-python3.patch                            (rev 0)
+++ mc-python3.patch    2020-03-16 21:32:28 UTC (rev 599874)
@@ -0,0 +1,70 @@
+diff -up mc-4.8.24/src/vfs/extfs/helpers/uc1541.python3 
mc-4.8.24/src/vfs/extfs/helpers/uc1541
+--- mc-4.8.24/src/vfs/extfs/helpers/uc1541.python3     2020-01-20 
14:40:30.637996501 +0100
++++ mc-4.8.24/src/vfs/extfs/helpers/uc1541     2020-01-20 14:37:55.253442507 
+0100
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ """
+ UC1541 Virtual filesystem
+ 
+--- a/src/vfs/extfs/helpers/s3+.in     (original)
++++ b/src/vfs/extfs/helpers/s3+.in     (refactored)
+@@ -153,16 +153,16 @@
+       Propagates exception safely.
+       """
+       from threading import Thread
+-      import Queue
++      import queue
+ 
+       items = list(iterable)
+       nitems = len(items)
+       if nitems < 2:
+-              return map(fun, items)
++              return list(map(fun, items))
+ 
+       # Create and fill input queue
+-      input = Queue.Queue()
+-      output = Queue.Queue()
++      input = queue.Queue()
++      output = queue.Queue()
+ 
+       for i,item in enumerate(items):
+               input.put( (i,item) )
+@@ -181,7 +181,7 @@
+                                               output.put( (i,result) )
+                                       except:
+                                               output.put( 
(None,sys.exc_info()) )
+-                              except Queue.Empty:
++                              except queue.Empty:
+                                       return
+ 
+       # Start threads
+@@ -196,8 +196,8 @@
+               try:
+                       i,res = output.get()
+                       if i == None:
+-                              raise res[0],res[1],res[2]
+-              except Queue.Empty:
++                              raise res[0](res[1]).with_traceback(res[2])
++              except queue.Empty:
+                       break
+               ret.append(res)
+ 
+@@ -241,7 +241,7 @@
+               b = s3.get_bucket(name, validate=False)
+               b.get_location() # just to raise an exception on error
+               return b
+-      except boto.exception.S3ResponseError, e:
++      except boto.exception.S3ResponseError as e:
+               # Seems this is the only proper way to switch to the bucket's 
region.
+               # Requesting of the default region for "?location" does not 
work unfortunately.
+               m = re.search(r'<Region>(.*?)</Region>', e.body)
+@@ -340,7 +340,7 @@
+       expr = 
re.compile(r'^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})\.\d{3}Z$')
+       def convDate(awsdatetime):
+               m = expr.match(awsdatetime)
+-              ye,mo,da,ho,mi,se = map(int,m.groups())
++              ye,mo,da,ho,mi,se = list(map(int,m.groups()))
+ 
+               dt = datetime.datetime(ye,mo,da,ho,mi,se, tzinfo=pytz.utc)
+               return dt.astimezone(tz).strftime('%m-%d-%Y %H:%M')

Reply via email to