python-ranger: new package
PATCH 1/1 python-ranger: new package
ranger is a console file manager with VI key bindings. It provides a minimalistic and nice curses interface with a view on the directory hierarchy. It ships with "rifle", a file launcher that is good at automatically finding out which program to use for what file type.
--- package/Config.in | 1 + package/python-ranger/0001-colorschemes-pyc.patch | 13 +++++++++++++ package/python-ranger/Config.in | 13 +++++++++++++ package/python-ranger/python-ranger.mk | 21 +++++++++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 package/python-ranger/0001-colorschemes-pyc.patch create mode 100644 package/python-ranger/Config.in create mode 100644 package/python-ranger/python-ranger.mk
package/Config.in +1 -0
@@ -659,6 +659,7 @@ menu "External python modules" source "package/python-pyxml/Config.in" source "package/python-pyyaml/Config.in" source "package/python-pyzmq/Config.in" + source "package/python-ranger/Config.in" source "package/python-requests/Config.in" source "package/python-rtslib-fb/Config.in" source "package/python-serial/Config.in"
package/python-ranger/0001-colorschemes-pyc.patch new file +13 -0
@@ -0,0 +1,13 @@ +Index: python-ranger-1.7.2/ranger/gui/colorscheme.py +=================================================================== +--- python-ranger-1.7.2.orig/ranger/gui/colorscheme.py ++++ python-ranger-1.7.2/ranger/gui/colorscheme.py +@@ -86,7 +86,7 @@ def _colorscheme_name_to_class(signal): + usecustom = not ranger.arg.clean + + def exists(colorscheme): +- return os.path.exists(colorscheme + '.py') ++ return os.path.exists(colorscheme + '.py') or os.path.exists(colorscheme + '.pyc') + + def is_scheme(x): + try:
package/python-ranger/Config.in new file +13 -0
@@ -0,0 +1,13 @@ +config BR2_PACKAGE_PYTHON_RANGER + bool "python-ranger" + depends on BR2_PACKAGE_PYTHON3_CURSES || BR2_PACKAGE_PYTHON_CURSES + help + ranger is a console file manager with VI key bindings. It provides a + minimalistic and nice curses interface with a view on the directory hierarchy. + It ships with "rifle", a file launcher that is good at automatically finding + out which program to use for what file type. + + http://ranger.nongnu.org + +comment "python-ranger needs the curses python or python3 library" + depends on !BR2_PACKAGE_PYTHON3_CURSES && !BR2_PACKAGE_PYTHON_CURSES
package/python-ranger/python-ranger.mk new file +21 -0
@@ -0,0 +1,21 @@ +################################################################################ +# +# python-ranger +# +################################################################################ + +PYTHON_RANGER_VERSION = 1.7.2 +PYTHON_RANGER_SITE = $(call github,hut,ranger,v$(PYTHON_RANGER_VERSION)) +PYTHON_RANGER_SETUP_TYPE = distutils +PYTHON_RANGER_LICENSE = GPLv3 + +define PYTHON_RANGER_DO_NOT_GENERATE_BYTECODE_AT_RUNTIME + $(SED) 's%/usr/bin/python -O%/usr/bin/python%g' $(@D)/scripts/ranger +endef + +ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY)$(BR2_PACKAGE_PYTHON_PYC_ONLY),y) +PYTHON_RANGER_POST_PATCH_HOOKS += PYTHON_RANGER_DO_NOT_GENERATE_BYTECODE_AT_RUNTIME +endif + +$(eval $(python-package)) +$(eval $(host-python-package))
Signature · 1 line
2.1.0
PATCH 1/1 python-ranger: new package
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thijs" == Thijs Vermeir <[email protected]> writes:
Hi,
Quoted 6 lines
ranger is a console file manager with VI key bindings. It provides a minimalistic and nice curses interface with a view on the directory hierarchy. It ships with "rifle", a file launcher that is good at automatically finding out which program to use for what file type.
Please add your signed-off-by tag to the patch (git commit -s), thanks.
package/python-ranger/0001-colorschemes-pyc.patch
Quoted 5 lines
package/python-ranger/0001-colorschemes-pyc.patch new file +0
-0
And a description + signed-off-by for the patch. Have you tried submitting it upstream? If so, was it accepted?
Quoted 20 lines
package/python-ranger/0001-colorschemes-pyc.patch new file +13
-0@@ -0,0 +1,13 @@ +Index: python-ranger-1.7.2/ranger/gui/colorscheme.py +=================================================================== +--- python-ranger-1.7.2.orig/ranger/gui/colorscheme.py ++++ python-ranger-1.7.2/ranger/gui/colorscheme.py +@@ -86,7 +86,7 @@ def _colorscheme_name_to_class(signal): + usecustom = not ranger.arg.clean + + def exists(colorscheme): +- return os.path.exists(colorscheme + '.py') ++ return os.path.exists(colorscheme + '.py') or os.path.exists(colorscheme + '.pyc') + + def is_scheme(x): + try:package/python-ranger/Config.in new file +0
-0
package/python-ranger/Config.in line 3
Quoted 3 lines
package/python-ranger/Config.in new file +3
-0@@ -0,0 +1,13 @@ +config BR2_PACKAGE_PYTHON_RANGER + bool "python-ranger" + depends on BR2_PACKAGE_PYTHON3_CURSES || BR2_PACKAGE_PYTHON_CURSES
We normally use select for library dependencies, so you can do
select BR2_PACKAGE_PYTHON_CURSES if BR2_PACKAGE_PYTHON select BR2_PACKAGE_PYTHON3_CURSES if BR2_PACKAGE_PYTHON3
package/python-ranger/Config.in line 13
Quoted 10 lines
package/python-ranger/Config.in new file +10
-0+ help + ranger is a console file manager with VI key bindings. It provides a + minimalistic and nice curses interface with a view on the directory hierarchy. + It ships with "rifle", a file launcher that is good at automatically finding + out which program to use for what file type. + + http://ranger.nongnu.org + +comment "python-ranger needs the curses python or python3 library" + depends on !BR2_PACKAGE_PYTHON3_CURSES && !BR2_PACKAGE_PYTHON_CURSES
And drop this comment.
Quoted 6 lines
package/python-ranger/python-ranger.mk new file +0
-0
package/python-ranger/python-ranger.mk line 10
Quoted 10 lines
package/python-ranger/python-ranger.mk new file +10
-0@@ -0,0 +1,21 @@ +################################################################################ +# +# python-ranger +# +################################################################################ + +PYTHON_RANGER_VERSION = 1.7.2 +PYTHON_RANGER_SITE = $(call github,hut,ranger,v$(PYTHON_RANGER_VERSION)) +PYTHON_RANGER_SETUP_TYPE = distutils +PYTHON_RANGER_LICENSE = GPLv3
Is there no license file in the tarball?
We recently started adding hashes for the packages on github as well. Please add a (locally calculated) sha256 in python-ranger.hash
package/python-ranger/python-ranger.mk line 14
Quoted 4 lines
package/python-ranger/python-ranger.mk new file +4
-0+ +define PYTHON_RANGER_DO_NOT_GENERATE_BYTECODE_AT_RUNTIME + $(SED) 's%/usr/bin/python -O%/usr/bin/python%g' $(@D)/scripts/ranger +endef
Please add a comment explaining why this is done.
package/python-ranger/python-ranger.mk line 21
Quoted 7 lines
package/python-ranger/python-ranger.mk new file +7
-0+ +ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY)$(BR2_PACKAGE_PYTHON_PYC_ONLY),y) +PYTHON_RANGER_POST_PATCH_HOOKS += PYTHON_RANGER_DO_NOT_GENERATE_BYTECODE_AT_RUNTIME +endif + +$(eval $(python-package)) +$(eval $(host-python-package))
Is there anything needing this on the host?
Signature · 1 line
Bye, Peter Korsgaard
PATCH v2 1/1 python-ranger: new package
ranger is a console file manager with VI key bindings. It provides a minimalistic and nice curses interface with a view on the directory hierarchy. It ships with "rifle", a file launcher that is good at automatically finding out which program to use for what file type.
---
Changes v1 -> v2:
- use upstream documented patch for detecting .pyc files
- signed-off patches
- select curses package depending on python version
- documented post patch hook
- remove host-python-package
- add sha256 hash
--- package/Config.in | 1 + ...lorscheme-check-for-compiled-python-files.patch | 31 ++++++++++++++++++++++ package/python-ranger/Config.in | 11 ++++++++ package/python-ranger/python-ranger.hash | 1 + package/python-ranger/python-ranger.mk | 25 +++++++++++++++++ 5 files changed, 69 insertions(+) create mode 100644 package/python-ranger/0001-colorscheme-check-for-compiled-python-files.patch create mode 100644 package/python-ranger/Config.in create mode 100644 package/python-ranger/python-ranger.hash create mode 100644 package/python-ranger/python-ranger.mk
package/Config.in +1 -0
@@ -659,6 +659,7 @@ menu "External python modules" source "package/python-pyxml/Config.in" source "package/python-pyyaml/Config.in" source "package/python-pyzmq/Config.in" + source "package/python-ranger/Config.in" source "package/python-requests/Config.in" source "package/python-rtslib-fb/Config.in" source "package/python-serial/Config.in"
package/python-ranger/0001-colorscheme-check-for-compiled-python-files.patch new file +31 -0
@@ -0,0 +1,31 @@ +From 654e3116825c4d12340613196279fb13a5662113 Mon Sep 17 00:00:00 2001 +From: Thijs Vermeir <[email protected]> +Date: Tue, 20 Oct 2015 18:13:36 +0200 +Subject: [PATCH] colorscheme: check for compiled python files + +Some systems only provide *.pyc files + +Patch accepted upstream: +https://github.com/hut/ranger/commit/d69f1ed3207c785d1a39ddd2992f6abb021b7540 + +Signed-off-by: Thijs Vermeir <[email protected]> +--- + ranger/gui/colorscheme.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ranger/gui/colorscheme.py b/ranger/gui/colorscheme.py +index d6afcac..d2b3b2d 100644 +--- a/ranger/gui/colorscheme.py ++++ b/ranger/gui/colorscheme.py +@@ -86,7 +86,7 @@ def _colorscheme_name_to_class(signal): + usecustom = not ranger.arg.clean + + def exists(colorscheme): +- return os.path.exists(colorscheme + '.py') ++ return os.path.exists(colorscheme + '.py') or os.path.exists(colorscheme + '.pyc') + + def is_scheme(x): + try: +-- +2.6.1 +
package/python-ranger/Config.in new file +11 -0
@@ -0,0 +1,11 @@ +config BR2_PACKAGE_PYTHON_RANGER + bool "python-ranger" + select BR2_PACKAGE_PYTHON_CURSES if BR2_PACKAGE_PYTHON + select BR2_PACKAGE_PYTHON3_CURSES if BR2_PACKAGE_PYTHON3 + help + ranger is a console file manager with VI key bindings. It provides a + minimalistic and nice curses interface with a view on the directory hierarchy. + It ships with "rifle", a file launcher that is good at automatically finding + out which program to use for what file type. + + http://ranger.nongnu.org
package/python-ranger/python-ranger.hash new file +1 -0
@@ -0,0 +1 @@ +sha256 80917c93396e46272b6de63816d925eb708291a9f7a559d49b24c571ea0eeeb3 python-ranger-1.7.2.tar.gz
package/python-ranger/python-ranger.mk new file +25 -0
@@ -0,0 +1,25 @@ +################################################################################ +# +# python-ranger +# +################################################################################ + +PYTHON_RANGER_VERSION = 1.7.2 +PYTHON_RANGER_SITE = $(call github,hut,ranger,v$(PYTHON_RANGER_VERSION)) +PYTHON_RANGER_SETUP_TYPE = distutils +PYTHON_RANGER_LICENSE = GPLv3 + +# The ranger script request python to be called with -O (optimize generated +# bytecode slightly; also PYTHONOPTIMIZE=x). This implicitly requires the python +# source files to be present. Therefore, the -O flag is removed when only the .pyc +# files are installed. + +define PYTHON_RANGER_DO_NOT_GENERATE_BYTECODE_AT_RUNTIME + $(SED) 's%/usr/bin/python -O%/usr/bin/python%g' $(@D)/scripts/ranger +endef + +ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY)$(BR2_PACKAGE_PYTHON_PYC_ONLY),y) +PYTHON_RANGER_POST_PATCH_HOOKS += PYTHON_RANGER_DO_NOT_GENERATE_BYTECODE_AT_RUNTIME +endif + +$(eval $(python-package))
Signature · 1 line
2.1.0
PATCH v3 1/1 python-ranger: new package
In reply to Peter Korsgaardranger is a console file manager with VI key bindings. It provides a minimalistic and nice curses interface with a view on the directory hierarchy. It ships with "rifle", a file launcher that is good at automatically finding out which program to use for what file type.
---
Changes v2 -> v3:
- add LICENSE_FILES
Changes v1 -> v2:
- use upstream documented patch for detecting .pyc files
- signed-off patches
- select curses package depending on python version
- documented post patch hook
- remove host-python-package
- add sha256 hash
--- package/Config.in | 1 + ...lorscheme-check-for-compiled-python-files.patch | 31 ++++++++++++++++++++++ package/python-ranger/Config.in | 11 ++++++++ package/python-ranger/python-ranger.hash | 1 + package/python-ranger/python-ranger.mk | 26 ++++++++++++++++++ 5 files changed, 70 insertions(+) create mode 100644 package/python-ranger/0001-colorscheme-check-for-compiled-python-files.patch create mode 100644 package/python-ranger/Config.in create mode 100644 package/python-ranger/python-ranger.hash create mode 100644 package/python-ranger/python-ranger.mk
package/Config.in +1 -0
@@ -659,6 +659,7 @@ menu "External python modules" source "package/python-pyxml/Config.in" source "package/python-pyyaml/Config.in" source "package/python-pyzmq/Config.in" + source "package/python-ranger/Config.in" source "package/python-requests/Config.in" source "package/python-rtslib-fb/Config.in" source "package/python-serial/Config.in"
package/python-ranger/0001-colorscheme-check-for-compiled-python-files.patch new file +31 -0
@@ -0,0 +1,31 @@ +From 654e3116825c4d12340613196279fb13a5662113 Mon Sep 17 00:00:00 2001 +From: Thijs Vermeir <[email protected]> +Date: Tue, 20 Oct 2015 18:13:36 +0200 +Subject: [PATCH] colorscheme: check for compiled python files + +Some systems only provide *.pyc files + +Patch accepted upstream: +https://github.com/hut/ranger/commit/d69f1ed3207c785d1a39ddd2992f6abb021b7540 + +Signed-off-by: Thijs Vermeir <[email protected]> +--- + ranger/gui/colorscheme.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ranger/gui/colorscheme.py b/ranger/gui/colorscheme.py +index d6afcac..d2b3b2d 100644 +--- a/ranger/gui/colorscheme.py ++++ b/ranger/gui/colorscheme.py +@@ -86,7 +86,7 @@ def _colorscheme_name_to_class(signal): + usecustom = not ranger.arg.clean + + def exists(colorscheme): +- return os.path.exists(colorscheme + '.py') ++ return os.path.exists(colorscheme + '.py') or os.path.exists(colorscheme + '.pyc') + + def is_scheme(x): + try: +-- +2.6.1 +
package/python-ranger/Config.in new file +11 -0
@@ -0,0 +1,11 @@ +config BR2_PACKAGE_PYTHON_RANGER + bool "python-ranger" + select BR2_PACKAGE_PYTHON_CURSES if BR2_PACKAGE_PYTHON + select BR2_PACKAGE_PYTHON3_CURSES if BR2_PACKAGE_PYTHON3 + help + ranger is a console file manager with VI key bindings. It provides a + minimalistic and nice curses interface with a view on the directory hierarchy. + It ships with "rifle", a file launcher that is good at automatically finding + out which program to use for what file type. + + http://ranger.nongnu.org
package/python-ranger/python-ranger.hash new file +1 -0
@@ -0,0 +1 @@ +sha256 80917c93396e46272b6de63816d925eb708291a9f7a559d49b24c571ea0eeeb3 python-ranger-1.7.2.tar.gz
package/python-ranger/python-ranger.mk new file +26 -0
@@ -0,0 +1,26 @@ +################################################################################ +# +# python-ranger +# +################################################################################ + +PYTHON_RANGER_VERSION = 1.7.2 +PYTHON_RANGER_SITE = $(call github,hut,ranger,v$(PYTHON_RANGER_VERSION)) +PYTHON_RANGER_SETUP_TYPE = distutils +PYTHON_RANGER_LICENSE = GPLv3 +PYTHON_RANGER_LICENSE_FILES = AUTHORS + +# The ranger script request python to be called with -O (optimize generated +# bytecode slightly; also PYTHONOPTIMIZE=x). This implicitly requires the python +# source files to be present. Therefore, the -O flag is removed when only the .pyc +# files are installed. + +define PYTHON_RANGER_DO_NOT_GENERATE_BYTECODE_AT_RUNTIME + $(SED) 's%/usr/bin/python -O%/usr/bin/python%g' $(@D)/scripts/ranger +endef + +ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY)$(BR2_PACKAGE_PYTHON_PYC_ONLY),y) +PYTHON_RANGER_POST_PATCH_HOOKS += PYTHON_RANGER_DO_NOT_GENERATE_BYTECODE_AT_RUNTIME +endif + +$(eval $(python-package))
Signature · 1 line
2.1.0
PATCH 1/1 python-ranger: new package
In reply to Thijs VermeirHello,
Quoted 6 lines · Thijs Vermeir
ranger is a console file manager with VI key bindings. It provides a minimalistic and nice curses interface with a view on the directory hierarchy. It ships with "rifle", a file launcher that is good at automatically finding out which program to use for what file type.
Thanks for your contribution! Others have already reviewed your patch in details, but I have one question (not really for you, but mainly for the other core Buildroot developers).
package/Config.in menu "External python modules" · line 665
Quoted 12 lines
package/Config.in +1
-0@@ -659,6 +659,7 @@ menu "External python modules" source "package/python-pyxml/Config.in" source "package/python-pyyaml/Config.in" source "package/python-pyzmq/Config.in" + source "package/python-ranger/Config.in" source "package/python-requests/Config.in" source "package/python-rtslib-fb/Config.in" source "package/python-serial/Config.in"
This menu is normally for "External python modules" (as its prompt says). However here, python-ranger is not really a python module, it's a regular application that ends up being implemented in Python (but it's kind of an implementation detail).
So I would rather see it visible in "System tools" or "Shell and utilities", and named just 'ranger' (which is the upstream name for the project.
Peter ?
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 1/1 python-ranger: new package
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Petazzoni <[email protected]> writes:
Hi,
Quoted 7 lines
Quoted 1 line
source "package/python-serial/Config.in"
This menu is normally for "External python modules" (as its prompt says). However here, python-ranger is not really a python module, it's a regular application that ends up being implemented in Python (but it's kind of an implementation detail).
Quoted 5 lines
So I would rather see it visible in "System tools" or "Shell and utilities", and named just 'ranger' (which is the upstream name for the project.
Peter ?
Indeed, I was thinking the same. Question is if we want to forcible select python / python3 (and if so, which one?) or if it should depend on them.
It should probably also be simply called ranger instead.
I personally think it should use select and default to python3 if python isn't enabled - E.G. something like:
config BR2_PACKAGE_RANGER
bool "ranger"
depends on BR2_USE_WCHAR # python
depends on BR2_USE_MMU # python
depends on BR2_TOOLCHAIN_HAS_THREADS # python depends on !BR2_STATIC_LIBS # python
select BR2_PACKAGE_PYTHON3 if !BR2_PACKAGE_PYTHON select BR2_PACKAGE_PYTHON_CURSES if BR2_PACKAGE_PYTHON select BR2_PACKAGE_PYTHON3_CURSES if BR2_PACKAGE_PYTHON3
(Untested, I don't know if kconfig gets confused here).
Signature · 2 lines
Venlig hilsen, Peter Korsgaard
PATCH 1/1 python-ranger: new package
Hello,
Quoted 15 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Petazzoni <[email protected]> writes:
Hi,
Quoted 10 lines
Quoted 1 line
source "package/python-serial/Config.in"
This menu is normally for "External python modules" (as its prompt says). However here, python-ranger is not really a python module, it's a regular application that ends up being implemented in Python (but it's kind of an implementation detail).
So I would rather see it visible in "System tools" or "Shell and utilities", and named just 'ranger' (which is the upstream name for the project.
Quoted 5 lines
Quoted 1 line
Peter ?
Indeed, I was thinking the same. Question is if we want to forcible select python / python3 (and if so, which one?) or if it should depend on them.
Good that we agree :)
Quoted 1 line
It should probably also be simply called ranger instead.
See what I wrote :-)
Quoted 9 lines
I personally think it should use select and default to python3 if python isn't enabled - E.G. something like:
config
BR2_PACKAGE_RANGER
bool "ranger"
depends onBR2_USE_WCHAR# python depends onBR2_USE_MMU# python depends onBR2_TOOLCHAIN_HAS_THREADS# python depends on !BR2_STATIC_LIBS # python
Change all those comments to "# python3"
Quoted 3 lines
select
BR2_PACKAGE_PYTHON3if !BR2_PACKAGE_PYTHON selectBR2_PACKAGE_PYTHON_CURSESifBR2_PACKAGE_PYTHONselectBR2_PACKAGE_PYTHON3_CURSESifBR2_PACKAGE_PYTHON3
But other than that, looks sane to me.
Or alternatively, if we don't want to hide to the user that this tool is going to bring Python into the build, we could:
config BR2_PACKAGE_RANGER
bool "ranger
depends on BR2_PACKAGE_PYTHON || BR2_PACKAGE_PYTHON3 select BR2_PACKAGE_PYTHON_CURSES if BR2_PACKAGE_PYTHON select BR2_PACKAGE_PYTHON3_CURSES if BR2_PACKAGE_PYTHON3
comment "ranger needs Python"
depends on !BR2_PACKAGE_PYTHON && !BR2_PACKAGE_PYTHON3
It also removes the need for propagating the toolchain dependencies of Python.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 1/1 python-ranger: new package
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Petazzoni <[email protected]> writes:
Hi,
Quoted 5 lines
Quoted 3 lines
Indeed, I was thinking the same. Question is if we want to forcible select python / python3 (and if so, which one?) or if it should depend on them.
Good that we agree :)
Yeah ;)
Quoted 2 lines
Or alternatively, if we don't want to hide to the user that this tool is going to bring Python into the build, we could:
We already do so for E.G. dstat, so unless kconfig gets confused about the conditional selects I think we should go for it.
Signature · 2 lines
Venlig hilsen, Peter Korsgaard