Skip to contentSkip to conversation

package/kodi: needs .py modules

PATCH Superseded Yann E. MORIN 4 participants 12 messages Sep 13, 2015 – Dec 5, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/kodi: needs .py modules

Kodi segfaults as soon as it tries to load a python module:

Could not find platform independent libraries <prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
Segmentation fault

Turns out that keeping .py modules (with or without .pyc) fixes the issue.

Currently, Kodi selects python, but since the format of modules is a choice, we can not select it.

Fix that by inverting the dependency on python from Kodi:
- turn it into a depends rather than a select,
- add the dependency to ! pyc-only
- update the comment accordingly.

---
changes v1 -> v2:
- fix spurious 'i' (vim insert)

---
 package/kodi/Config.in | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
package/kodi/Config.in +5 -3
index 797f59d..6d6c47b 100644
@@ -2,10 +2,11 @@ config BR2_PACKAGE_KODI_ARCH_SUPPORTS
 	bool
 	default y if (BR2_arm || (BR2_mipsel && BR2_TOOLCHAIN_USES_GLIBC) || BR2_i386 || BR2_x86_64) && BR2_PACKAGE_BOOST_ARCH_SUPPORTS
 
-comment "kodi needs a toolchain w/ C++, threads, wchar, dynamic library"
+comment "kodi needs python and .py modiules, and a toolchain w/ C++, threads, wchar, dynamic library"
 	depends on BR2_PACKAGE_KODI_ARCH_SUPPORTS
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS \
-		|| !BR2_USE_WCHAR || BR2_STATIC_LIBS
+		|| !BR2_USE_WCHAR || BR2_STATIC_LIBS \
+		|| !BR2_PACKAGE_PYTHON || BR2_PACKAGE_PYTHON_PYC_ONLY
 	depends on BR2_USE_MMU
 
 config BR2_PACKAGE_KODI_EGL_GLES
@@ -65,7 +66,6 @@ menuconfig BR2_PACKAGE_KODI
 	select BR2_PACKAGE_OPENSSL
 	select BR2_PACKAGE_PCRE
 	select BR2_PACKAGE_PCRE_UCP
-	select BR2_PACKAGE_PYTHON
 	select BR2_PACKAGE_PYTHON_BSDDB
 	select BR2_PACKAGE_PYTHON_BZIP2
 	select BR2_PACKAGE_PYTHON_CURSES
@@ -94,6 +94,8 @@ menuconfig BR2_PACKAGE_KODI
 	depends on BR2_USE_WCHAR
 	depends on !BR2_STATIC_LIBS # python
 	depends on BR2_PACKAGE_KODI_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_PYTHON
+	depends on !BR2_PACKAGE_PYTHON_PYC_ONLY
 	help
 	  Kodi is an award-winning free and open source (GPL) software
 	  media player and entertainment hub for digital media.
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/1 package/kodi: needs .py modules

Yann,

Quoted 13 lines · Yann E. MORIN

Kodi segfaults as soon as it tries to load a python module:

Could not find platform independent libraries <prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
Segmentation fault

Turns out that keeping .py modules (with or without .pyc) fixes the issue.

Currently, Kodi selects python, but since the format of modules is a choice, we can not select it.

Quoted 6 lines

Fix that by inverting the dependency on python from Kodi:
- turn it into a depends rather than a select,
- add the dependency to ! pyc-only
- update the comment accordingly.

Do we actually understand why it doesn't work? There is really no reason for .py files to be necessary. Does it happen with Python 2 or Python 3? Apparently, Kodi selects Python 2, so there really shouldn't be any problem with having just .pyc files (Python 3 can be more tricky in that respect.

Quoted 2 lines

changes v1 -> v2:
- fix spurious 'i' (vim insert)

But it wasn't enough it seems :)

package/kodi/Config.in config BR2_PACKAGE_KODI_ARCH_SUPPORTS · line 5

Quoted 2 lines
package/kodi/Config.in +1 -1
-comment "kodi needs a toolchain w/ C++, threads, wchar, dynamic library"
+comment "kodi needs python and .py modiules, and a toolchain w/ C++, threads, wchar, dynamic library"
                                      ^^^^^^^^

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH v2 1/1 package/kodi: needs .py modules

Thomas, All,

On 2015-09-13 23:29 +0200, Thomas Petazzoni spake thusly:

Quoted 19 lines · Yann E. MORIN
Quoted 18 lines

Kodi segfaults as soon as it tries to load a python module:

Could not find platform independent libraries <prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
Segmentation fault

Turns out that keeping .py modules (with or without .pyc) fixes the issue.

Currently, Kodi selects python, but since the format of modules is a choice, we can not select it.

Fix that by inverting the dependency on python from Kodi:
- turn it into a depends rather than a select,
- add the dependency to ! pyc-only
- update the comment accordingly.

Quoted 4 lines
Quoted 1 line

Do we actually understand why it doesn't work? There is really no reason for .py files to be necessary.

Well, what do I know about python? ;-)

