/PC/os2vacpp/readme.txt

http://unladen-swallow.googlecode.com/ · Plain Text · 119 lines · 85 code · 34 blank · 0 comment · 0 complexity · ea1a7851685cc43524a71cffced92a3a MD5 · raw file

  1. IBM VisualAge C/C++ for OS/2
  2. ============================
  3. To build Python for OS/2, change into ./os2vacpp and issue an 'NMAKE'
  4. command. This will build a PYTHON15.DLL containing the set of Python
  5. modules listed in config.c and a small PYTHON.EXE to start the
  6. interpreter.
  7. By changing the C compiler flag /Gd- in the makefile to /Gd+, you can
  8. reduce the size of these by causing Python to dynamically link to the
  9. C runtime DLLs instead of including their bulk in your binaries.
  10. However, this means that any system on which you run Python must have
  11. the VAC++ compiler installed in order to have those DLLs available.
  12. During the build process you may see a couple of harmless warnings:
  13. From the C Compiler, "No function prototype given for XXX", which
  14. comes from the use of K&R parameters within Python for portability.
  15. From the ILIB librarian, "Module Not Found (XXX)", which comes
  16. from its attempt to perform the (-+) operation, which removes and
  17. then adds a .OBJ to the library. The first time a build is done,
  18. it obviously cannot remove what is not yet built.
  19. This build includes support for most Python functionality as well as
  20. TCP/IP sockets. It omits the Posix ability to 'fork' a process but
  21. supports threads using OS/2 native capabilities. I have tried to
  22. support everything possible but here are a few usage notes.
  23. -- os.popen() Usage Warnings
  24. With respect to my implementation of popen() under OS/2:
  25. import os
  26. fd = os.popen("pkzip.exe -@ junk.zip", 'wb')
  27. fd.write("file1.txt\n")
  28. fd.write("file2.txt\n")
  29. fd.write("file3.txt\n")
  30. fd.write("\x1a") # Should Not Be Necessary But Is
  31. fd.close()
  32. There is a bug, either in the VAC++ compiler or OS/2 itself, where the
  33. simple closure of the write-side of a pipe -to- a process does not
  34. send an EOF to that process. I find I must explicitly write a
  35. control-Z (EOF) before closing the pipe. This is not a problem when
  36. using popen() in read mode.
  37. One other slight difference with my popen() is that I return None
  38. from the close(), instead of the Unix convention of the return code
  39. of the spawned program. I could find no easy way to do this under
  40. OS/2.
  41. -- BEGINLIBPATH/ENDLIBPATH
  42. With respect to environment variables, this OS/2 port supports the
  43. special-to-OS/2 magic names of 'BEGINLIBPATH' and 'ENDLIBPATH' to
  44. control where to load conventional DLLs from. Those names are
  45. intercepted and converted to calls on the OS/2 kernel APIs and
  46. are inherited by child processes, whether Python-based or not.
  47. A few new attributes have been added to the os module:
  48. os.meminstalled # Count of Bytes of RAM Installed on Machine
  49. os.memkernel # Count of Bytes of RAM Reserved (Non-Swappable)
  50. os.memvirtual # Count of Bytes of Virtual RAM Possible
  51. os.timeslice # Duration of Scheduler Timeslice, in Milliseconds
  52. os.maxpathlen # Maximum Length of a Path Specification, in chars
  53. os.maxnamelen # Maximum Length of a Single Dir/File Name, in chars
  54. os.version # Version of OS/2 Being Run e.g. "4.00"
  55. os.revision # Revision of OS/2 Being Run (usually zero)
  56. os.bootdrive # Drive that System Booted From e.g. "C:"
  57. # (useful to find the CONFIG.SYS used to boot with)
  58. -- Using Python as the Default OS/2 Batch Language
  59. Note that OS/2 supports the Unix technique of putting the special
  60. comment line at the time of scripts e.g. "#!/usr/bin/python" in
  61. a different syntactic form. To do this, put your script into a file
  62. with a .CMD extension and added 'extproc' to the top as follows:
  63. extproc C:\Python\Python.exe -x
  64. import os
  65. print "Hello from Python"
  66. The '-x' option tells Python to skip the first line of the file
  67. while processing the rest as normal Python source.
  68. -- Suggested Environment Variable Setup
  69. With respect to the environment variables for Python, I use the
  70. following setup:
  71. Set PYTHONHOME=E:\Tau\Projects\Python;D:\DLLs
  72. Set PYTHONPATH=.;E:\Tau\Projects\Python\Lib; \
  73. E:\Tau\Projects\Python\Lib\plat-win
  74. The EXEC_PREFIX (optional second pathspec on PYTHONHOME) is where
  75. you put any Python extension DLLs you may create/obtain. There
  76. are none provided with this release.
  77. -- Contact Info
  78. Jeff Rush is no longer supporting the VACPP port :-(
  79. I don't have the VACPP compiler, so can't reliably maintain this port.
  80. Anyone with VACPP who can contribute patches to keep this port buildable
  81. should upload them to the Python Patch Manager at Sourceforge and
  82. assign them to me for review/checkin.
  83. Andrew MacIntyre
  84. aimacintyre at users.sourceforge.net
  85. August 18, 2002.