(LOGO.JPG) Python for OpenVMS

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

This page describes the steps to build Python on OpenVMS.

Version 1.5.2-V007 comes as a complete kit with a new build mechanism. It is strongly recommended that you do a new installation and not attempt an upgrade.


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

$! -- extract files from saveset
$ backup PYTHON1_5_2.BCK /SAVE_SET -
         PYTHON_DISK:[*...] /TRUNCATE /VERIFY  '_O'
$!
$! -- list contents of saveset
$ backup PYTHON1_5_2.BCK /SAVE_SET -
         /LIST= PYTHON_DISK:[PYTHON]PYTHON1_5_2.LIS
$!
$! -- 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]
$ CREDIR [.O_VAX]
$ CREDIR [.TMP]
$ delete /SYMBOL /LOCAL CREDIR
$!
All other directories will automatically be created during the restore of the Python for OpenVMS distribution.

save some original files

These files will be replaced with modified ones from the Python for OpenVMS 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 OpenVMS
*.*$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 OpenVMS
$ set default PYTHON_DISK:[PYTHON.PYTHON-1_5_2.LIB]
$ backup COMPILEALL.PY;1, FTPLIB.PY;1, GETPASS.PY;1, SITE.PY;1, -
         TEMPFILE.PY;1, USER.PY;1 *.PY$O;*   /OWNER=ORIGINAL /LOG
$!
$ set DEFAULT PYTHON_DISK:[PYTHON.PYTHON-1_5_2.LIB.TEST]
$ backup TEST_RGBIMG.PY;1, TEST_SIGNAL.PY;1, TEST_SUPPORT.PY;1 -
         *.PY$O;* /OWNER=ORIGINAL /LOG
$!
$ set DEFAULT PYTHON_DISK:[PYTHON.PYTHON-1_5_2.LIB.TEST.OUTPUT]
$ backup TEST_MIMEWRITER.;1 *.$O /OWNER=ORIGINAL /LOG
$!
$ set DEFAULT PYTHON_DISK:[PYTHON.PYTHON-1_5_2.MODULES]
$ backup FCNTLMODULE.C,  MAIN.C, PYTHON.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 PYTHON_DISK:[PYTHON.PYTHON-1_5_2.OBJECTS]
$ backup FILEOBJECT.C  *.C$O  /BY_OWNER=ORIGINAL /LOG
$!
$ set DEFAULT PYTHON_DISK:[PYTHON.PYTHON-1_5_2.PYTHON]
$ backup IMPORT.C  *.C$O /BY_OWNER=ORIGINAL /LOG
$!

extract the Python for OpenVMS distribution

$! -- list contents of .ZIP file
$ set DEFAULT PYTHON_DISK:[PYTHON]
$!
$ define /USER_MODE SYS$OUTPUT [PYTHON]PYTHON-1_5_2-V007SRC.LIS
$ UNZIP -l PYTHON_INS_TMP:PYTHON-1_5_2-V007SRC.ZIP
$!
$! -- extract files/directories from ZIPped file
$ set PROTECTION= (S:RWED,O:RWED,G:RE,W:RE) /DEFAULT
$ define /USER_MODE SYS$OUTPUT -
         PYTHON_DISK:[PYTHON]PYTHON-1_5_2-V007SRC.UNZIP
$ UNZIP -e -o PYTHON_INS_TMP:PYTHON-1_5_2-V007SRC.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;*
$!

configure for compilation

If you intend to compile the source code yourself, please review the contents of file SETUP.COM

The logical name PYTHON_CFG_CXX controls whether the main module PYTHON.C is to be compiled with the DEC / Compaq C++ compiler and the CXXLINK command to be used to build the executable. This does NOT mean that you can build Python for OpenVMS with the DEC / Compaq C++ compiler!! This does NOT work, sorry, you need the DEC / Compaq C compiler.

The logical name PYTHON_CFG_DEBUG controls whether object code should be generated with /DEBUG/noOPTIMIZE.

The logical name PYTHON_CFG_THREADS controls if the interpreter should be build with thread support. You need to recompile ALL modules for a change - instructions are at the end of this page.

---

Even if you don't compile yourself you need to run the procedure:

$ set DEFAULT PYTHON_VMS:
$ @ SETUP
Note that during first-time execution of the procedure SETUP.COM it creates a subdirectory named [.PYTHON_TMP] where the logical name SYS$SCRATCH points to.