I never said I understood the issue. Just that having only .pyc modules make Kodi segfault, while having .py makes it work... :-(

All I got was the trace above. There was nothing (of interest) in Kodi's own log file.

Quoted 2 lines

Does it happen with Python 2 or
Python 3?

Kodi uses python 2, that's what I have in my config.

Quoted 7 lines

Apparently, Kodi selects Python 2, so there really shouldn't be any problem with having just .pyc files (Python 3 can be more tricky in that respect.

Quoted 2 lines

changes v1 -> v2:
- fix spurious 'i' (vim insert)

Quoted 6 lines

But it wasn't enough it seems :)

package/kodi/Config.in config BR2_PACKAGE_KODI_ARCH_SUPPORTS · line 5

Quoted 2 lines
package/kodi/Config.in +1 -1
-comment "kodi needs a toolchain w/ C++, threads, wchar, dynamic library"
+comment "kodi needs python and .py modiules, and a toolchain w/ C++, threads, wchar, dynamic library"
                                      ^^^^^^^^

Meh.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH v2 1/1 package/kodi: needs .py modules

Hello,

Quoted 10 lines · Yann E. MORIN
Quoted 2 lines

Do we actually understand why it doesn't work? There is really no reason for .py files to be necessary.

Well, what do I know about python? ;-)

I never said I understood the issue. Just that having only .pyc modules make Kodi segfault, while having .py makes it work... :-(

All I got was the trace above. There was nothing (of interest) in Kodi's own log file.

As you can imagine, I'm not too happy with this solution. I believe Kodi is doing something incorrect, since if you just run Python with the .pyc files, and do "import site", it works just fine.

There is some logic in Kodi that tries to set the PYTHONHOME environment variable. Can you see in the logs if you see the following messages (from xbmc/interfaces/python/XBPython.cpp) :

  CLog::Log(LOGINFO, "initializing python engine.");
  CLog::Log(LOGDEBUG, "PYTHONHOME -> %s", CSpecialProtocol::TranslatePath("special://frameworks").c_str());
  CLog::Log(LOGDEBUG, "PYTHONPATH -> %s", CSpecialProtocol::TranslatePath("special://frameworks").c_str());

Alternatively, can you change Python, in file Modules/getpath.c, function calculate_path(), and dump all the environment variables?

I could do it myself, but Kodi is so long to build... :-/

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH v2 1/1 package/kodi: needs .py modules

Thomas, All,

On 2015-09-19 14:40 +0200, Thomas Petazzoni spake thusly:

Quoted 12 lines

Hello,

Quoted 8 lines · Yann E. MORIN
Quoted 2 lines

Do we actually understand why it doesn't work? There is really no reason for .py files to be necessary.

Well, what do I know about python? ;-)

