(PYVMS LOGO) Python on OpenVMS

This page describes the steps to build Python on OpenVMS.

Version 1.5.2-V005 comes as a complete kit. It should be possible to upgrade from version 1.5.2-V001 or later, but this has not been tried. There is no update from 1.5.1-V009 or older available.


Specify an owner UIC to be assigned to the files:

$ _O = "/OWNER=[1,4]"
or use defaults:
$ _O = ""

restore the Python distribution

$! -- temporary directory
$ set DEFAULT PYVMS_INS_TMP:
$!
$! -- extract BACKUP saveset
$ UNZIP -e PYTHON1_5_2.ZIP
$!
If you have downloaded the ".ZIP" file before 14-MAY-1999, then you need to apply the following command to the BACKUP saveset, because the "-V" option was ommitted inadvertently during the creation of PYTHON1_5_2.ZIP.

$ set FILE /ATTRIBUTES=(RFM:FIX,LRL:32256) PYTHON1_5_2.BCK

A new download should not be necessary.

$! -- list contents of saveset
$ backup PYTHON1_5_2.BCK /SAVE_SET -
         /LIST= PYVMS_DISK:[PYTHON]PYTHON1_5_2.LIS
$!
$! -- extract files from saveset
$ backup PYTHON1_5_2.BCK /SAVE_SET -
         PYVMS_DISK:[*...] /TRUNCATE /VERIFY  '_O'
$!
$! -- delete saveset - please keep ZIP archive
$ delete /log PYTHON1_5_2.BCK;*
$!

create additional directories

The intention is to keep the original directories as much unchanged as possible.
$ set DEFAULT PYTHON_VMS:
$ CREDIR = "CREATE/DIRECTORY ''_O' /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]
$ delete /SYMBOL /LOCAL CREDIR
$!
All other directories will automatically be created during the restore of the PYVMS distribution.

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 PYVMS_DISK:[PYTHON.PYTHON-1_5_2.LIB]
$ BACKUP COMPILEALL.PY;1, TEMPFILE.PY;1  *.PY$O;* /OWNER=ORIGINAL
$!
$ set DEFAULT PYVMS_DISK:[PYTHON.PYTHON-1_5_2.LIB.TEST]
$ backup TEST_SUPPORT.PY;1 *.PY$O;* /OWNER=ORIGINAL
$!
$ set DEFAULT PYVMS_DISK:[PYTHON.PYTHON-1_5_2.MODULES]
$ backup MAIN.C, SELECTMODULE.C, SIGNALMODULE.C, SOCKETMODULE.C, -
	TIMEMODULE.C, _LOCALEMODULE.C  *.C$O /BY_OWNER=ORIGINAL /LOG
$ backup TIMING.H  *.H$O /BY_OWNER=ORIGINAL /LOG
$!
$ set DEFAULT PYVMS_DISK:[PYTHON.PYTHON-1_5_2.PYTHON]
$ backup IMPORT.C  *.C$O /BY_OWNER=ORIGINAL /LOG
$!

extract the PYVMS distribution

$! -- list contents of .ZIP file
$ set DEFAULT PYVMS_DISK:[PYTHON]
$!
$ define /USER_MODE SYS$OUTPUT [PYTHON]PYVMS1_5_2-V005SRC.LIS
$ UNZIP -l PYVMS_INS_TMP:PYVMS1_5_2-V005SRC.ZIP
$!
$! -- extract files/directories from ZIPped file
$ set PROTECTION= (S:RWED,O:RWED,G:RE,W:RE) /DEFAULT
$ define /USER_MODE SYS$OUTPUT -
         PYVMS_DISK:[PYTHON]PYVMS1_5_2-V005SRC.UNZIP
$ UNZIP -e -o PYVMS_INS_TMP:PYVMS1_5_2-V005SRC.ZIP
$!
There are some files that have been saved with OpenVMS specific file attributes, because they contain lines with explicit <LF> characters which ZIP/UNZIP would otherwise corrupt. (The SRC kit is created without the "-V" option).
$ set DEFAULT PYTHON_VMS:
$ set DEFAULT [.DOC]
$!
$ UNZIP -e CVT__RNO.ZIP
$!
$ delete CVT__RNO.ZIP;*
$!

translate and compile ...

The source kit (SRC) of the PYVMS distribution does not contain any pre-translated or pre-compiled files in order to save space.

