(PYVMS LOGO) Python on OpenVMS

This page describes the steps to build Python V1.5.1 on OpenVMS.


get the necessary software

the Python distribution is available at:

ftp://ftp.python.org/ftp/python/src/pyth151.tgz
or from one of the mirror sites. Don't forget to do a 'binary' transfer! Store the file as 'PYTHON1_5_1.TAR-GZ' on your OpenVMS system.

The Python documentation is there, too. Please access http://www.python.org/ for downloading.

get the PYVMS distribution from:

ftp://ftp.python.org/pub/python/vms/pyvms1.5.1-v001src.zip
Don't forget to do a 'binary' transfer! Store the file as 'PYVMS1_5_1-V001SRC.ZIP' on your OpenVMS system.

you also need the following tools...

...to extract the files from 'PYTHON1_5_1.TAR-GZ' and 'PYVMS1_5_1-V001SRC.ZIP': Sources are listed on the tools page and not repeated here.

create the root directory and restore the Python distribution

This example assumes that the tree will be stored on a disk named 'DKA100:'. It also assumes that the files 'PYTHON1_5_1.TAR-GZ', 'PYVMS1_5_1-V001SRC.ZIP' and the necessary tools (GZIP.EXE, UNZIP.EXE + VMSTAR.EXE) have been stored at 'DKB100:[000000]'.
$! -- create top-level directory
$ SET DEFAULT DKA100:[PYTHON]
$ CREATE /DIRECTORY /OWNER=[1,4] /PROTECTION=(G:RE,W:RE) /LOG []
$!
$! -- define foreign command for GZIP
$ gzip = "$DKB100:[000000]GZIP.EXE"
$!
$! -- extract/decompress TapeARchive from GZIPped file
$ DEFINE /USER_MODE SYS$OUTPUT DKB100:[000000]PYTHON1_5_1.TAR
$ gzip -d -c DKB100:[000000]PYTHON1_5_1.TAR-GZ
$!
$! -- remove definition
$ DELETE /SYMBOL/LOCAL gzip
$!
$! -- define foreign command for VMSTAR
$ vmstar = "$DKA100:[000000]VMSTAR.EXE"
$!
$! -- list contents of TapeARchive
$ DEFINE /USER_MODE SYS$OUTPUT PYTHON1_5_1.LIS
$ vmstar tf DKB100:[000000]PYTHON1_5_1.TAR
$!
$! -- extract files from TapeARchive and restore directory tree
$ SET PROTECTION= (S:RWED,O:RWED,G:RE,W:RE) /DEFAULT
$ DEFINE /USER_MODE SYS$OUTPUT PYTHON1_5_1.UNTAR
$ vmstar xvf DKB100:[000000]PYTHON1_5_1.TAR
$!
$! -- remove definition
$ DELETE /SYMBOL/LOCAL vmstar
$!
$! -- delete the TapeARchive - please keep PYTHON1_5_1.TAR-GZ
$ DELETE /LOG DKB100:[000000]PYTHON1_5_1.TAR;*
$!
$! -- make all files readable to all users
$ SET FILE /PROTECTION=(G:RE,W:RE) /OWNER=[1,4] [PYTHON...]*.* /LOG
$!
$! -- Note: some versions of VMSTAR restore the tree as:
$! -- [PYTHON.PYTHON-1.5.1...] instead of [PYTHON.PYTHON-1_5_1]
$! -- The fix is to enter the following two commands:
$     rename [PYTHON.PYTHON-1.5]1.DIR [PYTHON]PYTHON-1_5_1
$     delete [PYTHON.PYTHON-1]5.DIR;1,[PYTHON]PYTHON-1.DIR;1
$!
$! -- correct file specifications
$     edit/edt [PYTHON]PYTHON1_5_1.UNTAR
* substitute/PYTHON.PYTHON-1.5.1/PYTHON.PYTHON-1_5_1/%whole/notype
* exit
$     purge [PYTHON]PYTHON1_5_1.UNTAR
$!

create additional directories

The intention is to keep the original directories as much unchanged as possible.
$ SET DEFAULT DKA100:[PYTHON.PYTHON-1_5_1.VMS]
$ CREDIR = "CREATE/DIRECTORY/OWNER=[1,4]/PROTECTION=(G:RE,W:RE)/LOG"
$!
$ CREDIR []
$ CREDIR [.O_ALPHA.MODULES]
$ CREDIR [.O_ALPHA.OBJECTS]
$ CREDIR [.O_ALPHA.PARSER]
$ CREDIR [.O_ALPHA.PYTHON]
$ CREDIR [.O_ALPHA.VMS]
$ CREDIR [.O_ALPHA.VMS_TOOLS]
$ CREDIR [.O_VAX.MODULES]
$ CREDIR [.O_VAX.OBJECTS]
$ CREDIR [.O_VAX.PARSER]
$ CREDIR [.O_VAX.PYTHON]
$ CREDIR [.O_VAX.VMS]
$ CREDIR [.O_VAX.VMS_TOOLS]
$ CREDIR [.TMP]
$!
All other directories will automatically be created during the restore of the PYVMS distribution.

