Skip to contentSkip to conversation

smem: matplotlib is an optional depencency

PATCH In review Nicola Lunghi 2 participants 4 messages Mar 11, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 smem: matplotlib is an optional depencency

smem doesn't need matplotlib and numpy to run, is an optional dependency only needed to produce graphs.

This is needed to avoid to include and build matplotlib and numpy by default

---
 meta-oe/recipes-support/smem/smem_1.5.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta-oe/recipes-support/smem/smem_1.5.bb +3 -1
index 90db9c3f3..446325e93 100644
@@ -20,6 +20,9 @@ UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)"
 
 S = "${WORKDIR}/${BPN}-${HG_CHANGESET}"
 
+#PACKAGECONFIG ?= "graph"
+PACKAGECONFIG[graph] = ",,,python3-matplotlib python3-numpy"
+
 do_compile() {
         ${CC} ${CFLAGS} ${LDFLAGS} smemcap.c -o smemcap
 }
@@ -34,7 +37,6 @@ do_install() {
 }
 
 RDEPENDS_${PN} = "python3-core python3-compression"
-RRECOMMENDS_${PN} = "python3-matplotlib python3-numpy"
 
 PACKAGE_BEFORE_PN = "smemcap"
 
Signature · 1 line
2.20.1
#1 lore raw
Quoted 2 lines · Nicola Lunghi

smem doesn't need matplotlib and numpy to run, is an optional dependency only needed to produce graphs.

Right, that's why it's an RRECOMMENDS. If you don't want it in the image, just do BAD_RECOMMENDATIONS as per usual practice :-)

Cheers,
Andre'

Quoted 32 lines

This is needed to avoid to include and build matplotlib and numpy by default

---
 meta-oe/recipes-support/smem/smem_1.5.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta-oe/recipes-support/smem/smem_1.5.bb +3 -1
index 90db9c3f3..446325e93 100644
@@ -20,6 +20,9 @@ UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)"
 
 S = "${WORKDIR}/${BPN}-${HG_CHANGESET}"
 
+#PACKAGECONFIG ?= "graph"
+PACKAGECONFIG[graph] = ",,,python3-matplotlib python3-numpy"
+
 do_compile() {
         ${CC} ${CFLAGS} ${LDFLAGS} smemcap.c -o smemcap
 }
@@ -34,7 +37,6 @@ do_install() {
 }
 
 RDEPENDS_${PN} = "python3-core python3-compression"
-RRECOMMENDS_${PN} = "python3-matplotlib python3-numpy"
 
 PACKAGE_BEFORE_PN = "smemcap"
 
Signature · 1 line
2.20.1
#2 lore raw
Quoted 6 lines · André Draszik
Quoted 2 lines · Nicola Lunghi

smem doesn't need matplotlib and numpy to run, is an optional dependency only needed to produce graphs.

Right, that's why it's an RRECOMMENDS. If you don't want it in the image, just do BAD_RECOMMENDATIONS as per usual practice :-)

Also, smem really wants those to produce graphs. If you want something simple on the target to just capture the data, there is smemcap as a separate utility (and package).

A.

Quoted 36 lines

Cheers,
Andre'

Quoted 32 lines

This is needed to avoid to include and build matplotlib and numpy by default

---
 meta-oe/recipes-support/smem/smem_1.5.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta-oe/recipes-support/smem/smem_1.5.bb +3 -1
index 90db9c3f3..446325e93 100644
@@ -20,6 +20,9 @@ UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)"
 
 S = "${WORKDIR}/${BPN}-${HG_CHANGESET}"
 
+#PACKAGECONFIG ?= "graph"
+PACKAGECONFIG[graph] = ",,,python3-matplotlib python3-numpy"
+
 do_compile() {
         ${CC} ${CFLAGS} ${LDFLAGS} smemcap.c -o smemcap
 }
@@ -34,7 +37,6 @@ do_install() {
 }
 
 RDEPENDS_${PN} = "python3-core python3-compression"
-RRECOMMENDS_${PN} = "python3-matplotlib python3-numpy"
 
 PACKAGE_BEFORE_PN = "smemcap"
 
Signature · 1 line
2.20.1
author
#3 lore raw

Hi Andre,
the problem is that if you put the package in RRECOMMENDS, yocto will still build
python3-numpy and python3-matplotlib even if you add it to BAD_RECOMMENDATIONS

from https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#var-RRECOMMENDS
The package manager will automatically install the RRECOMMENDS list
of packages when installing the built package.
However, you can prevent listed packages from being installed by using the BAD_RECOMMENDATIONS, NO_RECOMMENDATIONS, and PACKAGE_EXCLUDE variables.

Note the "from being installed"

And on my particular machine (armv5) with musl the numpy build is broken (no fpu, not supported for now, working on a fix for that but it require more time)

Also I don't think is a good idea to build python-numpy (that is huge) if the user is not using it...
on the smem web page it clearly states (https://www.selenic.com/smem)

-> the matplotlib library for chart generation (optional, auto-detected)

and in the code is doing exactly that

def showbar(l, columns, sort):
try:
import pylab, numpy
except ImportError:
sys.stderr.write("bar chart requires matplotlib\n") sys.exit(-1)

so numpy and matplotlib are needed only if you want to use the

parser.add_option("", "--pie", type='str', help="show pie graph") parser.add_option("", "--bar", type='str', help="show bar graph")

function

Another thing: there's a way to declare that a recipe needs a floating point unit?

Cheers
Nick

Quoted 57 lines · André Draszik
Quoted 6 lines · André Draszik
Quoted 2 lines · Nicola Lunghi

smem doesn't need matplotlib and numpy to run, is an optional dependency only needed to produce graphs.

Right, that's why it's an RRECOMMENDS. If you don't want it in the image, just do BAD_RECOMMENDATIONS as per usual practice :-)

Also, smem really wants those to produce graphs. If you want something simple on the target to just capture the data, there is smemcap as a separate utility (and package).

A.

Quoted 28 lines

Cheers,
Andre'

Quoted 24 lines

This is needed to avoid to include and build matplotlib and numpy by default

---
 meta-oe/recipes-support/smem/smem_1.5.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta-oe/recipes-support/smem/smem_1.5.bb +3 -0
index 90db9c3f3..446325e93 100644
@@ -20,6 +20,9 @@ UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)"
 
 S = "${WORKDIR}/${BPN}-${HG_CHANGESET}"
 
+#PACKAGECONFIG ?= "graph"
+PACKAGECONFIG[graph] = ",,,python3-matplotlib python3-numpy"
+
 do_compile() {
         ${CC} ${CFLAGS} ${LDFLAGS} smemcap.c -o smemcap
 }
@@ -34,7 +37,6 @@ do_install() {
 }
 
Quoted 8 lines
Quoted 8 lines
meta-oe/recipes-support/smem/smem_1.5.bb +0 -2
 RDEPENDS_${PN} = "python3-core python3-compression"
-RRECOMMENDS_${PN} = "python3-matplotlib python3-numpy"
 
 PACKAGE_BEFORE_PN = "smemcap"
 
--

2.20.1

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel