Common install script and file structure for 3rd party NAV tools
At UiT, we have developed a number of custom NAV tools. They can be tricky to install, so I have written libinst.py, which discovers everything it needs to know from inspecting nav, so all you have to do is type "./install.py".
I propose this as a standard module in NAV. This way you could just set up the standard file structure, and write a small install.py like this (a real example from our DHCP module):
from nav.uit.toolinst import install_tool
install_tool(
The installer will discover and install all necessary files, as long as the package follows this structure (again using dhcp as an example):
bin/ (all executable scripts here will be installed in NAVPREFIX/bin/
src/ (contains urls.py, views.py and other code. If models.py is not found, an empty file will be installed instead.)
images/dhcp.png (will be used as the tool's icon in the toolbox)
templates/
The tool file will be created, preserving the current priority in the toolbox if the tool file is already installed.
The TooInstaller can also be instantiated directly for more detailed control over the installation process. Here, the installer is used to expand a NAV variable to get the destination directory for a file copy:
from nav.uit.toolinst import Installer
inst = Installer(
inst.install()
# Copy apache config. (Can't generate this, since it's not a Python
# tool.)
shutil.
Toolinst will not create the db schema or install config files.
The current implementation can be seen here:
https:/
Examples of use:
https:/
https:/
https:/
https:/
Blueprint information
- Status:
- Not started
- Approver:
- None
- Priority:
- Undefined
- Drafter:
- Ole Martin Bjørndalen
- Direction:
- Needs approval
- Assignee:
- Ole Martin Bjørndalen
- Definition:
- Discussion
- Series goal:
- None
- Implementation:
- Unknown
- Milestone target:
- None
- Started by
- Completed by