From 4e04edb747e21397499c6d770992d6e53f226c5b Mon Sep 17 00:00:00 2001 From: 0x5c Date: Fri, 15 Jul 2022 01:32:33 -0400 Subject: [PATCH] mc: cleanup, adopt. --- srcpkgs/mc-python | 1 + srcpkgs/mc/patches/extfs-python3.patch | 81 ++++++++++++++++++++++++++ srcpkgs/mc/template | 17 ++++-- 3 files changed, 95 insertions(+), 4 deletions(-) create mode 120000 srcpkgs/mc-python create mode 100644 srcpkgs/mc/patches/extfs-python3.patch diff --git a/srcpkgs/mc-python b/srcpkgs/mc-python new file mode 120000 index 000000000000..60cdbcff7b70 --- /dev/null +++ b/srcpkgs/mc-python @@ -0,0 +1 @@ +mc \ No newline at end of file diff --git a/srcpkgs/mc/patches/extfs-python3.patch b/srcpkgs/mc/patches/extfs-python3.patch new file mode 100644 index 000000000000..c2a61807f87c --- /dev/null +++ b/srcpkgs/mc/patches/extfs-python3.patch @@ -0,0 +1,81 @@ +Taken from https://src.fedoraproject.org/rpms/mc/blob/rawhide/f/mc-python3.patch +Also see https://github.com/MidnightCommander/mc/pull/149 + + +-- + +--- a/src/vfs/extfs/helpers/uc1541 ++++ b/src/vfs/extfs/helpers/uc1541 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + """ + UC1541 Virtual filesystem + +--- a/src/vfs/extfs/helpers/s3+.in ++++ b/src/vfs/extfs/helpers/s3+.in +@@ -1,4 +1,4 @@ +-#! @PYTHON@ ++#! /usr/bin/env python3 + # -*- coding: utf-8 -*- + + # +@@ -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'(.*?)', 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') diff --git a/srcpkgs/mc/template b/srcpkgs/mc/template index 1c293a9c6a26..5f5019b6c83b 100644 --- a/srcpkgs/mc/template +++ b/srcpkgs/mc/template @@ -1,20 +1,18 @@ # Template file for 'mc' pkgname=mc version=4.8.28 -revision=1 +revision=2 build_style=gnu-configure configure_args="--with-screen=slang --without-x" hostmakedepends="perl pkg-config" makedepends="e2fsprogs-devel gpm-devel libglib-devel libssh2-devel slang-devel" short_desc="User-friendly file manager and visual shell" -maintainer="Orphaned " +maintainer="0x5c " license="GPL-3.0-or-later" homepage="https://midnight-commander.org/" changelog="https://midnight-commander.org/wiki/NEWS-${version}" distfiles="https://www.midnight-commander.org/downloads/mc-${version}.tar.xz" -#distfiles="http://fossies.org/linux/misc/mc-${version}.tar.gz" checksum=e994d9be9a7172e9ac4a4ad62107921f6aa312e668b056dfe5b8bcebbaf53803 -python_version=2 conf_files=" /etc/mc/filehighlight.ini @@ -25,3 +23,14 @@ conf_files=" /etc/mc/mc.menu /etc/mc/mcedit.menu /etc/mc/sfs.ini" + +mc-python_package() { + description += "- Python-based backend scripts" + depends="${sourcepkg}-${version}_${revision} python3 python3-boto" + python_version=3 + + pkg_install() { + vmove usr/libexec/mc/extfs.d/uc1541 + vmove usr/libexec/mc/extfs.d/s3+ + } +}