Skip to content

Commit 52042a8

Browse files
author
Byron Boulton
committed
Document initialization of PYTHONPATH
Signed-off-by: Byron Boulton <bboulton@ara.com>
1 parent a2dcb3d commit 52042a8

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

INSTALL.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,15 @@ instance :instopt:`--disable-set-manpath<--enable-set-manpath>`):
504504

505505
.. versionadded:: 4.2
506506

507+
.. instopt:: --enable-append-pythonpath
508+
509+
Append rather prepend init directory to the PYTHONPATH environment variable
510+
when the :instopt:`--enable-set-pythonpath` option is enabled. (default=no)
511+
512+
.. only:: html
513+
514+
.. versionadded:: 5.7
515+
507516
.. instopt:: --enable-auto-handling
508517

509518
Set modulecmd.tcl to automatically apply automated modulefiles handling
@@ -799,6 +808,16 @@ instance :instopt:`--disable-set-manpath<--enable-set-manpath>`):
799808

800809
.. versionadded:: 4.0
801810

811+
.. instopt:: --enable-set-pythonpath
812+
813+
Prepend init directory defined by the :instopt:`--initdir` option to the
814+
PYTHONPATH environment variable in the shell initialization scripts.
815+
(default=yes)
816+
817+
.. only:: html
818+
819+
.. versionadded:: 5.7
820+
802821
.. instopt:: --enable-set-shell-startup
803822

804823
Set when module function is defined the shell startup file to ensure that the

doc/source/module.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,20 @@ Perl:
128128
129129
Python:
130130

131+
Default installation should have added |file initdir| to the :envvar:`PYTHONPATH` environment variable allowing initialization as follows
132+
133+
.. parsed-literal::
134+
135+
from env_modules import module
136+
module("load", "modulefile", "modulefile", "...")
137+
138+
Otherwise
139+
131140
.. parsed-literal::
132141
133-
import os
134-
exec(open("\ |initdir|\ /python.py").read(), globals())
142+
import sys
143+
sys.path.insert(1, "\ |initdir|\ ")
144+
from env_modules import module
135145
module("load", "modulefile", "modulefile", "...")
136146
137147
Ruby:

0 commit comments

Comments
 (0)