Proper definition of configuration files
Currently, there is a single configuration file vicodepy/config/config.ini
. This file is installed in the system along the other files of the vicodepy
module. The system administrator can modify this file, but the changes will be overwritten with the module upgrade.
In Linux systems, the correct way of addressing this issue is by installing the configuration file in the /etc/
directory, but taking care of not overwriting the changes made by the administrator. This is what is done by distributions like Debian, which has a mechanism for dealing with configuration files under /etc/
.
Furthermore, we should allow for the following levels of configuration, in reverse order of priority:
- module level:
vicodepy/config/config.ini
- system level:
/etc/vicodepy/config.ini
(the location should vary across different systems, like Linux, Windows, and MacOS) - user level:
~/.vicodepy.ini
- case level:
$cwd/config.ini
($cwd
is the directory where the video file is loaded from.)
N.B. Apparently, the read method of the ConfigParser class accepts a list of files to process and manages the priority order.
If the system level file does not exist, it should be created and the contents of vicodepy/config/config.ini
should be copied to it. At module upgrade, the administrator might be prompted to install a new version of the config.ini
at the system level.
The section Installing Package Data of the distutils module may contain some elements for addressing the current issue. Also, see the first answer to the question “Packaging a python app with a config file?.”