kanzure/python-brlcad — pull request #12 by ncsaba (2014-01-03 15:23:26+00:00)
Title: Add config file

Hi Bryan,

This patch contains new code to move all possible configuration in a python-brlcad.cfg file, and load it from there.

Also it will try to find the brlcad installation based on the configuration, and on the PATH settings.

All that is work in progress, but I wanted to share what I already have - please have a look and give any feedback you might have :-)

I used the following code to test it:

from brlcad.install.post_install import *
from brlcad.install.options import *
logger = setup_logging()
config = load_config()

# try this with and without brl-cad on the PATH:
print "get_brlcad_config:\n", get_brlcad_config(None, logger)

print "load_ctypesgen_options:\n", load_ctypesgen_options(config, '/usr/brlcad')

version_list = load_brlcad_config(config)

print "Version list:"
for version in version_list:
print version

What needs to be done: iterate over the brlcad versions configured, and match it to the found installed version. Once a match is found, use that configuration with the existing code (which can be simplified, as all configuration is already resolved).

Cheers,
Csaba