There can be a problem if SYS$SCRATCH points to a logical name search list. The 'pkg' test fails for some reason that I have not tried to find out - please redefine SYS$SCRATCH in such a situation.

translate and compile or install objects

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

Pre-compiled objects kits might be available.

The following commands up to '@LINKD_PGEN' are also combined in procedure BUILD_PYTHON.COM which you can use instead.

convert data files

Some data files need to be converted to indexed sequential format:
$! -- convert CONFIG_MODULES.TXT to CONFIG_MODULES.DAT
$ @ PYTHON_TOOLS:CVT_CONFIG_MODULES.COM
$!
$! -- convert CONFIG_OLB.TXT to CONFIG_OLB.DAT
$ @ PYTHON_TOOLS:CVT_CONFIG_OLB.COM
$!
$! -- convert VMSDAT_VMSVER.TXT to VMSDAT_VMSVER.DAT
$ @ PYTHON_TOOLS:CVT_VMSDAT_VMSVER
$!
$! -- convert VMSDAT_VMSVER.TXT to VMSDAT_VMSVER.MAR
$ @ PYTHON_VMS:VMSVER2MAR.COM VMSDAT_VMSVER.TXT

translate VMSDEF modules

These modules contain OpenVMS version information, item codes, bitmasks and constants:
$ set DEFAULT PYTHON_VMS:
$!
$ @ VMSDEF2MAR-ALL ! calls VMSDEF2MAR.COM
$!
$! -- create VMSDEF_DIRECTORY.MAR
$ @ VMSDEF_BLDDIR2MAR.COM

translate configuration

Details of the configuration process are in the 'General Manual'.
$ @ CONFIG_INITTAB2MAR  CONFIG.DAT
Beginning with version 1.5.2-V007 CONFIG_INITTAB2MAR.COM takes the information automatically from the logical names that have been established by SETUP.COM.
$ @ MODULEMETHODS2MAR   PYVMS__METHODS.DAT    "."  "."
$ @ MODULEMETHODS2MAR   VMS_LBR__METHODS.DAT  "."  "."
$ @ MODULEMETHODS2MAR   VMS_LIB__METHODS.DAT  "."  "."
$ @ MODULEMETHODS2MAR   VMS_SMG__METHODS.DAT  "."  "."
$ @ MODULEMETHODS2MAR   VMS_SYS__METHODS.DAT  "."  "."

compile for the DCL environment

$ @ PYTHON_VMS:BLDRUN "$ALL"

The whole translation and compilation process took about 1.5 hours on a VAXstation 4000 modell 60.

install objects

If you can not compile yourself, but found a suitable objects kit you might be able to do an installation like this:
$ set DEFAULT PYTHON_DISK:[PYTHON]
$ _ARCH = "ALPHA"
$ if (F$GETSYI("CPU").le.127) then $ _ARCH = "VAX"
$ UNZIP -e -o PYTHON_INS_TMP:PYTHON-1_5_2-V007OBJ_'_ARCH'.ZIP

The object kit should come with a set of configuration data that matches the contents of the object libraries. Therefore you should run SETUP.COM again:

$ @ PYTHON_VMS:SETUP
You should re-do the steps 'convert data files' and 'translate configuration'.

LINK - create executables

Make sure you have already executed the procedure SETUP.COM so that the LINK procedures will pick up the correct object libraries. It is unlikely that you ever need 'PGEN', but the procedure is there.
$ @ PYTHON_VMS:LINK_PY
$!
$ @ PYTHON_VMS:LINKD_PGEN

Beginning with Python for OpenVMS version 1.5.2-V007 some configuration changes require a working Python executable. Please consider saving this file so you have a fail back.

setup and go

Python for 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 procedure defines them dynamically:

$ @SETUP
Now you can run Python on OpenVMS:
$ PYTHON
Python 1.5.2 (V007, Sat Aug  5 20:38:12 2000) [DECC] on OpenVMS VAX
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
portions Copyright 1996-2000 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. Beginning with version 1.5.2-V007 the architecture name (Alpha, VAX) is also printed.

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
$ @ PYTHON_TOOLS:COMPILEALL
This adds 136 '.PYC' files with about 2670 blocks.

run tests

