Commits

Armin Rigo  committed 1567dba

Merge the non-doc parts of the 'windows-packaging' branch here.

  • Participants
  • Parent commits 4a99439
  • Branches release-2.2.x

Comments (0)

Files changed (2)

File lib_pypy/_tkinter/tklib.py

     incdirs = ['/usr/local/include/tcl8.5', '/usr/local/include/tk8.5', '/usr/X11R6/include']
     linklibs = ['tk85', 'tcl85']
     libdirs = ['/usr/local/lib', '/usr/X11R6/lib']
+elif sys.platform == 'win32':
+    incdirs = []
+    linklibs = ['tcl85', 'tk85']
+    libdirs = []
 else:
     incdirs=['/usr/include/tcl']
     linklibs=['tcl', 'tk']

File pypy/tool/release/package.py

             raise PyPyCNotFound(
                 'Bogus path: %r does not exist (see docstring for more info)'
                 % (os.path.dirname(str(pypy_c)),))
+    win_extras = ['libpypy-c.dll', 'libexpat.dll', 'sqlite3.dll',
+                      'libeay32.dll', 'ssleay32.dll']
     subprocess.check_call([str(pypy_c), '-c', 'import _sqlite3'])
     if not sys.platform == 'win32':
         subprocess.check_call([str(pypy_c), '-c', 'import _curses'])
         subprocess.check_call([str(pypy_c), '-c', 'import syslog'])
-        if not withouttk:
-            try:
-                subprocess.check_call([str(pypy_c), '-c', 'import _tkinter'])
-            except subprocess.CalledProcessError:
-                print >>sys.stderr, """Building Tk bindings failed.
+    if not withouttk:
+        try:
+            subprocess.check_call([str(pypy_c), '-c', 'import _tkinter'])
+        except subprocess.CalledProcessError:
+            print >>sys.stderr, """Building Tk bindings failed.
 You can either install Tk development headers package or
 add --without-tk option to skip packaging binary CFFI extension."""
-                sys.exit(1)
+            sys.exit(1)
+        #Can the dependencies be found from cffi somehow?    
+        win_extras += ['tcl85.dll', 'tk85.dll']    
     if sys.platform == 'win32' and not rename_pypy_c.lower().endswith('.exe'):
         rename_pypy_c += '.exe'
     binaries = [(pypy_c, rename_pypy_c)]
 
         # Can't rename a DLL: it is always called 'libpypy-c.dll'
 
-        for extra in ['libpypy-c.dll',
-                      'libexpat.dll', 'sqlite3.dll',
-                      'libeay32.dll', 'ssleay32.dll']:
+        for extra in win_extras:
             p = pypy_c.dirpath().join(extra)
             if not p.check():
                 p = py.path.local.sysfind(extra)
             # XXX users will complain that they cannot compile cpyext
             # modules for windows, has the lib moved or are there no
             # exported functions in the dll so no import library is created?
+        if not withouttk:
+            try:
+                p = pypy_c.dirpath().join('tcl85.dll')
+                if not p.check():
+                    p = py.path.local.sysfind('tcl85.dll')
+                tktcldir = p.dirpath().join('..').join('lib')
+                shutil.copytree(str(tktcldir), str(pypydir.join('tcl')))
+            except WindowsError:
+                print >>sys.stderr, """Packaging Tk runtime failed.
+tk85.dll and tcl85.dll found, expecting to find runtime in ..\\lib
+directory next to the dlls, as per build instructions."""
+                import traceback;traceback.print_exc()
+                sys.exit(1)
 
     # Careful: to copy lib_pypy, copying just the hg-tracked files
     # would not be enough: there are also ctypes_config_cache/_*_cache.py.