I never said I understood the issue. Just that having only .pyc modules make Kodi segfault, while having .py makes it work... :-(

Quoted 6 lines
Quoted 2 lines

All I got was the trace above. There was nothing (of interest) in Kodi's own log file.

As you can imagine, I'm not too happy with this solution. I believe Kodi is doing something incorrect, since if you just run Python with the .pyc files, and do "import site", it works just fine.

Yeah, I would not say the patch is the optimal solution.

Quoted 7 lines

There is some logic in Kodi that tries to set the PYTHONHOME environment variable. Can you see in the logs if you see the following messages (from xbmc/interfaces/python/XBPython.cpp) :

  CLog::Log(LOGINFO, "initializing python engine.");
  CLog::Log(LOGDEBUG, "PYTHONHOME -> %s", CSpecialProtocol::TranslatePath("special://frameworks").c_str());
  CLog::Log(LOGDEBUG, "PYTHONPATH -> %s", CSpecialProtocol::TranslatePath("special://frameworks").c_str());

No, those messages I did not see. Only the message about suggesting to set PYTHONHOME followed by the segfault.

Quoted 2 lines

Alternatively, can you change Python, in file Modules/getpath.c, function calculate_path(), and dump all the environment variables?

Sure, I can have a look at it. No promise, though...

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH v2 1/1 package/kodi: needs .py modules

Hello,

Quoted 10 lines · Yann E. MORIN
Quoted 7 lines

There is some logic in Kodi that tries to set the PYTHONHOME environment variable. Can you see in the logs if you see the following messages (from xbmc/interfaces/python/XBPython.cpp) :

  CLog::Log(LOGINFO, "initializing python engine.");
  CLog::Log(LOGDEBUG, "PYTHONHOME -> %s", CSpecialProtocol::TranslatePath("special://frameworks").c_str());
  CLog::Log(LOGDEBUG, "PYTHONPATH -> %s", CSpecialProtocol::TranslatePath("special://frameworks").c_str());

No, those messages I did not see. Only the message about suggesting to set PYTHONHOME followed by the segfault.

All the messages you posted are coming from Python itself. I'm interested in seeing under what conditions is Kodi starting the Python interpreter. But there's lot of code in Kodi, so I'm not sure from which place the Python interpreter is started and causing the segfault you're seeing.

Any chance you do a debug symbols enabled build to get a backtrace of Kodi ?

Quoted 4 lines
Quoted 2 lines

Alternatively, can you change Python, in file Modules/getpath.c, function calculate_path(), and dump all the environment variables?

Sure, I can have a look at it. No promise, though...

Yes, sure. You could also report a bug in the Kodi bug tracker? They might at least be able to give some hints about what's going on.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#6 lore raw

PATCH v2 1/1 package/kodi: needs .py modules

In reply to Thomas Petazzoni

Am Sun, 13 Sep 2015 23:29:42 +0200 schrieb Thomas Petazzoni:

Quoted 19 lines

Yann,

Quoted 16 lines · Yann E. MORIN

Kodi segfaults as soon as it tries to load a python module:

Could not find platform independent libraries <prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site Segmentation fault

Turns out that keeping .py modules (with or without .pyc) fixes the issue.

Currently, Kodi selects python, but since the format of modules is a choice, we can not select it.

Fix that by inverting the dependency on python from Kodi:
- turn it into a depends rather than a select,
- add the dependency to ! pyc-only - update the comment accordingly.

Quoted 5 lines
Quoted 2 lines

Signed-off-by: "Yann E. MORIN"
<[email protected]>

Do we actually understand why it doesn't work? There is really no reason for .py files to be necessary.

Hi Thomas, hi Yann,

according to http://kodi.wiki/view/Add-on_rules Kodi apparently expects .py files in add-ons:

"All source files must be included. No pre-compiled files will be allowed."

Some more information about this can be found here:
http://forum.kodi.tv/showthread.php?tid=181065&pid=1580560#pid1580560
https://github.com/OpenELEC/OpenELEC.tv/issues/3335#issuecomment-51490468

I remember that several years ago I had problems after removing .py files from my xbmc/kodi box so I kept them ever since ;)

Regards, Bernd

#7 lore raw

PATCH v2 1/1 package/kodi: needs .py modules

In reply to Yann E. MORIN
Quoted 7 lines · Yann E. MORIN

Kodi segfaults as soon as it tries to load a python module:

Could not find platform independent libraries <prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
Segmentation fault

Quoted 5 lines

Turns out that keeping .py modules (with or without .pyc) fixes the issue.

Currently, Kodi selects python, but since the format of modules is a choice, we can not select it.

I think it's a lot more user-friendly to do

select BR2_PACKAGE_PYTHON_PY_PYC

That removes the possibility for the user to select the PY_ONLY option, but I
don't think that that's so terribly important. And it does make life a whole lot simpler for someone who wants to select Kodi. They already have to go and enable an EGL provider, so let's not make their life harder by requiring manual selection of python with the correct, non-default _PY_PYC option...

Regards,
Arnout

Quoted 51 lines