decompress+extract the PYVMS distribution

$! -- create a temporary directory tree
$ set DEFAULT DKA100:[PYVMS_TMP]
$ CREATE /DIRECTORY /OWNER=[1,4] /PROTECTION=(G:RE,W:RE) /LOG []
$!
$! -- define foreign command for UNZIP
$ unzip = "$DKB100:[000000]UNZIP.EXE"
$!
$! -- list contents of .ZIP file
$ DEFINE /USER_MODE SYS$OUTPUT [PYTHON]PYVMS1_5_1-V001SRC.LIS
$ unzip -l DKB100:[000000]PYVMS1_5_1-V001SRC.ZIP
$!
$! -- extract/decompress files/directories from ZIPped file
$ SET PROTECTION= (S:RWED,O:RWED,G:RE,W:RE) /DEFAULT
$ DEFINE /USER_MODE SYS$OUTPUT DKB100:[000000]PYVMS1_5_1-V001SRC.UNZIP
$ unzip -e DKB100:[000000]PYVMS1_5_1-V001SRC.ZIP
$!
$! -- remove definition
$ DELETE /SYMBOL/LOCAL unzip
$!
$! -- make all files readable to all users
$ SET FILE /PROTECTION=(G:RE,W:RE) /OWNER=[1,4] [PYVMS_TMP...]*.* /LOG
$!

copy PYVMS tools from temp-tree

Some tools from the PYVMS distribution are needed now.
$ BACKUP DKA100:[PYVMS_TMP...]UNTAR2DATESET.C*, FILE_SET_DATE*.C* -
  DKA100:[PYTHON...]  /BY_OWNER=[1,4] /LOG
$!

build tool FILE_SET_DATE

$ set DEFAULT DKA100:[PYTHON.PYTHON-1_5_1.VMS.TOOLS]
$ @ FILE_SET_DATE-BUILD.COM
$!

set original date + time on files


... from the Python distribution
$ set DEFAULT [PYTHON.PYTHON-1_5_1.VMS]
$!
$! -- create command procedure to make calls to FILE_SET_DATE
$ @[.TOOLS]UNTAR2DATESET [PYTHON]PYTHON1_5_1.UNTAR -
  [PYTHON.PYTHON-1_5_1.VMS.TMP]PYTHON1_5_1-DATESET.COM
$!
$   !+
$   ! check the output file which should look like:
$   !   [...]
$   !   $ SET VERIFY
$   !   $ FSD = "$ [...]
$   !   $ FSD [PYTHON.PYTHON-1.5B2]BUGS "10-APR-1995 11:47:32.00"
$   !   [...]
$   !
$   ! otherwise you have to change UNTAR2DATESET.COM ...
$   !-
$!
$! -- run created procedure to change files' date + time
$! -- save output for later inspection
$ @[.TMP]PYTHON1_5_1-DATESET.COM /OUTPUT= [.TMP]PYTHON1_5_1-DATESET.LOG
$!
$! -- check for any problems
$ SEARCH [.TMP]PYTHON1_5_1-DATESET.LOG "%" /WINDOW=(1,4)
$!
$! -- delete files
$ delete /LOG [.TMP]PYTHON1_5_1-DATESET.COM;*, -
              [.TMP]PYTHON1_5_1-DATESET.LOG;*
$!

save some original files

These files will be replaced with modified ones from the PYVMS distribution. A copy is made for easy access to the original files. BACKUP is used because it retains the creation and revision date + time of the files. The following type extensions are used:
*.*$O - original file, superceeded by a new one with changes for PYVMS
*.*$P - original file, superceeded by a new one with Python patches
*.*$OP - original file, superceeded by a new one with Python patches AND changes for PYVMS
$ set DEFAULT [PYTHON.PYTHON-1_5_1.MODULES]
$ BACKUP MAIN.C, SELECTMODULE.C, SOCKETMODULE.C, _LOCALEMODULE.C  -
	*.C$O /BY_OWNER=ORIGINAL /LOG
$ BACKUP TIMEMODULE.C  *.C$OP /BY_OWNER=ORIGINAL /LOG
$ BACKUP TIMING.H  *.H$O /BY_OWNER=ORIGINAL /LOG
$ BACKUP PARSERMODULE.C, PYPCRE.C, STROPMODULE.C, ZLIBMODULE.C, -
  _TKINTER.C  *.C$P /BY_OWNER=ORIGINAL /LOG
$ BACKUP PCRE-INT.H, PCRE.H  *.H$P /BY_OWNER=ORIGINAL /LOG
$!
$ set DEFAULT [PYTHON.PYTHON-1_5_1.OBJECTS]
$ BACKUP CLASSOBJECT.C, FILEOBJECT.C, LONGOBJECT.C, OBJECT.C, -
  STRINGOBJECT.C  *.C$P /BY_OWNER=ORIGINAL /LOG
