[OE-core] [PATCH v2 1/7] python: add tk support

mingli.yu at windriver.com mingli.yu at windriver.com
Thu Nov 8 06:08:11 UTC 2018


From: Mingli Yu <Mingli.Yu at windriver.com>

Add support to enable tk via PACKGECONFIG.
before the patch:
 # python
 Python 2.7.15 (default, Nov  8 2018, 04:53:50)
 [GCC 8.2.0] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import Tkinter
 Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/lib-tk/Tkinter.py", line 39, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
 ImportError: No module named _tkinter
 >>>

After the patch, if enable tk in PACKGECONFIG, then
 # python
 Python 2.7.15 (default, Oct 25 2018, 08:12:45)
 [GCC 8.2.0] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import Tkinter
 >>>

Signed-off-by: Mingli Yu <Mingli.Yu at windriver.com>
---
 meta/recipes-devtools/python/python_2.7.15.bb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/python/python_2.7.15.bb b/meta/recipes-devtools/python/python_2.7.15.bb
index dd969d8..5c4fee0 100644
--- a/meta/recipes-devtools/python/python_2.7.15.bb
+++ b/meta/recipes-devtools/python/python_2.7.15.bb
@@ -21,7 +21,7 @@ SRC_URI += "\
   file://setuptweaks.patch \
   file://check-if-target-is-64b-not-host.patch \
   file://search_db_h_in_inc_dirs_and_avoid_warning.patch \
-  file://avoid_warning_about_tkinter.patch \
+  ${@bb.utils.contains('PACKAGECONFIG', 'tk', '', 'file://avoid_warning_about_tkinter.patch', d)} \
   file://avoid_warning_for_sunos_specific_module.patch \
   file://python-2.7.3-remove-bsdb-rpath.patch \
   file://run-ptest \
@@ -45,6 +45,7 @@ EXTRA_OECONF += "ac_cv_file__dev_ptmx=yes ac_cv_file__dev_ptc=no"
 
 PACKAGECONFIG ??= "bdb"
 PACKAGECONFIG[bdb] = ",,db"
+PACKAGECONFIG[tk] = ",,tk"
 
 do_configure_append() {
 	rm -f ${S}/Makefile.orig
@@ -204,6 +205,7 @@ python(){
 
     packages = d.getVar('PACKAGES').split()
     pn = d.getVar('PN')
+    pkgconfig = d.getVar('PACKAGECONFIG')
 
     newpackages=[]
 
@@ -219,6 +221,8 @@ python(){
         d.setVar('FILES_' + pypackage, '')
         for value in python_manifest[key]['files']:
             d.appendVar('FILES_' + pypackage, ' ' + value)
+            if "tkinter" in pypackage and "tk" in pkgconfig:
+                d.appendVar('FILES_' + pypackage, ' ' + "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_tkinter.so")
             if include_pycs == '1':
                 if value.endswith('.py'):
                     d.appendVar('FILES_' + pypackage, ' ' + value + 'c')
@@ -228,6 +232,8 @@ python(){
             if '${PN}' in value:
                 value=value.split('-')[1]
             d.appendVar('RDEPENDS_' + pypackage, ' ' + pn + '-' + value)
+            if "tkinter" in pypackage and "tk" in pkgconfig:
+                d.appendVar('RDEPENDS_' + pypackage, ' ' + 'tk')
         d.setVar('SUMMARY_' + pypackage, python_manifest[key]['summary'])
 
     # Prepending so to avoid python-misc getting everything
-- 
2.7.4




More information about the Openembedded-core mailing list