Fix that by inverting the dependency on python from Kodi:
- turn it into a depends rather than a select,
- add the dependency to ! pyc-only
- update the comment accordingly.

---
changes v1 -> v2:
- fix spurious 'i' (vim insert)

---
 package/kodi/Config.in | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
package/kodi/Config.in +5 -3
index 797f59d..6d6c47b 100644
@@ -2,10 +2,11 @@ config BR2_PACKAGE_KODI_ARCH_SUPPORTS
 	bool
 	default y if (BR2_arm || (BR2_mipsel && BR2_TOOLCHAIN_USES_GLIBC) || BR2_i386 || BR2_x86_64) && BR2_PACKAGE_BOOST_ARCH_SUPPORTS
 
-comment "kodi needs a toolchain w/ C++, threads, wchar, dynamic library"
+comment "kodi needs python and .py modiules, and a toolchain w/ C++, threads, wchar, dynamic library"
 	depends on BR2_PACKAGE_KODI_ARCH_SUPPORTS
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS \
-		|| !BR2_USE_WCHAR || BR2_STATIC_LIBS
+		|| !BR2_USE_WCHAR || BR2_STATIC_LIBS \
+		|| !BR2_PACKAGE_PYTHON || BR2_PACKAGE_PYTHON_PYC_ONLY
 	depends on BR2_USE_MMU
 
 config BR2_PACKAGE_KODI_EGL_GLES
@@ -65,7 +66,6 @@ menuconfig BR2_PACKAGE_KODI
 	select BR2_PACKAGE_OPENSSL
 	select BR2_PACKAGE_PCRE
 	select BR2_PACKAGE_PCRE_UCP
-	select BR2_PACKAGE_PYTHON
 	select BR2_PACKAGE_PYTHON_BSDDB
 	select BR2_PACKAGE_PYTHON_BZIP2
 	select BR2_PACKAGE_PYTHON_CURSES
@@ -94,6 +94,8 @@ menuconfig BR2_PACKAGE_KODI
 	depends on BR2_USE_WCHAR
 	depends on !BR2_STATIC_LIBS # python
 	depends on BR2_PACKAGE_KODI_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_PYTHON
+	depends on !BR2_PACKAGE_PYTHON_PYC_ONLY
 	help
 	  Kodi is an award-winning free and open source (GPL) software
 	  media player and entertainment hub for digital media.
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#8 lore raw

PATCH v2 1/1 package/kodi: needs .py modules

Arnout, All,

On 2015-09-15 18:37 +0200, Arnout Vandecappelle spake thusly:

Quoted 11 lines · Yann E. MORIN
Quoted 10 lines

Kodi segfaults as soon as it tries to load a python module:

Could not find platform independent libraries <prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
Segmentation fault

Turns out that keeping .py modules (with or without .pyc) fixes the issue.

Quoted 6 lines
Quoted 2 lines

Currently, Kodi selects python, but since the format of modules is a choice, we can not select it.

I think it's a lot more user-friendly to do

select BR2_PACKAGE_PYTHON_PY_PYC

Two problems with that option:
- first, it is not acceptable; one must *not* select a symbol that is part of a choice
- Kconfig won't even act on that select, in fact:

    $ cat select-choice.in
    config FOO
        bool "foo"
        select BAR_B

choice BAR
bool "bar"

config BAR_A
bool "bar-a"

config BAR_B
bool "bar-b"

config BAR_C
bool "bar-c"

endchoice

$ cat .config
#
# Automatically generated file; DO NOT EDIT.
# Configuration
#
CONFIG_FOO=y
CONFIG_BAR_A=y
# CONFIG_BAR_B is not set
# CONFIG_BAR_C is not set

So, as you can see, even though FOO is set, BAR_B is not, even though FOO selects it.

Quoted 5 lines

That removes the possibility for the user to select the PY_ONLY option, but I
don't think that that's so terribly important. And it does make life a whole lot simpler for someone who wants to select Kodi. They already have to go and enable an EGL provider, so let's not make their life harder by requiring manual selection of python with the correct, non-default _PY_PYC option...

One alternative (if we are *that* concerned with user-friendliness), would be to introduce an intermediate symbol that allows to get rid of .py, something like:

config BR2_PKG_PYTHON_WANTS_PY
bool

choice
bool "module fomat"

config BR2_PKG_PYTHON_PY_ONLY
bool ".py only"

config BR2_PKG_PYTHON_PYC_ONLY
bool ".pyc only"
depends on !BR2_PKG_PYTHON_WANTS_PY

endchoice

(note: .py+.pyc option voluntarily omitted).

and then Kodi would select BR2_PKG_PYTHON_WANTS_PY.

But that's just ugly, even just for the sake of simplicity.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#9 lore raw

PATCH v2 1/1 package/kodi: needs .py modules

Quoted 17 lines · Yann E. MORIN

Arnout, All,

On 2015-09-15 18:37 +0200, Arnout Vandecappelle spake thusly:

Quoted 14 lines · Yann E. MORIN
Quoted 12 lines

Kodi segfaults as soon as it tries to load a python module:

Could not find platform independent libraries <prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
Segmentation fault

Turns out that keeping .py modules (with or without .pyc) fixes the issue.

Currently, Kodi selects python, but since the format of modules is a choice, we can not select it.

Quoted 8 lines
Quoted 3 lines

I think it's a lot more user-friendly to do

select BR2_PACKAGE_PYTHON_PY_PYC

Two problems with that option:
- first, it is not acceptable; one must *not* select a symbol that is part of a choice
- Kconfig won't even act on that select, in fact:

I guess 1 is a result of 2, right? Stupid Kconfig.

In that case, there really is no alternative except what you propose. The
ugliness of BR2_PACKAGE_PYTHON_WANTS_PY is too horrible to even consider.

Well, perhaps better would be to make kodi not crash in PYC_ONLY :-)

Regards,
Arnout

Quoted 68 lines
    $ cat select-choice.in
    config FOO
        bool "foo"
        select BAR_B

choice BAR
bool "bar"

config BAR_A
bool "bar-a"

config BAR_B
bool "bar-b"

config BAR_C
bool "bar-c"

endchoice

$ cat .config
#
# Automatically generated file; DO NOT EDIT.
# Configuration
#
CONFIG_FOO=y
CONFIG_BAR_A=y
# CONFIG_BAR_B is not set
# CONFIG_BAR_C is not set

So, as you can see, even though FOO is set, BAR_B is not, even though FOO selects it.

Quoted 5 lines

That removes the possibility for the user to select the PY_ONLY option, but I
don't think that that's so terribly important. And it does make life a whole lot simpler for someone who wants to select Kodi. They already have to go and enable an EGL provider, so let's not make their life harder by requiring manual selection of python with the correct, non-default _PY_PYC option...

One alternative (if we are *that* concerned with user-friendliness), would be to introduce an intermediate symbol that allows to get rid of .py, something like:

config BR2_PKG_PYTHON_WANTS_PY
bool

choice
bool "module fomat"

config BR2_PKG_PYTHON_PY_ONLY
bool ".py only"

config BR2_PKG_PYTHON_PYC_ONLY
bool ".pyc only"
depends on !BR2_PKG_PYTHON_WANTS_PY

endchoice

(note: .py+.pyc option voluntarily omitted).

and then Kodi would select BR2_PKG_PYTHON_WANTS_PY.

But that's just ugly, even just for the sake of simplicity.

Regards,
Yann E. MORIN.

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#10 lore raw

PATCH v2 1/1 package/kodi: needs .py modules

Arnout, All,

On 2015-09-15 22:52 +0200, Arnout Vandecappelle spake thusly:

Quoted 18 lines · Yann E. MORIN
Quoted 17 lines

On 2015-09-15 18:37 +0200, Arnout Vandecappelle spake thusly:

Quoted 16 lines · Yann E. MORIN
Quoted 7 lines

Kodi segfaults as soon as it tries to load a python module:

Could not find platform independent libraries <prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
Segmentation fault

Quoted 5 lines

Turns out that keeping .py modules (with or without .pyc) fixes the issue.

Currently, Kodi selects python, but since the format of modules is a choice, we can not select it.

I think it's a lot more user-friendly to do

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

select BR2_PACKAGE_PYTHON_PY_PYC

Two problems with that option:
- first, it is not acceptable; one must *not* select a symbol that is part of a choice
- Kconfig won't even act on that select, in fact:

I guess 1 is a result of 2, right? Stupid Kconfig.

Well, not really. If you allow a symbol of a choice to be selected, then how would you handle this case;