This is an example - the actual output might look different.
$ set DEFAULT PYTHON_VMS
$ @ SETUP
$ set DEFAULT PYTHON_TMP1:
$ python
Python 1.5.2 (V007, Sat Aug  5 20:38:12 2000) [DECC] on OpenVMS VAX
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
portions Copyright 1996-2000 Uwe Zessin
>>> import test.autotest
test_grammar
test_opcodes
test_operations
test_builtin
test_exceptions
test_types
test_al
test test_al skipped -- an optional feature could not be imported
test_array
test_audioop
test_binascii
test_bsddb
test test_bsddb skipped -- an optional feature could not be imported
test_cd
test test_cd skipped -- an optional feature could not be imported
test_cl
test test_cl skipped -- an optional feature could not be imported
test_cmath
test_cpickle
test_crypt
test test_crypt skipped -- an optional feature could not be imported
test_dbm
test test_dbm skipped -- an optional feature could not be imported
test_dl
test test_dl skipped -- an optional feature could not be imported
test_errno
test_fcntl
test test_fcntl skipped -- an optional feature could not be imported
test_gdbm
test test_gdbm skipped -- an optional feature could not be imported
test_gl
test test_gl skipped -- an optional feature could not be imported
test_grp
test test_grp skipped -- an optional feature could not be imported
test_gzip
test test_gzip skipped -- an optional feature could not be imported
test_imageop
test_imgfile
test test_imgfile skipped -- an optional feature could not be imported
test_long
test_math
test_md5
test_mimewriter
test_new
test_nis
test test_nis skipped -- an optional feature could not be imported
test_ntpath
test_operator
test_pickle
test_pkg
test_popen2
test test_popen2 skipped -- an optional feature could not be imported
test_pow
test_pwd
test test_pwd skipped -- an optional feature could not be imported
test_re
test_regex
test_rfc822
test_rgbimg
test_rotor
test_select
test test_select crashed -- exceptions.AttributeError : popen
test_sha
test_signal
test test_signal skipped -- an optional feature could not be imported
test_socket
test test_socket crashed -- socket.error : (65535, 'no logical name match')
test_strftime
test test_strftime failed -- Writing: 'Conflict for %I (hour (01-12)):',
 expected: ''
test_strop
test_struct
test_sunaudiodev
test test_sunaudiodev skipped -- an optional feature could not be imported
test_thread
(hangs)

Some files can be deleted after the tests:

$ delete /LOG PYTHON_DISK:[PYTHON.PYTHON-1_5_2.LIB.TEST]*.PYC;*
Other files are left in the subdirectory [.PYTHON_TMP] that has been created by the SETUP.COM procedure in the directory that the logical name SYS$SCRATCH points to.

convert documentation to RUNOFF format

The Python for OpenVMS distribution contains full sources to format the files for line printer or text output. You do not need to download the files 'python-1_5_2-v007doc.tlb', 'demo.txt', 'insman.txt', 'genman.txt' or 'refman.txt' from the Internet if you have the 'Python for OpenVMS source kit' and access to this page.
$ set DEFAULT PYTHON_VMS:
$ set DEFAULT [.DOC.GENMAN]
$ @ CVT_DOC "*"
$!
$ set DEFAULT [-.INSMAN]
$ @ CVT_DOC "*"
$!
$ set DEFAULT [-.REFMAN]
$ @ CVT_DOC "*"
$!
$ set DEFAULT [-.DEMO]
$ @ CVT_DOC "*"

The whole documentation translation process took about 40 minutes on a VAXstation 4000 modell 60.


thread support

Use your text editor of choice to change the procedure SETUP.COM to define the logical name PYTHON_CFG_THREADS to "1" and run it:
    $ set DEFAULT PYTHON_VMS:
    $ @ SETUP
You can use the following command for a full rebuild:
    $ @ BUILD_PYTHON
Link the executable:
    $ @ LINK_PY

Test it:

    $ @ SETUP
    $ set DEFAULT [.DEMO]
    $ PYTHON
    [...]
    >>> import thread1.py
Note that no more work has been done regarding threads.

---

To revert to non-threading mode:

  • undo the change to logical name PYTHON_CFG_THREADS
  • re-run SETUP.COM
  • re-compile all modules again with BUILD_PYTHON.COM
  • link the executable again.

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

09-AUG-2000 ZE.