[pypy-commit] pypy default: package on portable builds, and contitionally use tk, tcl libraries

mattip pypy.commits at gmail.com
Sun Dec 22 15:27:21 EST 2019


Author: Matti Picus <matti.picus at gmail.com>
Branch: 
Changeset: r98353:ad2431a4d478
Date: 2019-12-22 22:24 +0200
http://bitbucket.org/pypy/pypy/changeset/ad2431a4d478/

Log:	package on portable builds, and contitionally use tk, tcl libraries

diff --git a/lib_pypy/_tkinter/app.py b/lib_pypy/_tkinter/app.py
--- a/lib_pypy/_tkinter/app.py
+++ b/lib_pypy/_tkinter/app.py
@@ -32,6 +32,16 @@
 
 
 def Tcl_AppInit(app):
+    # For portable builds, try to load a local version of the libraries
+    from os.path import join, dirname, exists
+    lib_path = join(dirname(dirname(dirname(__file__))), 'lib')
+    tcl_path = join(lib_path, 'tcl')
+    tk_path = join(lib_path, 'tk')
+    if exists(tcl_path):
+        tklib.Tcl_Eval(app.interp, 'set tcl_library "{0}"'.format(tcl_path).encode('utf-8'))
+    if exists(tk_path):    
+        tklib.Tcl_Eval(app.interp, 'set tk_library "{0}"'.format(tk_path).encode('utf-8'))
+
     if tklib.Tcl_Init(app.interp) == tklib.TCL_ERROR:
         app.raiseTclError()
     skip_tk_init = tklib.Tcl_GetVar(
diff --git a/pypy/tool/release/make_portable.py b/pypy/tool/release/make_portable.py
--- a/pypy/tool/release/make_portable.py
+++ b/pypy/tool/release/make_portable.py
@@ -5,7 +5,7 @@
 
 import os
 from os.path import dirname, relpath, join, exists, basename, realpath
-from shutil import copy2
+from shutil import copy2, copytree
 import sys
 from glob import glob
 from subprocess import check_output, check_call
@@ -85,6 +85,9 @@
     for path, item in copied.items():
         print('Copied {0} to {1}'.format(path, item))
 
+    copytree('/usr/share/tcl8.5', 'lib/tcl')
+    copytree('/usr/share/tk8.5', 'lib/tk')
+
     binaries.extend(copied.values())
 
     rpaths = rpath_binaries(binaries)


More information about the pypy-commit mailing list