1 This is a port of Python 2.3 to OS/2 using the EMX development tools
2 =========================================================================
4 What's new since the previous release
5 -------------------------------------
7 This release of the port incorporates the following changes from the
8 December 24, 2001 release of the Python 2.2 port:
10 - based on the Python v2.3 final release source.
13 Licenses and info about Python and EMX
14 --------------------------------------
16 Please read the file README.Python-2.3 included in this package for
17 information about Python 2.3. This file is the README file from the
18 Python 2.3 source distribution available via http://www.python.org/
19 and its mirrors. The file LICENCE.Python-2.3 is the text of the Licence
20 from the Python 2.3 source distribution.
22 Note that the EMX package that this package depends on is released under
23 the GNU General Public Licence. Please refer to the documentation
24 accompanying the EMX Runtime libraries for more information about the
25 implications of this. A copy of version 2 of the GPL is included as the
28 Readline and GDBM are covered by the GNU General Public Licence. I think
29 Eberhard Mattes' porting changes to BSD DB v1.85 are also GPL'ed (BSD DB
30 itself is BSD Licenced). ncurses and expat appear to be covered by MIT
31 style licences - please refer to the source distributions for more detail.
32 zlib is distributable under a very free license. GNU MP and GNU UFC are
33 under the GNU LGPL (see file COPYING.lib).
35 My patches to the Python-2.x source distributions, and any other packages
36 used in this port, are placed in the public domain.
38 This software is provided 'as-is', without any express or implied warranty.
39 In no event will the author be held liable for any damages arising from the
42 I do hope however that it proves useful to someone.
48 There have been ports of previous versions of Python to OS/2.
50 The best known would be that by Jeff Rush, most recently of version
51 1.5.2. Jeff used IBM's Visual Age C++ (v3) for his ports, and his
52 patches have been included in the Python 2.3 source distribution.
54 Andrew Zabolotny implemented a port of Python v1.5.2 using the EMX
55 development tools. His patches against the Python v1.5.2 source
56 distribution have become the core of this port, and without his efforts
57 this port wouldn't exist. Andrew's port also appears to have been
58 compiled with his port of gcc 2.95.2 to EMX, which I have but have
59 chosen not to use for the binary distribution of this port (see item 21
60 of the "YOU HAVE BEEN WARNED" section below).
62 Previous Python port releases by me:-
63 - v2.0 on March 31, 2001;
64 - v2.0 on April 25, 2001 (cleanup release + Stackless variant);
65 - v2.1 on June 17, 2001;
66 - v2.0 (Stackless re-release) on June 18, 2001.
67 - v2.1.1 on August 5, 2001;
68 - v2.1.1 on August 12, 2001 (cleanup release);
69 - v2.1.1 (updated DLL) on August 14, 2001.
70 - v2.2b2 on December 8, 2001 (not uploaded to archive sites)
71 - v2.2c1 on December 16, 2001 (not uploaded to archive sites)
72 - v2.2 on December 24, 2001
74 It is possible to have these earlier ports still usable after installing
75 this port - see the README.os2emx.multiple_versions file, contributed by
76 Dr David Mertz, for a suggested approach to achieving this.
82 This package requires the EMX Runtime package, available from the
83 Hobbes (http://hobbes.nmsu.edu/) and LEO (http://archiv.leo.org/)
84 archives of OS/2 software. I have used EMX version 0.9d fix04 in
87 My development system is running OS/2 v4 with fixpack 12.
89 3rd party software which has been linked into dynamically loaded modules:
90 - ncurses (see http://dickey.his.com/ for more info, v5.2)
91 - GNU Readline (Kai Uwe Rommel's port available from Hobbes or LEO, v2.1)
92 - GNU GDBM (Kai Uwe Rommel's port available from Hobbes or LEO, v1.7.3)
93 - zlib (Hung-Chi Chu's port available from Hobbes or LEO, v1.1.3)
94 - expat (from ftp://ftp.jclark.com/pub/xml/, v1.2)
95 - GNU MP (Peter Meerwald's port available from LEO, v2.0.2)
96 - GNU UFC (Kai Uwe Rommel's port available from LEO, v2.0.4)
98 The zlib module requires the Z.DLL to be installed - see the Installation
99 section and item 12 of the "YOU HAVE BEEN WARNED" section for more
105 I have attempted to make this port as complete and functional as I can,
106 notwithstanding the issues in the "YOU HAVE BEEN WARNED" section below.
110 Python.exe is linked as an a.out executable, ie using EMX method E1
111 to compile & link the executable. This is so that fork() works (see
112 "YOU HAVE BEEN WARNED" item 2).
114 Python23.dll is created as a normal OMF DLL, with an OMF import
115 library and module definition file. There is also an a.out (.a) import
116 library to support linking the DLL to a.out executables.
118 This port has been built with complete support for multithreading.
122 As far as possible, extension modules have been made dynamically loadable
123 when the module is intended to be built this way. I haven't yet changed
124 the building of Python's standard modules over to using the DistUtils.
126 See "YOU HAVE BEEN WARNED" item 5 for notes about the fcntl module, and
127 "YOU HAVE BEEN WARNED" item 14 for notes about the pwd and grp modules.
129 Support for case sensitive module import semantics has been added to match
130 the Windows release. This can be deactivated by setting the PYTHONCASEOK
131 environment variable (the value doesn't matter) - see "YOU HAVE BEEN WARNED"
136 Where I've been able to locate the required 3rd party packages already
137 ported to OS/2, I've built and included them.
139 These include ncurses (_curses, _curses_panel), BSD DB (bsddb),
140 GNU GDBM (gdbm, dbm), zlib (zlib), GNU Readline (readline), expat
141 (pyexpat), GNU MP (mpz) and GNU UFC (crypt).
143 I have built these modules statically linked against the 3rd party
144 libraries, with the exception of zlib. Unfortunately my attempts to use
145 the dll version of GNU readline have been a dismal failure, in that when
146 the dynamically linked readline module is active other modules
147 immediately provoke a core dump when imported.
149 Only the BSD DB package (part of the BSD package distributed with EMX)
150 needed source modifications to be used for this port, pertaining to use
151 of errno with multithreading.
153 The other packages, except for ncurses and zlib, needed Makefile changes
154 for multithreading support but no source changes.
156 The _curses_panel module is a potential problem - see "YOU HAVE BEEN
159 Upstream source patches:
161 No updates to the Python 2.3 release have become available.
163 Eberhard Mattes' EMXFIX04 update to his EMX 0.9d tools suite includes
164 bug fixes for the BSD DB library. The bsddb module included in this
165 port incorporates these fixes.
167 Library and other distributed Python code:
169 The Python standard library lives in the Lib directory. All the standard
170 library code included with the Python 2.3 source distribution is included
171 in the binary archive, with the exception of the dos-8x3 and tkinter
172 subdirectories which have been omitted to reduce the size of the binary
173 archive - the dos-8x3 components are unnecessary duplicates and Tkinter
174 is not supported by this port (yet). All the plat-* subdirectories in the
175 source distribution have also been omitted, and a plat-os2emx directory
178 The Tools and Demo directories contain a collection of Python scripts.
179 To reduce the size of the binary archive, the Demo/sgi, Demo/Tix,
180 Demo/tkinter, Tools/audiopy and Tools/IDLE subdirectories have been
181 omitted as not being supported by this port. The Misc directory has
184 All subdirectories omitted from the binary archive can be reconstituted
185 from the Python 2.3 source distribution, if desired.
187 Support for building Python extensions:
189 The Config subdirectory contains the files describing the configuration
190 of the interpreter and the Makefile, import libraries for the Python DLL,
191 and the module definition file used to create the Python DLL. The
192 Include subdirectory contains all the standard Python header files
193 needed for building extensions.
195 As I don't have the Visual Age C++ compiler, I've made no attempt to
196 have this port support extensions built with that compiler.
202 This port is packaged into several archives:
203 - python-2.3-os2emx-bin-02????.zip (binaries, library modules)
204 - python-2.3-os2emx-src-03????.zip (source patches and makefiles)
206 Documentation for the Python language, as well as the Python 2.3
207 source distibution, can be obtained from the Python website
208 (http://www.python.org/) or the Python project pages at Sourceforge
209 (http://sf.net/projects/python/).
215 Obtain and install, as per the included instructions, the EMX runtime
218 If you wish to use the zlib module, you will need to obtain and install
219 the Z.DLL from Hung-Chi Chu's port of zlib v1.1.3 (zlib113.zip). See also
220 "YOU HAVE BEEN WARNED" item 12 below.
222 Unpack this archive, preserving the subdirectories, in the root directory
223 of the drive where you want Python to live.
225 Add the Python directory (eg C:\Python23) to the PATH and LIBPATH
226 variables in CONFIG.SYS.
228 You should then set the PYTHONHOME and PYTHONPATH environment variables
231 PYTHONHOME should be set to Python's top level directory. PYTHONPATH
232 should be set to the semicolon separated list of principal Python library
235 SET PYTHONHOME=F:/Python23
236 SET PYTHONPATH=F:/Python23/Lib;F:/Python23/Lib/plat-os2emx;
237 F:/Python23/Lib/lib-dynload;F:/Python23/Lib/site-packages
239 NOTE!: the PYTHONPATH setting above is linewrapped for this document - it
240 should all be on one line in CONFIG.SYS!
242 If you wish to use the curses module, you should set the TERM and TERMINFO
243 environment variables appropriately.
245 If you don't already have ncurses installed, I have included a copy of the
246 EMX subset of the Terminfo database included with the ncurses-5.2 source
247 distribution. This can be used by setting the TERMINFO environment variable
248 to the path of the Terminfo subdirectory below the Python home directory.
249 On my system this looks like:
250 SET TERMINFO=F:/Python23/Terminfo
252 For the TERM environment variable, I would try one of the following:
257 You will have to reboot your system for these changes to CONFIG.SYS to take
260 If you wish to compile all the included Python library modules to bytecode,
261 you can change into the Python home directory and run the COMPILEALL.CMD
264 You can execute the regression tests included with the Python 2.3 source
265 distribution by changing to the Python 2.3 home directory and executing the
266 REGRTEST.CMD batch file. The following tests are known to fail at this
268 - test_longexp (see "YOU HAVE BEEN WARNED" item 1);
269 - test_mhlib (I don't know of any port of MH to OS/2);
270 - test_pwd (see "YOU HAVE BEEN WARNED" item 14, probably a bug in my code);
271 - test_grp (as per test_pwd);
272 - test_strftime (see "YOU HAVE BEEN WARNED" item 20);
273 - test_socketserver (fork() related, see "YOU HAVE BEEN WARNED" item 2).
276 YOU HAVE BEEN WARNED!!
277 ----------------------
279 I know about a number of nasties in this port.
281 1. EMX's malloc() and/or the underlying OS/2 VM system aren't particularly
282 comfortable with Python's use of heap memory. The test_longexp regression
283 test exhausts the available swap space on a machine with 64MB of RAM with
284 150MB of available swap space.
286 Using a crudely instrumented wrapper around malloc()/realloc()/free(), the
287 heap memory usage of the expression at the core of the test
288 (eval('[' + '2,' * NUMREPS + ']')) is as follows (approximately):
290 NUMREPS = 10000 => 22MB
291 NUMREPS = 20500 => 59MB
293 I don't even have enough memory to try for NUMREPS = 25000 :-(, let alone
294 the NUMREPS = 65580 in test_longexp! I do have a report that the test
295 succeeds in the presence of sufficient memory (~200MB RAM).
297 During the course of running the test routine, the Python parser
298 allocates lots of 21 byte memory chunks, each of which is actually
299 a 64 byte allocation. There are a smaller number of 3 byte allocations
300 which consume 12 bytes each. Consequently, more than 3 times as much
301 memory is allocated than is actually used.
303 The Python Object Allocator code (PyMalloc) was introduced in Python 2.1
304 for Python's core to be able to wrap the malloc() system to deal with
305 problems with "unfriendly" malloc() behaviour, such as this. Unfortunately
306 for the OS/2 port, it is only supported for the allocation of memory for
307 objects, whereas my research into this problem indicates it is the parser
308 which is source of this particular malloc() frenzy.
310 I have attempted using PyMalloc to manage all of Python's memory
311 allocation. While this works fine (modulo the socket regression test
312 failing in the absence of a socket.pyc), it is a significant performance
313 hit - the time to run the regression test blows out from ~3.5 minutes to
314 ~5.75 minutes on my system.
316 I therefore don't plan to pursue this any further for the time being.
318 Be aware that certain types of expressions could well bring your system
319 to its knees as a result of this issue. I have modified the longexp test
320 to report failure to highlight this.
322 2. Eberhard Mattes, author of EMX, writes in his documentation that fork()
323 is very inefficient in the OS/2 environment. It also requires that the
324 executable be linked in a.out format rather than OMF. Use the os.exec
325 and/or the os.spawn family of functions where possible.
327 {3. Issue resolved...}
329 4. In the absence of GNU Readline, terminating the interpreter requires a
330 control-Z (^Z) followed by a carriage return. Jeff Rush documented this
331 problem in his Python 1.5.2 port. With Readline, a control-D (^D) works
332 as per the standard Unix environment.
334 5. EMX only has a partial implementation of fcntl(). The fcntl module
335 in this port supports what EMX supports. If fcntl is important to you,
336 please review the EMX C Library Reference (included in .INF format in the
337 EMXVIEW.ZIP archive as part of the complete EMX development tools suite).
338 Because of other side-effects I have modified the test_fcntl.py test
339 script to deactivate the exercising of the missing functionality.
341 6. The BSD DB module is linked against DB v1.85. This version is widely
342 known to have bugs, although some patches have become available (and are
343 incorporated into the included bsddb module). Unless you have problems
344 with software licenses which would rule out GDBM (and the dbm module
345 because it is linked against the GDBM library) or need it for file format
346 compatibility, you may be better off deleting it and relying on GDBM. I
347 haven't looked at porting the version of the module supporting the later
348 SleepyCat releases of BSD DB, which would also require a port of the
349 SleepyCat DB package.
351 7. The readline module has been linked against ncurses rather than the
352 termcap library supplied with EMX.
354 {8. Workaround implemented}
356 9. I have configured this port to use "/" as the preferred path separator
357 character, rather than "\" ('\\'), in line with the convention supported
358 by EMX. Backslashes are still supported of course, and still appear in
359 unexpected places due to outside sources that don't get normalised.
361 10. While the DistUtils components are now functional, other
362 packaging/binary handling tools and utilities such as those included in
363 the Demo and Tools directories - freeze in particular - are unlikely to
364 work. If you do get them going, I'd like to know about your success.
366 11. I haven't set out to support the [BEGIN|END]LIBPATH functionality
367 supported by one of the earlier ports (Rush's??). If it works let me know.
369 12. There appear to be several versions of Z.DLL floating around - the one
370 I have is 45061 bytes and dated January 22, 1999. I have a report that
371 another version causes SYS3175s when the zlib module is imported.
373 14. As a result of the limitations imposed by EMX's library routines, the
374 standard extension module pwd only synthesises a simple passwd database,
375 and the grp module cannot be supported at all.
377 I have written substitutes, in Python naturally, which can process real
378 passwd and group files for those applications (such as MailMan) that
379 require more than EMX emulates. I have placed pwd.py and grp.py in
380 Lib/plat-os2emx, which is usually before Lib/lib-dynload (which contains
381 pwd.pyd) in the PYTHONPATH. If you have become attached to what pwd.pyd
382 supports, you can put Lib/lib-dynload before Lib/plat-os2emx in PYTHONPATH
383 or delete/rename pwd.py & grp.py.
385 pwd.py & grp.py support locating their data files by looking in the
386 environment for them in the following sequence:
387 pwd.py: $ETC_PASSWD (%ETC_PASSWD%)
388 $ETC/passwd (%ETC%/passwd)
389 $PYTHONHOME/Etc/passwd (%PYTHONHOME%/Etc/passwd)
390 grp.py: $ETC_GROUP (%ETC_GROUP%)
391 $ETC/group (%ETC%/group)
392 $PYTHONHOME/Etc/group (%PYTHONHOME%/Etc/group)
394 Both modules support using either the ":" character (Unix standard) or
395 ";" (OS/2, DOS, Windows standard) field separator character, and pwd.py
396 implements the following drive letter conversions for the home_directory and
397 shell fields (for the ":" separator only):
401 Example versions of passwd and group are in the Etc subdirectory. Note
402 that as of this release, this code fails the regression test. I'm looking
403 into why, and hope to have this fixed.
405 15. As of Python 2.1, termios support has mutated. There is no longer a
406 platform specific TERMIOS.py containing the symbolic constants - these
407 now live in the termios module. EMX's termios routines don't support all
408 of the functionality now exposed by the termios module - refer to the EMX
409 documentation to find out what is supported.
411 16. The case sensitive import semantics introduced in Python 2.1 for other
412 case insensitive but case preserving file/operating systems (Windows etc),
413 have been incorporated into this port, and are active by default. Setting
414 the PYTHONCASEOK environment variable (to any value) reverts to the
415 previous (case insensitive) semantics.
417 17. Because I am statically linking ncurses, the _curses_panel
418 module has potential problems arising from separate library data areas.
419 To avoid this, I have configured the _curses_.pyd (imported as
420 "_curses_panel") to import the ncurses symbols it needs from _curses.pyd.
421 As a result the _curses module must be imported before the _curses_panel
422 module. As far as I can tell, the modules in the curses package do this.
423 If you have problems attempting to use the _curses_panel support please
424 let me know, and I'll look into an alternative solution.
426 18. I tried enabling the Python Object Allocator (PYMALLOC) code. While
427 the port built this way passes the regression test, the Numpy extension
428 (I tested v19.0.0) as built with with the port's DistUtils code doesn't
429 work. Specifically, attempting to "import Numeric" provokes a core dump.
430 Supposedly Numpy v20.1.0 contains a fix for this, but for reason outlined
431 in item 1 above, PYMALLOC is not enabled in this release.
433 19. sys.platform now reports "os2emx" instead of "os2". os.name still
434 reports "os2". This change was to make it easier to distinguish between
435 the VAC++ build (being maintained by Michael Muller) and the EMX build
436 (this port), principally for DistUtils.
438 20. it appears that the %W substitution in the EMX strftime() routine has
439 an off-by-one bug. strftime was listed as passing the regression tests
440 in previous releases, but this fact appears to have been an oversight in
441 the regression test suite. To fix this really requires a portable
442 strftime routine - I'm looking into using one from FreeBSD, but its not
445 21. previous releases of my Python ports have used the GCC optimisations
446 "-O2 -fomit-frame-pointer". After experimenting with various optimisation
447 settings, including deactivating assert()ions, I have concluded that "-O2"
448 appears the best compromise for GCC 2.8.1 on my hardware. Curiously,
449 deactivating assert() (via defining NDEBUG) _negatively_ impacts
450 performance, allbeit only slightly, so I've chosen to leave the assert()s
453 I did try using Andrew Zabolotny's (p)gcc 2.95.2 compiler, and in
454 general concluded that it produced larger objects that ran slower
455 than Mattes' gcc 2.8.1 compiler.
457 Pystone ratings varied from just over 2000/s (no optimisation at all)
458 to just under 3300/s (gcc 2.8.1, -O2) on my K6/2-300 system, for
459 100,000 iterations per run (rather than the default 10000).
461 As a result of the optimisation change, the Python DLL is about 10%
462 smaller than in the 2.1 release, and many of the dynamically loadable
463 modules are smaller too.
467 22. As of this release, os.spawnv() and os.spawnve() now expose EMX's
468 library routines rather than use the emulation in os.py.
470 In order to make use of some of the features this makes available in
471 the OS/2 environment, you should peruse the relevant EMX documentation
472 (EMXLIB.INF in the EMXVIEW.ZIP archive accompanying the EMX archives
473 on Hobbes or LEO). Be aware that I have exposed all the "mode" options
474 supported by EMX, but there are combinations that either cannot be
475 practically used by/in Python or have the potential to compromise your
478 23. pythonpm.exe in previous releases was just python.exe with the
479 WINDOWAPI linker option set in the pythonpm.def file. In practice,
480 this turns out to do nothing useful.
482 I have written a replacement which wraps the Python DLL in a genuine
483 Presentation Manager application. This version actually runs the
484 Python interpreter in a separate thread from the PM shell, in order
485 that PythonPM has a functioning message queue as good PM apps should.
486 In its current state, PythonPM's window is hidden. It can be displayed,
487 although it will have no content as nothing is ever written to the
488 window. Only the "hide" button is available. Although the code
489 has support for shutting PythonPM down when the Python interpreter is
490 still busy (via the "control" menu), this is not well tested and given
491 comments I've come across in EMX documentation suggesting that the
492 thread killing operation has problems I would suggest caution in
493 relying on this capability.
495 PythonPM processes commandline parameters normally. The standard input,
496 output and error streams are only useful if redirected, as PythonPM's
497 window is not a console in any form and so cannot accept or display
498 anything. This means that the -i option is ineffective.
500 Because the Python thread doesn't create its own message queue, creating
501 PM Windows and performing most PM operations is not possible from within
502 this thread. How this will affect supporting PM extensions (such as
503 Tkinter using a PM port of Tcl/Tk, or wxPython using the PM port of
504 WxWindows) is still being researched.
506 Note that os.fork() _DOES_NOT_WORK_ in PythonPM - SYS3175s are the result
507 of trying. os.spawnv() _does_ work. PythonPM passes all regression tests
508 that the standard Python interpreter (python.exe) passes, with the exception
509 of test_fork1 and test_socket which both attempt to use os.fork().
511 I very much want feedback on the performance, behaviour and utility of
512 PythonPM. I would like to add a PM console capability to it, but that
513 will be a non-trivial effort. I may be able to leverage the code in
514 Illya Vaes' Tcl/Tk port, which would make it easier.
518 24. os.chdir() now uses EMX's _chdir2(), which supports changing
519 both drive and directory at once. Similarly, os.getcwd() now uses
520 EMX's _getcwd() which returns drive as well as path.
522 [2001/12/08] - 2.2 Beta 2
524 25. pyconfig.h (previously known as config.h) is now located in the
525 Include subdirectory with all other include files.
527 [2001/12/16] - 2.2 Release Candidate 1
529 [2001/12/08] - 2.2 Final
531 ... probably other issues that I've not encountered, or don't remember :-(
533 If you encounter other difficulties with this port, which can be
534 characterised as peculiar to this port rather than to the Python release,
535 I would like to hear about them. However I cannot promise to be able to do
536 anything to resolve such problems. See the Contact section below...
542 In no particular order of apparent importance or likelihood...
544 - support Tkinter and/or alternative GUI (wxWindows??)
550 In addition to people identified above, I'd like to thank:
551 - the BDFL, Guido van Rossum, and crew for Python;
552 - Dr David Mertz, for trying out a pre-release of this port;
553 - the Python-list/comp.lang.python community;
554 - John Poltorak, for input about pwd/grp.
559 Constructive feedback, negative or positive, about this port is welcome
560 and should be addressed to me at the e-mail addresses below.
562 I intend creating a private mailing list for announcements of fixes &
563 updates to this port. If you wish to receive such e-mail announcments,
564 please send me an e-mail requesting that you be added to this list.
567 E-mail: andymac@bullseye.apana.org.au, or andymac@pcug.org.au
568 Web: http://www.andymac.org/