]> granicus.if.org Git - python/commitdiff
New batch of patches by Jeff Rush; moved his readme.txt portion here.
authorGuido van Rossum <guido@python.org>
Fri, 5 Dec 1997 22:07:14 +0000 (22:07 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 5 Dec 1997 22:07:14 +0000 (22:07 +0000)
PC/os2vacpp/config.c
PC/os2vacpp/config.h
PC/os2vacpp/getpathp.c
PC/os2vacpp/makefile
PC/os2vacpp/readme.txt [new file with mode: 0644]

index 5f7ad91d8199b025b6efc73887ecd34272c20a16..3e7adf9cedbe18826c99ce35b1ab290dd33e9912 100644 (file)
@@ -63,6 +63,7 @@ extern void inittime();
 extern void initthread();
 extern void initcStringIO();
 extern void initcPickle();
+extern void initpcre();
 #ifdef WIN32
 extern void initmsvcrt();
 #endif
@@ -113,6 +114,7 @@ struct _inittab _PyImport_Inittab[] = {
 #endif
         {"cStringIO", initcStringIO},
         {"cPickle", initcPickle},
+        {"pcre", initpcre},
 #ifdef WIN32
         {"msvcrt", initmsvcrt},
 #endif
index 19438f512d635d73796f031c65ab7993e42b2443..ad7626bb1bf5c8755ffb0215d51a24dc4294a610 100644 (file)
 /* Configuration Options for Finding Modules */
 #define PREFIX                 ""
 #define EXEC_PREFIX            ""
-//#define VPATH "."
-
-//#define PYTHONPATH PREFIX "/lib/python" VERSION DELIM \
-//                PREFIX "/lib/python" VERSION "/test" DELIM \
-//           EXEC_PREFIX "/lib/python" VERSION "/sharedmodules"
 
 /***************************************************/
 /*    32-Bit IBM VisualAge C/C++ v3.0 for OS/2     */
@@ -91,7 +86,7 @@
   #define PYCC_VACPP /* Define Indicator of C Compiler */
 
   /* Platform Filesystem */
-  #define PYTHONPATH ".;.\\lib;.\\lib\\plat-os2;.\\lib\\dos_8x3;.\\lib\\lib-tk"
+  #define PYTHONPATH ".;.\\lib;.\\lib\\plat-win;.\\lib\\dos-8x3;.\\lib\\lib-tk"
   #define DOSFILESYS /* OS/2 Uses the DOS File Naming Conventions */
   /* #define IMPORT_8x3_NAMES */
 
 /* #define WITH_READLINE 1 */
 
 /* Define if you have clock.  */
-/* #define HAVE_CLOCK */
+#define HAVE_CLOCK
 
 /* Define if you have ftime.  */
 #define HAVE_FTIME
 /* #undef HAVE_TCSETPGRP */
 
 /* Define if you have times.  */
-/* #undef HAVE_TIMES */
+#define HAVE_TIMES
 
 /* Define if you have uname.  */
 /* #undef HAVE_UNAME */
index 2cfba16fff57d522c07e7d9d99d6d99a31bf6e06..69e38cb814f0499652286ad20e9df873e0dbb5e7 100644 (file)
@@ -50,7 +50,11 @@ extern BOOL PyWin_IsWin32s();
 
 /* Search in some common locations for the associated Python libraries.
  *
- * This version always returns "" for both prefix and exec_prefix.
+ * Two directories must be found, the platform independent directory
+ * (prefix), containing the common .py and .pyc files, and the platform
+ * dependent directory (exec_prefix), containing the shared library
+ * modules.  Note that prefix and exec_prefix can be the same directory,
+ * but for some installations, they are different.
  *
  * Py_GetPath() tries to return a sensible Python module search path.
  *
@@ -75,6 +79,7 @@ extern BOOL PyWin_IsWin32s();
 #endif
 
 static char prefix[MAXPATHLEN+1];
+static char exec_prefix[MAXPATHLEN+1];
 static char progpath[MAXPATHLEN+1];
 static char *module_search_path = NULL;
 
@@ -345,9 +350,21 @@ calculate_path()
                else
                        pythonhome = NULL;
        }
-       else
+       else {
+        char *delim;
+
                strcpy(prefix, pythonhome);
 
+        /* Extract Any Optional Trailing EXEC_PREFIX */
+        /* e.g. PYTHONHOME=<prefix>:<exec_prefix>   */
+        delim = strchr(prefix, DELIM);
+        if (delim) {
+            *delim = '\0';
+            strcpy(exec_prefix, delim+1);
+        } else
+            strcpy(exec_prefix, EXEC_PREFIX);
+    }
+
        if (envpath && *envpath == '\0')
                envpath = NULL;
 
@@ -475,7 +492,10 @@ Py_GetPrefix()
 char *
 Py_GetExecPrefix()
 {
-       return Py_GetPrefix();
+       if (!module_search_path)
+               calculate_path();
+
+       return exec_prefix;
 }
 
 char *
index cecbe9681640515f5347c98a3bdb9598a322313c..d609d50bc7753d9886b4c2779d7ba45564729133 100644 (file)
@@ -165,6 +165,9 @@ MODULES             =                              \
                   $(PATHOBJ)\MD5Module.obj     \
                   $(PATHOBJ)\NewModule.obj     \
                   $(PATHOBJ)\Operator.obj      \
+                  $(PATHOBJ)\PCREModule.obj    \
+                  $(PATHOBJ)\PyPCRE.obj        \
+                  $(PATHOBJ)\RotorModule.obj   \
                   $(PATHOBJ)\PosixModule.obj   \
                   $(PATHOBJ)\RegexModule.obj   \
                   $(PATHOBJ)\RegExpr.obj       \
@@ -197,7 +200,7 @@ _BASE               = /Q /W2 /I$(PROJINCLUDE)
                # /Q   = Omit IBM Copyright
                # /W2  = Show Warnings/Errors Only
 
-_GEN           = /G4 /Gm /Gd
+_GEN           = /G4 /Gm /Gd-
                # /G4  = Generate Code for 486 (Use 386 for Debugger)
                # /Gm  = Use Multithread Runtime
                # /Gd  = Dynamically Load Runtime
@@ -208,7 +211,8 @@ _OPT                = /O /Gl
                # /Gu  = Advise Linker All Ext Data is ID'd
                # /Gl  = Have Linker Remove Unused Fns
 
-_DBG           = /DHAVE_CONFIG_H /DUSE_SOCKET
+_DBG           = /Wpro- /Ti- /DHAVE_CONFIG_H /DUSE_SOCKET
+                # /Wpro= Generate Compiler Warnings re Missing Prototypes
                # /Ti  = Embed Debugger/Analyzer Recs
                # /Tm  = Enable Debug Memory Fns
                # /Tx  = Request Full Dump Upon Exception
diff --git a/PC/os2vacpp/readme.txt b/PC/os2vacpp/readme.txt
new file mode 100644 (file)
index 0000000..f805232
--- /dev/null
@@ -0,0 +1,114 @@
+IBM VisualAge C/C++ for OS/2\r
+============================\r
+\r
+To build Python for OS/2, change into ./os2vacpp and issue an 'NMAKE'\r
+command.  This will build a PYTHON15.DLL containing the set of Python\r
+modules listed in config.c and a small PYTHON.EXE to start the\r
+interpreter.\r
+\r
+By changing the C compiler flag /Gd- in the makefile to /Gd+, you can\r
+reduce the size of these by causing Python to dynamically link to the\r
+C runtime DLLs instead of including their bulk in your binaries. \r
+However, this means that any system on which you run Python must have\r
+the VAC++ compiler installed in order to have those DLLs available.\r
+\r
+During the build process you may see a couple of harmless warnings:\r
+\r
+  From the C Compiler, "No function prototype given for XXX", which\r
+  comes from the use of K&R parameters within Python for portability.\r
+\r
+  From the ILIB librarian, "Module Not Found (XXX)", which comes\r
+  from its attempt to perform the (-+) operation, which removes and\r
+  then adds a .OBJ to the library.  The first time a build is done,\r
+  it obviously cannot remove what is not yet built.\r
+\r
+This build includes support for most Python functionality as well as\r
+TCP/IP sockets.  It omits the Posix ability to 'fork' a process but\r
+supports threads using OS/2 native capabilities.  I have tried to\r
+support everything possible but here are a few usage notes.\r
+\r
+\r
+-- os.popen() Usage Warnings\r
+\r
+With respect to my implementation of popen() under OS/2:\r
+\r
+    import os\r
+\r
+    fd = os.popen("pkzip.exe -@ junk.zip", 'wb')\r
+    fd.write("file1.txt\n")\r
+    fd.write("file2.txt\n")\r
+    fd.write("file3.txt\n")\r
+    fd.write("\x1a")  # Should Not Be Necessary But Is\r
+    fd.close()\r
+\r
+There is a bug, either in the VAC++ compiler or OS/2 itself, where the\r
+simple closure of the write-side of a pipe -to- a process does not\r
+send an EOF to that process.  I find I must explicitly write a\r
+control-Z (EOF) before closing the pipe.  This is not a problem when\r
+using popen() in read mode.\r
+\r
+One other slight difference with my popen() is that I return None\r
+from the close(), instead of the Unix convention of the return code\r
+of the spawned program.  I could find no easy way to do this under\r
+OS/2.\r
+\r
+\r
+-- BEGINLIBPATH/ENDLIBPATH\r
+\r
+With respect to environment variables, this OS/2 port supports the\r
+special-to-OS/2 magic names of 'BEGINLIBPATH' and 'ENDLIBPATH' to\r
+control where to load conventional DLLs from.  Those names are\r
+intercepted and converted to calls on the OS/2 kernel APIs and\r
+are inherited by child processes, whether Python-based or not.\r
+\r
+A few new attributes have been added to the os module:\r
+\r
+    os.meminstalled  # Count of Bytes of RAM Installed on Machine\r
+    os.memkernel     # Count of Bytes of RAM Reserved (Non-Swappable)\r
+    os.memvirtual    # Count of Bytes of Virtual RAM Possible\r
+    os.timeslice     # Duration of Scheduler Timeslice, in Milliseconds\r
+    os.maxpathlen    # Maximum Length of a Path Specification, in chars\r
+    os.maxnamelen    # Maximum Length of a Single Dir/File Name, in chars\r
+    os.version       # Version of OS/2 Being Run e.g. "4.00"\r
+    os.revision      # Revision of OS/2 Being Run (usually zero)\r
+    os.bootdrive     # Drive that System Booted From e.g. "C:"\r
+                     # (useful to find the CONFIG.SYS used to boot with)\r
+\r
+\r
+-- Using Python as the Default OS/2 Batch Language\r
+\r
+Note that OS/2 supports the Unix technique of putting the special\r
+comment line at the time of scripts e.g. "#!/usr/bin/python" in\r
+a different syntactic form.  To do this, put your script into a file\r
+with a .CMD extension and added 'extproc' to the top as follows:\r
+\r
+    extproc C:\Python\Python.exe -x\r
+    import os\r
+    print "Hello from Python"\r
+\r
+The '-x' option tells Python to skip the first line of the file\r
+while processing the rest as normal Python source.\r
+\r
+\r
+-- Suggested Environment Variable Setup\r
+\r
+With respect to the environment variables for Python, I use the\r
+following setup:\r
+\r
+    Set PYTHONHOME=E:\Tau\Projects\Python;D:\DLLs\r
+    Set PYTHONPATH=.;E:\Tau\Projects\Python\Lib; \\r
+                     E:\Tau\Projects\Python\Lib\plat-win\r
+\r
+The EXEC_PREFIX (optional second pathspec on PYTHONHOME) is where\r
+you put any Python extension DLLs you may create/obtain.  There\r
+are none provided with this release.\r
+\r
+\r
+-- Contact Info\r
+\r
+If you have questions, suggestions or problems specifically with\r
+the OS/2 VAC++ port of Python, please contact me at:\r
+\r
+    Jeff Rush <jrush@summit-research.com>.\r
+\r
+I support no other platform but OS/2 (and eventually AmigaDOS).\r