$!
$ set DEFAULT [PYTHON.PYTHON-1_5_1.PYTHON]
$ BACKUP BLTINMODULE.C, CEVAL.C  *.C$P /BY_OWNER=ORIGINAL /LOG
$ BACKUP IMPORT.C  *.C$OP /BY_OWNER=ORIGINAL /LOG
$!
$ set DEFAULT [PYTHON.PYTHON-1_5_1.LIB]
$ BACKUP GZIP.PY, IMAPLIB.PY, SGMLLIB.PY, SOCKETSERVER.PY, -
  STRING.PY, URLLIB.PY  *.PY$P /BY_OWNER=ORIGINAL /LOG
$!
$ set DEFAULT [PYTHON.PYTHON-1_5_1.TOOLS.FREEZE]
$ BACKUP FREEZE.PY *.PY$P /BY_OWNER=ORIGINAL /LOG
$!

move PYVMS files

This copies the entire PYVMS distribution 'over' the Python directory tree.
$! -- delete tools from previous steps - will be recreated
$ set DEFAULT [PYTHON.PYTHON-1_5_1.VMS]
$ delete /LOG [...]UNTAR2DATESET.*;*, FILE_SET_DATE*.*;*
$!
$! -- copy PYVMS tree
$ SET DEFAULT [PYTHON]
$ BACKUP [PYVMS_TMP...]*.*; -
         [PYTHON...]*.* /BY_OWNER=[1,4] /LOG /TRUNCATE /NEW_VERSION
$!
$! -- delete temporary directory tree
$ set FILE /PROTECTION=(O:RWED,W:RWED) -
  [000000]PYVMS_TMP.DIR;, [PYVMS_TMP...]*.*;*
$ delete /log [PYVMS_TMP...]*.*;*, ;, ;, ;, ;, ;, ;, ;, ;
$ delete /log [000000]PYVMS_TMP.DIR;
$!
$! -- save everything (optional)
$ BACKUP [000000]PYTHON.DIR;,[PYTHON...]*.*;* -
        DKB100:[000000]PYVMS.BCK /SAVE_SET /GROUP=0 /VERIFY
$!

translate and compile ...

The PYVMS distribution does not contain any pre-translated or pre-compiled files in order to save space.

translate VMSDEF modules

These modules contain OpenVMS version information, item-codes, bitmasks and constants:
$ SET DEFAULT DKA100:[PYTHON.PYTHON-1_5_1.VMS]
$ @ VMSDEF2MAR-ALL ! calls VMSDEF2MAR.COM
$ @ VMSDEF_BLDDIR2MAR.COM
$ @ VMSVER2MAR.COM VMSDAT_VMSVER.DAT
Run the MACRO source files that have just been created through the MACRO assembler and put the resulting object files in the object library VMS_MACRO.OLB.
$!! @ DMACRO_VMS
@@ not necessary, here -- DMACRO_VMS is called from DCC-ALL

compile for the DCL environment

$ @ DCC-ALL
$!
$ @ LINKD_PY
$!
$ @ LINKD_PGEN

compile for the POSIX environment

$ @ PCC-ALL
$!
$ @ LINKP_PY
@@ No attempt has been made to build 'PGEN' for POSIX - I haven't even used it in the DCL environment...

setup and go

Python on OpenVMS needs some symbols:
PYTHON
A foreign command pointing to the executable.
PYTHONPATH
Information where the library is.
PYTHONSTARTUP
Points to a file. In VMS speak this is an 'initialization file' that Python executes on startup.
PYTHONUNBUFFERED
Tell Python to use unbuffered I/O.
@@maintenance note: Symbol list could be moved to a different chapter.

The SETUP.COM procedure defines them dynamically:

$ @SETUP

Now you can run Python on OpenVMS:

$ PYTHON
Python 1.5.1 (V001, May 18 1998, 21:37:16) [DECC] on vms
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
portions Copyright 1996-1998 Uwe Zessin
>>>

convert documentation to RUNOFF format

The PYVMS distribution contains full sources to format the files for line printer or text output. You do not need to download the files 'pyvms1.5.1-v001doc.tlb' or 'pyvms1.5.1-v001doc.txt' from the Internet if you have the 'PYVMS source distribution' and access to this page.
$ set DEFAULT [PYTHON.PYTHON-1_5_1.VMS.DOC]
$ @ CVT_DOC

run tests

One of the files contains a file specification that is invalid for the ODS-2 filesystem and needs to be fixed:
$ SET DEFAULT [PYTHON.PYTHON-1_5_1.LIB.TEST]
$ BACKUP TEST_SUPPORT.PY;1 *.PY$O /OWNER=ORIGINAL /LOG
$ edit/edt TEST_SUPPORT.PY
*substitute/@test/test.test/%whole
exit
$
Run the tests:
$ python
Python 1.5.1 (V001, May 18 1998, 21:37:16) [DECC] on vms
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
portions Copyright 1996-1998 Uwe Zessin
>>> import test.autotest
test_grammar
test_opcodes
test_operations
test_builtin
test_exceptions
test_types
All 6 tests OK.
>>>
Note: this (and other tests) (currently) do not work with the POSIX version.

----------

You might need a patch to the DEC C RTL. Please see the description of patch VAXACRT11_061 even if you don't run OpenVMS VAX V6.1.


27-JUL-1998 ZE.