Merge lp:~spud/spud/schemata_env into lp:spud

Proposed by Cian Wilson
Status: Merged
Merged at revision: 524
Proposed branch: lp:~spud/spud/schemata_env
Merge into: lp:spud
Diff against target: 0 lines
To merge this branch: bzr merge lp:~spud/spud/schemata_env
Reviewer Review Type Date Requested Status
Patrick Farrell Approve
Review via email:

Description of the change

I'd like to be able to control where diamond picks up the schemata file by an environment variable so I can control this using modules.

This merge introduces this feature. The environment variable DIAMOND_CONFIG_PATH allows directories to be specified that contain the schemata directory. They may also contain the plugins directory for consistency.

Manual also updated for schemata.

To post a comment you must log in.
Revision history for this message
Patrick Farrell (pefarrell) wrote :

I think it's a good idea, and I'd like to see it merged, with minor editions.

The current order is ~/.diamond > /etc/diamond > /usr/share/diamond. The order you've implemented here is ~/.diamond > DIAMOND_CONFIG_PATH > /etc/diamond > /usr/share/diamond, but I'd like to see
DIAMOND_CONFIG_PATH > ~/.diamond (as I think setting a session-specific environment variable is usually stronger than setting options in your home directory).

Revision history for this message
Cian Wilson (cwilson) wrote :

Sure, I'm just as happy (if not happier - will save me getting rid of my home directory schematas) with that.

Should be committed now.

Cheers for the fast review!

lp:~spud/spud/schemata_env updated
525. By Cian Wilson

Updating order in which schemata directories are searched. Also updating error messages and usage information as well as the manual.

Revision history for this message
Patrick Farrell (pefarrell) wrote :

+if "DIAMOND_CONFIG_PATH" in os.environ:
+ dirs += os.environ["DIAMOND_CONFIG_PATH"].split(":")

Just a thought: should you reverse the .split(:)? People will assume that a PATH variable will be searched going from start to end, but at the moment it's the other way around.

Otherwise, good to go.

review: Approve
Revision history for this message
Cian Wilson (cwilson) wrote :

Agreed. Hadn't really thought seriously about the possibility someone might have multiple directories specified in that variable. Was just covering the possibility with the split.


lp:~spud/spud/schemata_env updated
526. By Cian Wilson

Reverse the order of any directories listed in DIAMOND_CONFIG_PATH.

Preview Diff



People subscribed via source and target branches