config FOO
bool "foo"
select BUZ_A

config BAR
bool "bar"
select BUZ_B

choice
bool "buz"

config BUZ_A
bool "buz-a"

config BUZ_B
bool "buz-b"

endchoice

That's basicaly unsolvable.

Hence, selecting a choice entry does not make sense to start with.

Quoted 2 lines

In that case, there really is no alternative except what you propose. The
ugliness of BR2_PACKAGE_PYTHON_WANTS_PY is too horrible to even consider.

Yes, _WANTS_PY is ugly.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#11 lore raw

PATCH v2 1/1 package/kodi: needs .py modules

In reply to Yann E. MORIN

All,

On 2015-09-13 23:13 +0200, Yann E. MORIN spake thusly:

Quoted 10 lines

Kodi segfaults as soon as it tries to load a python module:

Could not find platform independent libraries <prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
Segmentation fault

Turns out that keeping .py modules (with or without .pyc) fixes the issue.

Quoted 7 lines

Currently, Kodi selects python, but since the format of modules is a choice, we can not select it.

Fix that by inverting the dependency on python from Kodi:
- turn it into a depends rather than a select,
- add the dependency to ! pyc-only
- update the comment accordingly.

This is wrong and causes reursive dependencies:

package/kodi/Config.in:33:error: recursive dependency detected!
package/kodi/Config.in:33: symbol BR2_PACKAGE_KODI depends on BR2_PACKAGE_PYTHON
package/python/Config.in:5: symbol BR2_PACKAGE_PYTHON is selected by BR2_PACKAGE_SAMBA4
package/samba4/Config.in:7: symbol BR2_PACKAGE_SAMBA4 is selected by BR2_PACKAGE_KODI_LIBSMBCLIENT
package/kodi/Config.in:216: symbol BR2_PACKAGE_KODI_LIBSMBCLIENT depends on BR2_PACKAGE_KODI

Marking as "rejected". I'll try to find a better solution.

Regards,
Yann E. MORIN.

Quoted 47 lines

---
changes v1 -> v2:
- fix spurious 'i' (vim insert)

---
 package/kodi/Config.in | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
package/kodi/Config.in +5 -3
index 797f59d..6d6c47b 100644
@@ -2,10 +2,11 @@ config BR2_PACKAGE_KODI_ARCH_SUPPORTS
 	bool
 	default y if (BR2_arm || (BR2_mipsel && BR2_TOOLCHAIN_USES_GLIBC) || BR2_i386 || BR2_x86_64) && BR2_PACKAGE_BOOST_ARCH_SUPPORTS
 
-comment "kodi needs a toolchain w/ C++, threads, wchar, dynamic library"
+comment "kodi needs python and .py modiules, and a toolchain w/ C++, threads, wchar, dynamic library"
 	depends on BR2_PACKAGE_KODI_ARCH_SUPPORTS
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS \
-		|| !BR2_USE_WCHAR || BR2_STATIC_LIBS
+		|| !BR2_USE_WCHAR || BR2_STATIC_LIBS \
+		|| !BR2_PACKAGE_PYTHON || BR2_PACKAGE_PYTHON_PYC_ONLY
 	depends on BR2_USE_MMU
 
 config BR2_PACKAGE_KODI_EGL_GLES
@@ -65,7 +66,6 @@ menuconfig BR2_PACKAGE_KODI
 	select BR2_PACKAGE_OPENSSL
 	select BR2_PACKAGE_PCRE
 	select BR2_PACKAGE_PCRE_UCP
-	select BR2_PACKAGE_PYTHON
 	select BR2_PACKAGE_PYTHON_BSDDB
 	select BR2_PACKAGE_PYTHON_BZIP2
 	select BR2_PACKAGE_PYTHON_CURSES
@@ -94,6 +94,8 @@ menuconfig BR2_PACKAGE_KODI
 	depends on BR2_USE_WCHAR
 	depends on !BR2_STATIC_LIBS # python
 	depends on BR2_PACKAGE_KODI_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_PYTHON
+	depends on !BR2_PACKAGE_PYTHON_PYC_ONLY
 	help
 	  Kodi is an award-winning free and open source (GPL) software
 	  media player and entertainment hub for digital media.
Signature · 1 line
1.9.1
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'