Author: Matti Picus <matti.pi...@gmail.com> Branch: Changeset: r68206:4cc0b451e81f Date: 2013-11-18 13:07 +0200 http://bitbucket.org/pypy/pypy/changeset/4cc0b451e81f/
Log: merge windows-packaging, which add the tcl/tk runtime to win32 for cpython compatability diff --git a/lib_pypy/_tkinter/tklib.py b/lib_pypy/_tkinter/tklib.py --- a/lib_pypy/_tkinter/tklib.py +++ b/lib_pypy/_tkinter/tklib.py @@ -112,6 +112,10 @@ 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'] diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -9,3 +9,7 @@ .. branch: numpy-newbyteorder Clean up numpy types, add newbyteorder functionality + +.. branch windows-packaging +Package tk/tcl runtime with win32 + diff --git a/pypy/doc/windows.rst b/pypy/doc/windows.rst --- a/pypy/doc/windows.rst +++ b/pypy/doc/windows.rst @@ -73,11 +73,11 @@ https://bitbucket.org/pypy/pypy/downloads/local.zip Then expand it into the base directory (base_dir) and modify your environment to reflect this:: - set PATH=<base_dir>\bin;%PATH% - set INCLUDE=<base_dir>\include;%INCLUDE% - set LIB=<base_dir>\lib;%LIB% + set PATH=<base_dir>\bin;<base_dir>\tcltk\bin;%PATH% + set INCLUDE=<base_dir>\include;<base_dir>\tcltk\include;%INCLUDE% + set LIB=<base_dir>\lib;<base_dir>\tcltk\lib;%LIB% -Now you should be good to go. Read on for more information. +Now you should be good to go. Read on for more information. The Boehm garbage collector ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -109,11 +109,10 @@ The bz2 compression library ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Download http://bzip.org/1.0.5/bzip2-1.0.5.tar.gz and extract it in -the base directory. Then compile:: - - cd bzip2-1.0.5 + svn export http://svn.python.org/projects/external/bzip2-1.0.6 + cd bzip2-1.0.6 nmake -f makefile.msc + copy bzip.dll <somewhere in the PATH>\bzip.dll The sqlite3 database library ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -122,8 +121,6 @@ wrapper is compiled when the module is imported for the first time. The sqlite3.dll should be version 3.6.21 for CPython2.7 compatablility. - - The expat XML parser ~~~~~~~~~~~~~~~~~~~~ @@ -146,13 +143,33 @@ use the one distributed by ActiveState, or the one from cygwin. In both case the perl interpreter must be found on the PATH. -Get http://www.openssl.org/source/openssl-0.9.8k.tar.gz and extract it -in the base directory. Then compile:: - + svn export http://svn.python.org/projects/external/openssl-0.9.8y + cd openssl-0.9.8y perl Configure VC-WIN32 ms\do_ms.bat nmake -f ms\nt.mak install +TkInter module support +~~~~~~~~~~~~~~~~~~~~~~ + +Note that much of this is taken from the cpython build process. +Tkinter is imported via cffi, so the module is optional. To recreate the tcltk +directory found for the release script, create the dlls, libs, headers and +runtime by running:: + + svn export http://svn.python.org/projects/external/tcl-8.5.2.1 tcl85 + svn export http://svn.python.org/projects/external/tk-8.5.2.0 tk85 + cd tcl85\win + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=0 INSTALLDIR=..\..\tcltk clean all + nmake -f makefile.vc DEBUG=0 INSTALLDIR=..\..\tcltk install + cd ..\..\tk85\win + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl85 clean all + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl85 install + +Now you should have a tcktk\bin, tcltk\lib, and tcltk\include directory ready +for use. The release packaging script will pick up the tcltk runtime in the lib +directory and put it in the archive. + Using the mingw compiler ------------------------ diff --git a/pypy/tool/release/package.py b/pypy/tool/release/package.py --- a/pypy/tool/release/package.py +++ b/pypy/tool/release/package.py @@ -67,18 +67,22 @@ 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)] @@ -101,9 +105,7 @@ # 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) @@ -122,6 +124,19 @@ # 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. _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit