mirror of
https://github.com/nasa/trick.git
synced 2024-12-19 05:07:54 +00:00
Make trick (Python package) a namespace package
Namespace packages are a mechanism for splitting a single Python package across multiple directories on disk. With the addition of $(TRICK_HOME)/pymods/trick, there now exists a package named 'trick' at $(TRICK_HOME)/pymods and in each SIM_* directory. This change allows sims to import modules from both locations. Refs #365
This commit is contained in:
parent
fc63f5c6b1
commit
4146b440b8
@ -377,6 +377,8 @@ py_%.cpp: %.i
|
||||
}
|
||||
open INITFILE , ">trick/__init__.py" or return ;
|
||||
|
||||
print INITFILE "from pkgutil import extend_path\n" ;
|
||||
print INITFILE "__path__ = extend_path(__path__, __name__)\n" ;
|
||||
print INITFILE "import sys\n" ;
|
||||
print INITFILE "import os\n" ;
|
||||
print INITFILE "sys.path.append(os.getcwd() + \"/trick\")\n" ;
|
||||
|
@ -0,0 +1,2 @@
|
||||
from pkgutil import extend_path
|
||||
__path__ = extend_path(__path__, __name__)
|
@ -103,6 +103,7 @@ int Trick::IPPython::init() {
|
||||
"import struct\n"
|
||||
"import binascii\n"
|
||||
"sys.path.append(os.getcwd())\n"
|
||||
"sys.path.append(os.path.join(os.environ['TRICK_HOME'], 'pymods'))\n"
|
||||
"sys.path += map(str.strip, os.environ['TRICK_PYTHON_PATH'].split(':'))\n"
|
||||
"import trick\n"
|
||||
"sys.path.append(os.getcwd() + \"/Modified_data\")\n"
|
||||
|
Loading…
Reference in New Issue
Block a user