&installing and building.1<(LOGO.JPG) Python for OpenVMS=

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

 7

This 7page/describes the steps to build Python on OpenVMS.

MVersion 2.1.1-V001 is distributed as a single, complete kit.2There is no upgrade from older versions available.


1Specify an owner UIC to be assigned to the files:

"$ _O = "/OWNER=[1,4]"

or use defaults:

$ _O = ""

NThe procedure PYTHON_LOGICALS.COM which is used to define the3logical names is not there, yet - use a workaround.

'$ DEFINE PYTHON_DISK DSA3:L

restore the Python for OpenVMS distribution

0?
$! -- temporary directoryP$ set DEFAULT PYTHON_INS_TMP:$!$! -- extract BACKUP saveset$ UNZIP -e PYTHON2_1_1-V001.ZIP$!>$! -- extract files from saveset)$ backup PYTHON2_1_1-V001.BCK /SAVE_SET -3         PYTHON_DISK:[*...] /TRUNCATE /VERIFY  '_O'$!$! -- list contents of saveset)$ backup PYTHON2_1_1-V001.BCK /SAVE_SET -h         /LIST= PYTHON_DISK:[PYTHON]PYTHON2_1_1-V001.LIS$!2$! -- delete saveset - please keep the ZIP archive$$ delete /log PYTHON2_1_1-V001.BCK;*$!
>

create additional directories

PThe intention is to keep the original directories as much unchanged as possible.,First, however, establish the logical names:
9$ @ PYTHON_DISK:[PYTHON.PYTHON2_1_1.VMS]PYTHON_LOGICALS 1$ @ PYTHON_VMS:SETUPe$ set DEFAULT PYTHON_VMS:?$ CREDIR = "CREATE/DIRECTORY ''_O' /PROTECTION=(G:RE,W:RE)/LOG"$!$ CREDIR [.TMP]$!$ CREDIR [PYTHON.SITE-PACKAGES]$!%$ CREDIR [PYTHON.PREFIX2_1_1.INCLUDE]!$ CREDIR [PYTHON.PREFIX2_1_1.LIB]$!$ delete /SYMBOL /LOCAL CREDIR$!
Move 2 directories to theKPREFIXarea:
*$ rename [PYTHON.PYTHON2_1_1]INCLUDE.DIR -2         [PYTHON.PREFIX2_1_1.INCLUDE]PYTHON2_1.DIR&$ rename [PYTHON.PYTHON2_1_1]LIB.DIR -4         [PYTHON.PREFIX2_1_1.LIB]PYTHON2_1.DIR
7

configure for compilation

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

01The logical nameLPYTHON_CFG_CXX controls whether the main module PYTHON.C isLto be compiled with the DEC / Compaq C++ compiler and the CXXLINK command toMbe used to build the executable. This does NOT mean that youKcan build Python for OpenVMS with the DEC / Compaq C++ compiler!! This doesGNOT work, sorry, you need the DEC / Compaq C compiler.

23The logical nameHPYTHON_CFG_DEBUG controls whether object code should be!generated with /DEBUG/noOPTIMIZE.

47The logical nameIPYTHON_CFG_THREADS controls if the interpreter should beKbuild with thread support. You need to recompile ALL modules for a change -#instructions are at the end of this 9 page.

---

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

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

OAfter some other changes (Debug/noDebug, Thread/noThread) a different directoryis created for the logical nameEPYTHON_EXEC_PREFIX_V:Hwhile SETUP.COM is run the first time after the change.

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

translate and compile or install objects

JThe Python for OpenVMS distribution does not contain any pre-translated or*pre-compiled files in order to save space.

MPre-compiled objects kits might be available.

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

convert data files

BSome data files need to be converted to indexed sequential format:16'*#
6$! -- 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$!4$! -- convert VMSDAT_VMSVER.TXT to VMSDAT_VMSVER.DAT"$ @ PYTHON_TOOLS:CVT_VMSDAT_VMSVER$!4$! -- convert VMSDAT_VMSVER.TXT to VMSDAT_VMSVER.MAR]$ @ PYTHON_VMS:VMSVER2MAR.COM VMSDAT_VMSVER.TXT
<

translate VMSDEF modules

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

translate configuration

