config.py needs to know if vatstuff is installed or not

Bug #422530 reported by Alice Kærast
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
VATStuff
Fix Released
Undecided
Alice Kærast

Bug Description

config.py currently assumes that vatstuff hasn't been installed and so just tries loading files relative to the script directory. We need to get the debian package to modify config.py (or vatstuff.py?) to instead load the files from /usr/share/vatstuff when it has been installed.

This should be possible by putting a patch file in debian/patches which renames vatstuff.py to vatstuff and sets a variable in config.py (or vatstuff) to point to /usr/share/vatstuff (or whatever the debian way of refering to that directory is).

Related branches

Alice Kærast (kaerast)
Changed in vatstuff:
assignee: nobody → Alice Kærast (kaerast)
Revision history for this message
Bernard Czenkusz (bernie) wrote :

Debian policy also expects log files to be under /var - so that is
another variable required to point to another location, and I expect
other distributions may have their own rules.

I will have a go at a configuration file - a text file so it can be
changed either automatically on installation, or set for a particular
distribution.

I'm thinking it should consist of variables pointing at directory
locations, which sets the locations of logs etc, either absolutely or
relatively.

The program will need to know where this configuration file is, I
believe in Debian configuration files are held under /etc/<program_name/
so in the top module vatstuff.py there will have to be a variable set to
the location of the configuration file - and this can be changed for
different distribution builds

Revision history for this message
Bernard Czenkusz (bernie) wrote :

Done the following in the main trunk: vatstuff.py now has a variable CONFIG_LOCATION (line 85), which gives the filepath of a configuration file. If this variable is not set, the configuration file is at <scriptdirectory>/files/vatstuff.cfg

(Not set is the default in the main branch, it should probably be set to the preferred config file location in debian - such as /etc/vatstuff/vatstuff.cfg)

The configuration file files/vatstuff.cfg has been added and sets the default locations of the database, images, html, export, backup and log folders

vatstuff.cfg can be hand edited so these locations are either set relative to the script directory location, the users home folder, or given absolute path names - in the version in the main trunk I've set them relative to the scriptdirectory, so there's essentially no change from how vatstuff previously worked, but as these can now be set absolutely, to usr/share/vatstuff etc, I would expect this should solve the bug.

What do you think?

Revision history for this message
Alice Kærast (kaerast) wrote :

I hadn't considered moving the logs to /var. We should probably move the documentation to /usr/share/docs/vatstuff whilst we're at it. The debian packaging scripts will be fine setting all these locations through a patch file, which seems to be the Debian way of making changes to upstream software, and will work well for us.

One thing I haven't considered is how the software would work for multiple concurrent users and where the database should go. Can we safely have multiple people accessing the database file at the same time? Do we want to default to a single database for all users or keeping the database in a single user's home directory?

Alice Kærast (kaerast)
Changed in vatstuff:
status: New → Fix Committed
Changed in vatstuff:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.