Pre-compiled objects kits might be available. An objects kit will contain instructions how to install it.

translate VMSDEF modules

These modules contain OpenVMS version information, item codes, bitmasks and constants:
$ SET DEFAULT PYTHON_VMS:
$ show TIME
$ @ VMSDEF2MAR-ALL ! calls VMSDEF2MAR.COM
$ show TIME
$ @ VMSDEF_BLDDIR2MAR.COM
$ show TIME
$ @ VMSVER2MAR.COM VMSDAT_VMSVER.DAT
$ show TIME

translate configuration

Details of the configuration process are in the 'General Manual'.
$ @ CONFIG_INITTAB2MAR  CONFIG.DAT  "D"
$ @ MODULEMETHODS2MAR   VMS_LIB__METHODS.DAT  "."  "."
$ @ MODULEMETHODS2MAR   VMS_SYS__METHODS.DAT  "."  "."

compile for the DCL environment

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

The whole translation and compilation process took about one hour on a VAXstation 4000 modell 60.

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...

27-MAR-1999 - the Posix part has not been tested / kept up to date.

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.2 (V005, Sun Aug 22 15:22:14 1999) [DECC] on vms
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
portions Copyright 1996-1999 Uwe Zessin
>>>
Beginning with version 1.5.2-V005 the date printed is dynamically taken from the image header's link date - the code is in VMS__GETBUILDINFO.C.

compile Python files


For performance reasons the '.PY' files from the Python library should be pre-compiled, because non-privileged users can not create '.PYC' files in that directories and each call would result in a new (in memory) compilation.
$ SET DEFAULT PYTHON_VMS:
$ @ SETUP
$ @ [.TOOLS]COMPILEALL
This adds about 138 '.PYC' files with 2695 blocks.

run tests

$ python
Python 1.5.2 (V005, Sun Aug 22 15:22:14 1999) [DECC] on vms
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
portions Copyright 1996-1999 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.

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_2-v005doc.tlb', 'pyvmsinsman.txt', 'pyvmsgenman.txt' or 'pyvmsrefman.txt' from the Internet if you have the 'PYVMS source distribution' and access to this page.

Passing a "*" to CVT_DOC.COM started working with version 1.5.1-V009. (Note that version 1.5.2-V001 is newer.)

$ set DEFAULT [PYTHON.PYTHON-1_5_2.VMS.DOC.GENMAN]
$ @ CVT_DOC "*"
$!
$ set DEFAULT [PYTHON.PYTHON-1_5_2.VMS.DOC.REFMAN]
$ @ CVT_DOC "*"
$!
$ set DEFAULT [PYTHON.PYTHON-1_5_2.VMS.DOC.INSMAN]
$ @ CVT_DOC "*"

thread support

A short test to make threads available for the DCL variant of the Python interpreter has been done on OpenVMS VAX V6.1. These instructions have been updated for version 1.5.2-V005 (the first tests have been done with a version older than 1.5.1-V008).

Note that with OpenVMS version 7.0 there have been changes to the threads library. At lease two people reported problems, but did not attempt to solve them.

Here are the instructions:

Uncomment the following lines in CONFIG.H

    #define WITH_THREAD    1
    #define _POSIX_THREADS 1

(Re)compile all modules:

    $ set DEFAULT PYTHON_VMS:
    $ @ DCC-ALL

The following two modules need to be compiled, too:

    $ @ DCC_MODULES THREADMODULE
    $ @ DCC_PYTHON  THREAD

Update the configuration to include the thread module:

    $ @ CONFIG_INITTAB2MAR.COM  CONFIG.DAT  DT
    $ @ DMACRO_VMS              CONFIG_INITTAB.MAR

Link the executable:

    $ @ LINKD_PY

Test it:

    $ @ SETUP
    $ SET DEFAULT [.DEMO]
    $ PYTHON
    [...]
    >>> import thread1.py
Note that no follow-on work has been done regarding threads.

---

To revert to non-threading mode:

  • undo the changes in CONFIG.H
  • re-compile all modules again, but leave off THREADMODULE and THREAD
  • Update configuration without the thread module.
    Pass "D", not "DT" to CONFIG_INITTAB2MAR.COM
  • link the executable again.

(go to: table of contents, index, prev: preparations)

23-AUG-1999 ZE.