On Tue, 29 Dec 2020 14:05:48 +0000
Stuart Henderson wrote:
> On 2020/12/29 14:46, Björn Ketelaars wrote:
> > On Tue 29/12/2020 11:27, Charlene Wendling wrote:
> > > Hi,
> > >
> > > Here is an update for lfm to version 3.1. It has been rewritten
> > > almost from scratch, here are the most important changes (see
> > > [0]):
> > >
> > > * move from python 2 to python 3
> > > * pyview has been removed in favour of less(1)
> > > * many backward incompatible changes, notably ~/.lfmrc has been
> > > deprecated in favour of ~/.config/lfmrc/...
> > >
> > > Port-wise, despite the size of the diff, there is not much to say.
> > > Nonetheless, data files were not installed where they should.
> > >
> > > As such, i've brought back the 2.3 behaviour and chose to install
> > > everything as data_files, instead of using a post-install hook. We
> > > would have needed to patch setup.py anyway.
> > >
> > > I met no issues while testing, but given the number of features, i
> > > indeed did not test all of them.
> > >
> > > I'm not used to deal with python stuff, so feedback is very
> > > welcome :)
> > >
> > > Charlène.
Thanks for the feedback.
> > Builds and packages ok, however errors out upon starting:
> >
> > $ lfm
> > ERROR: Cannot copy default theme or keys file to user configuration
> > folder /home/bket/.config/lfm [Errno 2] No such file or directory:
> > '/usr/local/lib/python3.8/site-packages/lfm/etc/lfm-default.theme'
> > Quitting
> >
> > I'm guessing that
> > '/usr/local/lib/python3.8/site-packages/lfm/etc/lfm-default.theme'
> > should read '/usr/local/share/examples/lfm/lfm-default.theme'.
I mistakenly thought there were not used, but they are when no
configuration file is present. Once lfm has been run, these two files
are not used since they're dumped to $HOME/.config/lfm.
They are not shipped anymore in my diff, lfm provides
'--restore-{keys,theme,andmore}' flags anyway.
> .. or /etc/lfm/lfm-default.theme (installed from examples via @sample)
>
I should have not removed that paragraph in my first mail :) See
$WRKSRC/lfm/common.py:17. There is no configuration file hierarchy,
only $HOME/.config/lfm/ is used, as such lfm does not read its
configuration from /etc, hence no @sample seems needed.
It appears that lfm also wants docs so the help system works (press 'h'
in the main window). I've added a new patch to do so without
duplicating them; Debian does this as well, but differently because
they provide gzip'd manpages. In any case the docs are displayed
in raw restructured text format.
Testing the runtime in a clean chroot showed that error message:
ModuleNotFoundError: No module named 'pkg_resources'
So it needs MODPY_SETUPTOOLS to be defined; yet setup.py failed with:
error: option --single-version-externally-managed not recognized
I made setup.py use setuptool's install instead of distutils'
one, and sent a mail to the author about that -- hopefully kmos@
has well documented the issue in another port commit :)
Charlène.
Index: Makefile
===================================================================
RCS file: /cvs/ports/misc/lfm/Makefile,v
retrieving revision 1.8
diff -u -p -u -p -r1.8 Makefile
--- Makefile 24 Mar 2020 15:12:39 -0000 1.8
+++ Makefile 29 Dec 2020 20:39:28 -0000
@@ -2,9 +2,8 @@
COMMENT = powerful curses interface python file manager
-MODPY_EGG_VERSION = 2.3
+MODPY_EGG_VERSION = 3.1
DISTNAME = lfm-${MODPY_EGG_VERSION}
-REVISION= 2
CATEGORIES = misc
@@ -13,14 +12,20 @@ HOMEPAGE = https://inigo.katxi.org/deve
# GPLv3+
PERMIT_PACKAGE = Yes
+MODULES = lang/python
+
MODPY_PI = Yes
+MODPY_VERSION = ${MODPY_DEFAULT_VERSION_3}
-MODULES = lang/python
+# Actually required at runtime (pkg_resources), also see
+# patches/patch-setup_py comment
+MODPY_SETUPTOOLS = Yes
NO_TEST = Yes
-post-install:
- ${INSTALL_MAN} ${WRKSRC}/lfm.1 ${PREFIX}/man/man1
- ${INSTALL_MAN} ${WRKSRC}/pyview.1 ${PREFIX}/man/man1
+# fix hardcoded paths
+pre-build:
+ sed -i 's,/usr,${LOCALBASE},g' ${WRKSRC}/lfm.1
+ ${SUBST_CMD} ${WRKSRC}/lfm/actions.py
.include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/misc/lfm/distinfo,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 distinfo
--- distinfo 18 Jan 2015 03:14:31 -0000 1.2
+++ distinfo 29 Dec 2020 20:39:28 -0000
@@ -1,2 +1,2 @@
-SHA256 (lfm-2.3.tar.gz) = 6N8YjBfU1nbPQcyun2v4KqDF/zlC1arZhZkK0URslQQ=
-SIZE (lfm-2.3.tar.gz) = 119120
+SHA256 (lfm-3.1.tar.gz) = L3MaJpQNsWj5yIMM4YbYdplcSFd1coiAUva84Dd6v8o=
+SIZE (lfm-3.1.tar.gz) = 88876
Index: patches/patch-lfm___init___py
===================================================================
RCS file: patches/patch-lfm___init___py
diff -N patches/patch-lfm___init___py
--- patches/patch-lfm___init___py 17 Jul 2011 20:23:46 -0000 1.1.1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-$OpenBSD: patch-lfm___init___py,v 1.1.1.1 2011/07/17 20:23:46 sthen Exp $
-
-Change default .rar handler
-
---- lfm/__init__.py.orig Thu Jul 14 11:45:30 2011
-+++ lfm/__init__.py Thu Jul 14 11:46:01 2011
-@@ -46,7 +46,7 @@ sysprogs = { 'tar': 'tar',
- 'gzip': 'gzip',
- 'zip': 'zip',
- 'unzip': 'unzip',
-- 'rar': 'rar',
-+ 'rar': 'unrar',
- '7z': '7z',
- 'xz': 'xz',
- 'grep': 'grep',
Index: patches/patch-lfm_actions_py
===================================================================
RCS file: patches/patch-lfm_actions_py
diff -N patches/patch-lfm_actions_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-lfm_actions_py 29 Dec 2020 20:39:28 -0000
@@ -0,0 +1,27 @@
+$OpenBSD$
+
+Allow reading lfm documentation in lfm while making the document available in
+${LOCALBASE}/share/doc/lfm
+
+Index: lfm/actions.py
+--- lfm/actions.py.orig
++++ lfm/actions.py
+@@ -1111,11 +1111,13 @@ def help_menu():
+ else:
+ docfile = {'r': 'README', 'n': 'NEWS', 't': 'TODO', 'l': 'COPYING'}.get(ret[0])
+ try:
+- filename = pkg_resources.resource_filename('lfm', 'doc/' + docfile)
+- utils.run_on_current_file(app.cfg.programs['pager'], filename)
+- except NotImplementedError:
+- buf = str(pkg_resources.resource_string('lfm', 'doc/' + docfile), 'UTF-8')
+- InternalView(docfile, [(l, 'view_white_on_black') for l in buf.splitlines()], center=False).run()
++ filename = '${LOCALBASE}/share/doc/lfm/' + docfile
++ with open(filename) as f:
++ buf = f.readlines()
++ f.close()
++ InternalView(docfile, [(l, 'view_white_on_black') for l in buf], center=False).run()
++ except Exception as e:
++ DialogError('Cannot read the doc!\n{}'.format(str(e)))
+ return refresh()
+ else:
+ return RetCode.nothing, None
Index: patches/patch-lfm_common_py
===================================================================
RCS file: patches/patch-lfm_common_py
diff -N patches/patch-lfm_common_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-lfm_common_py 29 Dec 2020 20:39:28 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+Change default handler for rar files
+
+Index: lfm/common.py
+--- lfm/common.py.orig
++++ lfm/common.py
+@@ -37,7 +37,7 @@ SYSPROGS = {'tar': 'tar',
+ 'gzip': 'gzip',
+ 'zip': 'zip',
+ 'unzip': 'unzip',
+- 'rar': 'rar',
++ 'rar': 'unrar',
+ '7z': '7z',
+ 'xz': 'xz',
+ 'lzip': 'lzip',
Index: patches/patch-lfm_compress_py
===================================================================
RCS file: /cvs/ports/misc/lfm/patches/patch-lfm_compress_py,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 patch-lfm_compress_py
--- patches/patch-lfm_compress_py 17 Jul 2011 20:23:46 -0000 1.1.1.1
+++ patches/patch-lfm_compress_py 29 Dec 2020 20:39:28 -0000
@@ -2,14 +2,42 @@ $OpenBSD: patch-lfm_compress_py,v 1.1.1.
Incompatible GNU tar option
---- lfm/compress.py.orig Thu Jul 14 12:19:36 2011
-+++ lfm/compress.py Thu Jul 14 12:19:48 2011
-@@ -111,7 +111,7 @@ class PackagerTGZ(PackagerBase):
- exts = ('.tar.gz', '.tgz', '.tar.Z')
+Index: lfm/compress.py
+--- lfm/compress.py.orig
++++ lfm/compress.py
+@@ -108,7 +108,7 @@ class PackagerTGZ(PackagerBase):
need_tar = True
- uncompress_prog = compress_prog = sysprogs['gzip']
-- uncompress_cmd = uncompress_prog + ' -d \"%s\" -c | ' + sysprogs['tar'] + ' xfi -'
-+ uncompress_cmd = uncompress_prog + ' -d \"%s\" -c | ' + sysprogs['tar'] + ' xf -'
- compress_cmd = sysprogs['tar'] + ' cf - \"%s\" | ' + compress_prog + ' > \"%s\"'
- compressXXX_cmd = sysprogs['tar'] + ' cf - %s | ' + compress_prog + ' > \"%s\"'
+ can_vfs = True
+ uncompress_prog = compress_prog = SYSPROGS['gzip']
+- uncompress_cmd = uncompress_prog + ' -d \"%s\" -c | ' + SYSPROGS['tar'] + ' xfi -'
++ uncompress_cmd = uncompress_prog + ' -d \"%s\" -c | ' + SYSPROGS['tar'] + ' xf -'
+ compress_cmd = SYSPROGS['tar'] + ' cf - \"%s\" | ' + compress_prog + ' > \"%s\"'
+ compress2_cmd = SYSPROGS['tar'] + ' cf - %s | ' + compress_prog + ' > \"%s\"'
+
+@@ -130,7 +130,7 @@ class PackagerTXZ(PackagerBase):
+ need_tar = True
+ can_vfs = True
+ uncompress_prog = compress_prog = SYSPROGS['xz']
+- uncompress_cmd = uncompress_prog + ' -d \"%s\" -c | ' + SYSPROGS['tar'] + ' xfi -'
++ uncompress_cmd = uncompress_prog + ' -d \"%s\" -c | ' + SYSPROGS['tar'] + ' xf -'
+ compress_cmd = SYSPROGS['tar'] + ' cf - \"%s\" | ' + compress_prog + ' > \"%s\"'
+ compress2_cmd = SYSPROGS['tar'] + ' cf - %s | ' + compress_prog + ' > \"%s\"'
+
+@@ -152,7 +152,7 @@ class PackagerTLZ(PackagerBase):
+ need_tar = True
+ can_vfs = True
+ uncompress_prog = compress_prog = SYSPROGS['lzip']
+- uncompress_cmd = uncompress_prog + ' -d \"%s\" -c | ' + SYSPROGS['tar'] + ' xfi -'
++ uncompress_cmd = uncompress_prog + ' -d \"%s\" -c | ' + SYSPROGS['tar'] + ' xf -'
+ compress_cmd = SYSPROGS['tar'] + ' cf - \"%s\" | ' + compress_prog + ' > \"%s\"'
+ compress2_cmd = SYSPROGS['tar'] + ' cf - %s | ' + compress_prog + ' > \"%s\"'
+
+@@ -174,7 +174,7 @@ class PackagerTLZ4(PackagerBase):
+ need_tar = True
+ can_vfs = True
+ uncompress_prog = compress_prog = SYSPROGS['lz4']
+- uncompress_cmd = uncompress_prog + ' -q -d \"%s\" -c | ' + SYSPROGS['tar'] + ' xfi -'
++ uncompress_cmd = uncompress_prog + ' -q -d \"%s\" -c | ' + SYSPROGS['tar'] + ' xf -'
+ compress_cmd = SYSPROGS['tar'] + ' cf - \"%s\" | ' + compress_prog + ' -9 -q > \"%s\"'
+ compress2_cmd = SYSPROGS['tar'] + ' cf - %s | ' + compress_prog + ' -9 -q > \"%s\"'
Index: patches/patch-setup_py
===================================================================
RCS file: /cvs/ports/misc/lfm/patches/patch-setup_py,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 patch-setup_py
--- patches/patch-setup_py 17 Jul 2011 20:23:46 -0000 1.1.1.1
+++ patches/patch-setup_py 29 Dec 2020 20:39:28 -0000
@@ -1,15 +1,51 @@
$OpenBSD: patch-setup_py,v 1.1.1.1 2011/07/17 20:23:46 sthen Exp $
-Fix manpage path
+setuptools is required at runtime, but using MODPY_SETUPTOOLS=Yes broke the
+build because of --single-version-externally-managed that distutils can't
+deal with. It's needed to supercede distutils' install by setuptools' one.
---- setup.py.orig Thu Jul 14 11:45:34 2011
-+++ setup.py Thu Jul 14 11:45:45 2011
-@@ -57,7 +57,7 @@ setup(name = 'lfm',
- 'lfm/config', 'lfm/pyview'],
- scripts = ['lfm/lfm', 'lfm/pyview'],
- data_files = [('share/doc/lfm', DOC_FILES),
-- ('share/man/man1', MAN_FILES)]
-+ ('man/man1', MAN_FILES)]
- # **addargs
- )
+Install the manpage and docs according to our file hierarchy, otherwise:
+* the manpage was installed in /usr/share/man/man1
+* doc files were in sites-packages, now they're in ${LOCALBASE}/share/doc/lfm;
+ see also patch-lfm_actions_py
+* default config files are needed in sites-packages in case $HOME/.config/lfm
+is empty, and can be restored through a runtime option. There is no need for @sample
+entries in PLIST since lfm reads its configuration files in ~/.config/lfm only.
+
+Index: setup.py
+--- setup.py.orig
++++ setup.py
+@@ -12,6 +12,7 @@ Released under GNU Public License, read COPYING file f
+
+ import os
+ from distutils.core import setup
++from setuptools.command.install import install as install
+ from os.path import join
+ from sys import argv, exit, prefix, version_info
+@@ -52,9 +53,6 @@ if 'bdist_wheel' in argv:
+ import shutil
+ try:
+ try:
+- os.mkdir('lfm/doc')
+- for f in DOC_FILES:
+- shutil.copy2(f, 'lfm/doc')
+ os.symlink('../etc', 'lfm/etc')
+ except:
+ pass
+@@ -71,11 +69,12 @@ try:
+ license='GPL3+',
+ packages=['lfm'],
+ scripts=['lfm/lfm'],
+- data_files=[(join(prefix, 'share/man/man1'), MAN_FILES)],
+- package_data={'': CONFIG_FILES + [join('doc', f) for f in DOC_FILES]},
++ data_files=[(join(prefix, 'man/man1'), MAN_FILES),
++ (join(prefix, 'share/doc/lfm'), DOC_FILES),
++ ],
++ package_data={'': CONFIG_FILES},
+ )
+ finally:
+- shutil.rmtree('lfm/doc')
+ try:
+ os.unlink('lfm/etc')
+ except IsADirectoryError:
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/misc/lfm/pkg/PLIST,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 PLIST
--- pkg/PLIST 16 Sep 2011 22:08:32 -0000 1.2
+++ pkg/PLIST 29 Dec 2020 20:39:28 -0000
@@ -1,34 +1,40 @@
@comment $OpenBSD: PLIST,v 1.2 2011/09/16 22:08:32 sthen Exp $
bin/lfm
-bin/pyview
lib/python${MODPY_VERSION}/site-packages/lfm/
-lib/python${MODPY_VERSION}/site-packages/lfm-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info
+lib/python${MODPY_VERSION}/site-packages/lfm-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/
+lib/python${MODPY_VERSION}/site-packages/lfm-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/PKG-INFO
+lib/python${MODPY_VERSION}/site-packages/lfm-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/SOURCES.txt
+lib/python${MODPY_VERSION}/site-packages/lfm-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/dependency_links.txt
+lib/python${MODPY_VERSION}/site-packages/lfm-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/top_level.txt
lib/python${MODPY_VERSION}/site-packages/lfm/__init__.py
-lib/python${MODPY_VERSION}/site-packages/lfm/__init__.pyc
+${MODPY_COMMENT}lib/python${MODPY_VERSION}/site-packages/lfm/${MODPY_PYCACHE}/
+lib/python${MODPY_VERSION}/site-packages/lfm/${MODPY_PYCACHE}__init__.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/lfm/${MODPY_PYCACHE}actions.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/lfm/${MODPY_PYCACHE}common.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/lfm/${MODPY_PYCACHE}compress.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/lfm/${MODPY_PYCACHE}folders.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/lfm/${MODPY_PYCACHE}key_defs.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/lfm/${MODPY_PYCACHE}lfm.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/lfm/${MODPY_PYCACHE}preferences.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/lfm/${MODPY_PYCACHE}ui.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/lfm/${MODPY_PYCACHE}ui_widgets.${MODPY_PYC_MAGIC_TAG}pyc
+lib/python${MODPY_VERSION}/site-packages/lfm/${MODPY_PYCACHE}utils.${MODPY_PYC_MAGIC_TAG}pyc
lib/python${MODPY_VERSION}/site-packages/lfm/actions.py
-lib/python${MODPY_VERSION}/site-packages/lfm/actions.pyc
+lib/python${MODPY_VERSION}/site-packages/lfm/common.py
lib/python${MODPY_VERSION}/site-packages/lfm/compress.py
-lib/python${MODPY_VERSION}/site-packages/lfm/compress.pyc
-lib/python${MODPY_VERSION}/site-packages/lfm/config.py
-lib/python${MODPY_VERSION}/site-packages/lfm/config.pyc
-lib/python${MODPY_VERSION}/site-packages/lfm/files.py
-lib/python${MODPY_VERSION}/site-packages/lfm/files.pyc
+lib/python${MODPY_VERSION}/site-packages/lfm/etc/
+lib/python${MODPY_VERSION}/site-packages/lfm/etc/lfm-default.keys
+lib/python${MODPY_VERSION}/site-packages/lfm/etc/lfm-default.theme
+lib/python${MODPY_VERSION}/site-packages/lfm/folders.py
+lib/python${MODPY_VERSION}/site-packages/lfm/key_defs.py
lib/python${MODPY_VERSION}/site-packages/lfm/lfm.py
-lib/python${MODPY_VERSION}/site-packages/lfm/lfm.pyc
-lib/python${MODPY_VERSION}/site-packages/lfm/messages.py
-lib/python${MODPY_VERSION}/site-packages/lfm/messages.pyc
-lib/python${MODPY_VERSION}/site-packages/lfm/pyview.py
-lib/python${MODPY_VERSION}/site-packages/lfm/pyview.pyc
+lib/python${MODPY_VERSION}/site-packages/lfm/preferences.py
+lib/python${MODPY_VERSION}/site-packages/lfm/ui.py
+lib/python${MODPY_VERSION}/site-packages/lfm/ui_widgets.py
lib/python${MODPY_VERSION}/site-packages/lfm/utils.py
-lib/python${MODPY_VERSION}/site-packages/lfm/utils.pyc
-lib/python${MODPY_VERSION}/site-packages/lfm/vfs.py
-lib/python${MODPY_VERSION}/site-packages/lfm/vfs.pyc
@man man/man1/lfm.1
-@man man/man1/pyview.1
share/doc/lfm/
share/doc/lfm/COPYING
-share/doc/lfm/ChangeLog
share/doc/lfm/NEWS
share/doc/lfm/README
-share/doc/lfm/README.pyview
share/doc/lfm/TODO
No comments:
Post a Comment