SABnzbd

Wiki

Incorrect or missing information? Tips for Unix packaging

We do like to see that people port SABnzbd to the various Linux/Unix distributions.
Given it's portability, it should be easy to port SABnzbd.

The following tips may make life easier.

SABnzbd requires a specific folder layout

The source distribution contains a specific folder structure that is required for the proper working. You cannot disturb this structure without changing the Python code also.
The source part could be stored like this (the /usr/local/src/sabnzbd part is just an example):

/usr/local/src/sabnzbd
/usr/local/src/sabnzbd/licenses
/usr/local/src/sabnzbd/sabnzbd
/usr/local/src/sabnzbd/interfaces
/usr/local/src/sabnzbd/cherrypy

This would mean that people can start the program with /usr/local/src/sabnzbd/SABnzbd.py.

SABnzbd comes with its own CherryPy copy

We use a non-standard release of CherryPy. It's a specific snapshot of the development tree for 3.2.0 with some patches applied. You must use this version and not an installed Python module.

Be careful when splitting Python code and the Skins

The code and the skins are tightly coupled. It is not possible to combine code and templates from different versions.
If it is necessary for technical reasons to split the skins, make sure that you define dependencies properly.
The Python code expects the templates to be in specific folders (relative to the location of SABnzbd.py), like shown above.

Create a symlink to SABnzbd.py

Having SABnzbd in the path can be convenient. So provide a symlink in (e.g.) /usr/bin to the main module SABnzbd.py.
Maybe you want to create a shell script for launching it.

SABnzbd is not a Python library

Although many Python-related packages install themselves in the Python installation hierarchy, SABnzbd was not designed as such.
It is possible to install SABnzbd in the site-specific part of Python, but we do not provide a setup.py script.
Instead we consider SABnzbd to be a program on its own, that just happens to be written in Python (and thus needs Python installed).

Pre-compile the code

Although not strictly required, pre-compiling improves startup time and uses a bit less memory.
After installation you could do a dry-run this way:

python -OO /usr/local/src/sabnzbd/SABnzbd.py --help

This will generate PYO files. Please note that SABnzbd.py itself does not get a PYO file, but all other PY files do.

Use the default locations for data storage

The above hierarchy does not need to be writable. By default SABnzbd will store all data in $HOME/.sabnzbd and $HOME.
There is full separation of code and data and per-user storage.

Add daemon support

If you want to give the user maximum support, consider creating support for starting and stopping SABnzbd through init.d.
We already created an example start-stop script here.
This will need some work to become a good solution for your platform.

Licensing

SABnzbd is released under GPL2 or later (meaning that you can assume either GLP2 or GPL3 at your own convenience).
The source distribution contains a large number of modules from other people and some modules come with different licenses.
We have been advised that you should assume GPL3 in order to prevent incompatibility with the other licenses.

Questions

If you have any questions, please don't hesitate to contact the development team.