[OE-core] [oe-core][PATCH 2/2] python: add tk support

mingli.yu at windriver.com mingli.yu at windriver.com
Thu Oct 25 08:39:19 UTC 2018


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

Enable tk to add tk support for python.
before the patch:
 # 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
 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:
 # 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>
---
 .../python/avoid_warning_about_tkinter.patch       | 29 ----------------------
 .../python/python/python2-manifest.json            |  8 +++---
 meta/recipes-devtools/python/python_2.7.15.bb      |  8 +++---
 3 files changed, 10 insertions(+), 35 deletions(-)
 delete mode 100644 meta/recipes-devtools/python/python/avoid_warning_about_tkinter.patch

diff --git a/meta/recipes-devtools/python/python/avoid_warning_about_tkinter.patch b/meta/recipes-devtools/python/python/avoid_warning_about_tkinter.patch
deleted file mode 100644
index 287095f..0000000
--- a/meta/recipes-devtools/python/python/avoid_warning_about_tkinter.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-_tkinter module needs tk module along with tcl. tk is not yet integrated
-in yocto so we skip the check for this module.
-Avoid a warning by not adding this module to missing variable.
-
-Upstream-Status: Inappropriate [distribution]
-
-Also simply disable the tk module since its not in DEPENDS.
-Signed-off-by: Andrei Gherzan <andrei at gherzan.ro>
-
-Index: Python-2.7.13/setup.py
-===================================================================
---- Python-2.7.13.orig/setup.py
-+++ Python-2.7.13/setup.py
-@@ -1783,10 +1783,12 @@ class PyBuildExt(build_ext):
-         self.extensions.extend(exts)
- 
-         # Call the method for detecting whether _tkinter can be compiled
--        self.detect_tkinter(inc_dirs, lib_dirs)
-+        # self.detect_tkinter(inc_dirs, lib_dirs)
- 
--        if '_tkinter' not in [e.name for e in self.extensions]:
--            missing.append('_tkinter')
-+        # tkinter module will not be avalaible as yocto
-+        # doesn't have tk integrated (yet)
-+        #if '_tkinter' not in [e.name for e in self.extensions]:
-+        #    missing.append('_tkinter')
- 
- ##         # Uncomment these lines if you want to play with xxmodule.c
- ##         ext = Extension('xx', ['xxmodule.c'])
diff --git a/meta/recipes-devtools/python/python/python2-manifest.json b/meta/recipes-devtools/python/python/python2-manifest.json
index 260fa6f..7b49e94 100644
--- a/meta/recipes-devtools/python/python/python2-manifest.json
+++ b/meta/recipes-devtools/python/python/python2-manifest.json
@@ -963,10 +963,12 @@
     "tkinter": {
         "summary": "Python Tcl/Tk bindings", 
         "rdepends": [
-            "core"
+            "core",
+            "tk"
         ], 
         "files": [
-            "${libdir}/python2.7/lib-tk"
+            "${libdir}/python2.7/lib-tk",
+            "${libdir}/python2.7/lib-dynload/_tkinter.so"
         ]
     }, 
     "unittest": {
@@ -1043,4 +1045,4 @@
             "${libdir}/python2.7/lib-dynload/zlib.so"
         ]
     }
-}
\ No newline at end of file
+}
diff --git a/meta/recipes-devtools/python/python_2.7.15.bb b/meta/recipes-devtools/python/python_2.7.15.bb
index dd969d8..a6ecbb9 100644
--- a/meta/recipes-devtools/python/python_2.7.15.bb
+++ b/meta/recipes-devtools/python/python_2.7.15.bb
@@ -1,6 +1,6 @@
 require python.inc
 
-DEPENDS = "python-native libffi bzip2 gdbm openssl \
+DEPENDS = "python-native libffi bzip2 gdbm openssl tk \
            readline sqlite3 zlib virtual/crypt"
 
 PR = "${INC_PR}"
@@ -21,7 +21,6 @@ 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 \
   file://avoid_warning_for_sunos_specific_module.patch \
   file://python-2.7.3-remove-bsdb-rpath.patch \
   file://run-ptest \
@@ -227,7 +226,10 @@ python(){
             # Make it work with or without $PN
             if '${PN}' in value:
                 value=value.split('-')[1]
-            d.appendVar('RDEPENDS_' + pypackage, ' ' + pn + '-' + value)
+            if "tkinter" in pypackage and value == "tk":
+                d.appendVar('RDEPENDS_' + pypackage, ' ' + value)
+            else:
+                d.appendVar('RDEPENDS_' + pypackage, ' ' + pn + '-' + value)
         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