PageRenderTime 313ms CodeModel.GetById 130ms app.highlight 2ms RepoModel.GetById 179ms app.codeStats 0ms

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