Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] [RFC] mc: cleanup, python3, adopt.
@ 2022-07-15  5:57 0x5c
  2022-07-17  6:26 ` 0x5c
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: 0x5c @ 2022-07-15  5:57 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1008 bytes --]

There is a new pull request by 0x5c against master on the void-packages repository

https://github.com/0x5c/void-packages mc-cleanup
https://github.com/void-linux/void-packages/pull/38079

[RFC] mc: cleanup, python3, adopt.
This PR splits off python-dependent backends into a subpackage. This is the approach used in other distros.
However, this only takes care of having python, it does not take into account more programs that may be needed (like the uc1451 backend needing the `vice` package). Most backends are just thin translation layers over an external tool, and some need perl. None of those dependencies are not marked as such in the package, nor are they in other distros. What would be the best way to deal with that?

#### Testing the changes
- I tested the changes in this PR: **YES**
    It is impossible to test the s3 backend without an AWS S3 account, but the patch is used in other distros.


A patch file from https://github.com/void-linux/void-packages/pull/38079.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-mc-cleanup-38079.patch --]
[-- Type: text/x-diff, Size: 4464 bytes --]

From 4e04edb747e21397499c6d770992d6e53f226c5b Mon Sep 17 00:00:00 2001
From: 0x5c <dev@0x5c.io>
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'<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')
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 <orphan@voidlinux.org>"
+maintainer="0x5c <dev@0x5c.io>"
 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+
+	}
+}

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-10-10  1:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-15  5:57 [PR PATCH] [RFC] mc: cleanup, python3, adopt 0x5c
2022-07-17  6:26 ` 0x5c
2022-07-17  7:28 ` 0x5c
2022-07-17  9:02 ` 0x5c
2022-10-16  2:14 ` github-actions
2022-10-31  2:15 ` [PR PATCH] [Closed]: " github-actions
2023-10-10  1:42 ` [PR PATCH] [Updated] " 0x5c
2023-10-10  1:45 ` 0x5c
2023-10-10  1:49 ` mc: update to 4.8.29, cleanup, adopt 0x5c
2023-10-10  1:51 ` [PR PATCH] [Merged]: " classabbyamp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).