KDetails of the configuration processDare in the 'General Manual'.
˜$ @ CONFIG_INITTAB2MAR  CONFIG.DAT
OBeginning with version 1.5.2-V007 CONFIG_INITTAB2MAR.COM takesOthe information automatically from the logical names that have been establishedby SETUP.COM.
6$ @ MODULEMETHODS2MAR   PYVMS__METHODS.DAT    "."  "."6$ @ MODULEMETHODS2MAR   VMS_LBR__METHODS.DAT  "."  "."6$ @ MODULEMETHODS2MAR   VMS_LIB__METHODS.DAT  "."  "."6$ @ MODULEMETHODS2MAR   VMS_SMG__METHODS.DAT  "."  "."½$ @ MODULEMETHODS2MAR   VMS_SYS__METHODS.DAT  "."  "."
@

compile for the DCL environment

K
$ @ PYTHON_VMS:BLDRUN "$ALL"
0

install objects

+Instructions need to be in the objects kit.4

LINK - create executables

LMake sure you have already executed the procedure SETUP.COMLso 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


OBeginning with Python for OpenVMS version 1.5.2-V007 some configuration changesLrequire a working Python executable. Please consider saving this file so youhave a fail back.,

setup and go

?Python for OpenVMS needs some symbols:4
,
PYTHON1
A foreign command pointing to the executable.4
PYTHONPATH%
Information where the library is.:
PYTHONSTARTUPH
Points to a file. In VMS speak this is an 'initialization file' thatPython executes on startup.@
PYTHONUNBUFFERED&
Tell Python to use unbuffered I/O.
F@@maintenance note: Symbol list could be moved to a different chapter.*

The procedure defines them dynamically:

	$ @ SETUP
;Now you can run Python on OpenVMS:
$ PYTHONEPython 2.1.1 (V001, Sat Jul 21 11:50:41 2001) [DECC] on OpenVMS VAX \
 (D_float)>Type "copyright", "credits" or "license" for more information.	>>>
IThe date printed is dynamically taken from the image header's link date -4the code is in VMS__GETBUILDINFO.C.6

compile Python files

IFor performance reasons the '.PY' files from the Python library should beIpre-compiled, because non-privileged users can not create '.PYC' files inMthat directories and each call would result in a new (in memory) compilation.
$ set DEFAULT PYTHON_VMS:	$ @ SETUP!$ @ PYTHON_TOOLS:COMPILEALL
2This adds 164 '.PYC' files with about 4550 blocks.*

run tests

NOn OpenVMS VAX which does not support the T_float (IEEE) floating point format+it is necessary to disable parts of a test:
$ set DEFAULT PYTHON_PREFIX_V:#$ set DEFAULT [.LIB.PYTHON2_1.TEST]$ edit/edt TEST_COMPLEX.PY=substitute /test_div(complex(1e/#@@test_div(complex(1e/%wholeexit$
LNote that the UIC of the process must match the owner UIC of the directory - else one of the tests will fail.

<This is an example - the actual output might look different.

$ set DEFAULT PYTHON_PREFIX_V:#$ set DEFAULT [.LIB.PYTHON2_1.TEST]$ python REGRTEST.PYtest_grammartest_opcodestest_operations    ...test_format4The actual stdout doesn't match the expected stdout.-This much did match (between asterisk lines):F**********************************************************************test_formatF**********************************************************************Then ...We expected (repr): ''3But instead we got: "'%#x' % 0 == '0x000' != '0x0'"Etest test_format failed -- Writing: "'%#x' % 0 == '0x000' != '0x0'",\ expected: ''
FOn OpenVMS VAX V6.2 this test fails, although the ECO VAXCRTL11_062 is&installed. This is a bug in the C RTL.
test_funcattrs    ...test_thread
NOn OpenVMS VAX V6.2 this test hangs. The process can be resumed by a series ofMrapid calls to 'vms_sys.wake() fromManother process while pressing <CONTROL-T> on the testing process' screen.

*Some files can be deleted after the tests:

$ set DEFAULT PYTHON_PREFIX_V:#$ set DEFAULT [.LIB.PYTHON2_1.TEST];$ delete /LOG *.PYC;*, TEST_RGBIMG.RGB;*, TEST_TMP.;*
EOther files are left in the subdirectoryO[.PYTHON_TMP] that has been created by the SETUP.COM procedureOin the directory that the logical name SYS$SCRATCH: points to.
$ set DEFAULT PYTHON_TMP_V:$ SHOW DEFAULT!$ DELETE [...]*.*;*,;,;,;,;
NWarning! This will delete all files in this directory tree - make sure you areat the correct location!G

convert documentation to RUNOFF format

1"$$$-The!Python(for OpenVMS)distribution%containsAfull sources to format the files for line printer or text output.%You do not need to download the files+'python2_1_1-v001doc.tlb','demo.txt','insman.txt', 'genman.txt' or/'refman.txt' from the InternetKif you have the 'Python for OpenVMS source kit'and access to thisMpage.

IYou do not need to execute these commands unless you want to generate the '.TXT' files.

$ set DEFAULT PYTHON_VMS:$ set DEFAULT [.DOC.GENMAN]4$ @ CVT_DOC "*"$!$ set DEFAULT [-.INSMAN]$ @ CVT_DOC "*"$!$ set DEFAULT [-.REFMAN]$ @ CVT_DOC "*"$!$ set DEFAULT [-.DEMO]$ @ CVT_DOC "*"

/

add components

7The base kit does not include the following components:
VMS_LBR, VMS_MAIL, VMS_SMG

i@The following steps are necessary to add one or more components:

9 Register:n

B$ set DEFAULT PYTHON_VMS:-$!-$ python PYTHON_TOOLS:REGISTER_CONFIG.PY    -O)         R  PYTHON_VMS:CONFIG_VMS_LBR.TXTL-$ python PYTHON_TOOLS:REGISTER_CONFIG.PY    - *         R  PYTHON_VMS:CONFIG_VMS_MAIL.TXT-$ python PYTHON_TOOLS:REGISTER_CONFIG.PY    -e/         R  PYTHON_VMS:CONFIG_VMS_SMG.TXT
/

OSome configuration data files have been updated and need to be processed again:m

<'$ @ PYTHON_TOOLS:CVT_CONFIG_MODULES.COM"#$ @ PYTHON_TOOLS:CVT_CONFIG_OLB.COM˜$ @ CONFIG_INITTAB2MAR  CONFIG.DAT+$ @ BLDRUN  VMS_MACRO  CONFIG_INITTAB
>

s"The component(s) can now be built:

t$ @ BLDRUN  C:PYTHON.VMS_LBR$ @ BLDRUN  C:PYTHON.VMS_MAILr$ @ BLDRUN  C:PYTHON.VMS_SMG$!$ @ LINK_PY
C
<

install HTML documentation

+There is a link from [.DOC]DOCU.HTML to theY9Python documentation.i"
$ set DEFAULT PYTHON_INS_TMP:$ UNZIP -e HTML2_1_1.ZIP$!"$ set DEFAULT PYTHON_DISK:[PYTHON]1$ BACKUP PYTHON_INS_TMP:HTML2_1_1.BCK /SAVE_SET -N'         [*...] /TRUNCATE /VERIFY  '_O'e$!-$ DELETE PYTHON_INS_TMP:HTML2_1_1.BCK;*
a
/

thread support

L4*UseAyour text editor of choice to changeKCthe procedure SETUP.COM to define the logical name 6PYTHON_CFG_THREADS to "1" and run it:
O    $ set DEFAULT PYTHON_VMS:s    $ @ SETUP
ONotice that the logical names EPYTHON_EXEC_PREFIX_P: andEPYTHON_EXEC_PREFIX_V: have changed. On the first run JSETUP.COM creates a new directory for this configuration.

r5You can use the following command for a full rebuild:O

.    $ @ BUILD_PYTHON
Test it:
e
    $ @ SETUP     $ set DEFAULT [.DEMO]t
    $ PYTHON t	    [...]     >>> import thread1.py
p7Note that no more work has been done regarding threads.P



---


H To revert to non-threading mode:

    8
  • undo the change to logical name PYTHON_CFG_THREADS
  • re-run SETUP.COMP
  • re-compile all modules and link the executable again with BUILD_PYTHON.COM
E/[L
1M(go to: table of contents,h!index,r3prev: preparations),

28-JUL-2001 ZE.2 Y