Skip to content
  • Sean Leavey's avatar
    Change config file organisation, add CLI config dump/edit support · 92b86360
    Sean Leavey authored
    The config file organisation previously used hard-coded Python values dumped to a file
    inside the Finesse source directory then copied to the user's config directory. This
    would present a problem when Finesse is installed as a package in a non-writable
    directory. Furthermore, the first step of dumping Python data structures to the
    config file was unnecessary - the config file could instead be provided as-is in the
    source tree, and copied on load to the user's config directory. This avoids the need
    for write permissions on the Finesse source directory, and has the added advantage of
    us being able to include comments in the configuration example files to guide the user.
    
    The code now copies the "finesse.ini.dist" and "usr.ini.dist" files from the finesse
    package into the user's config directory on load, the latter only if it doesn't already
    exist. These files are included in the setup.py package resources list so should get
    bundled as part of sdists and bdists, and these are loaded via Python 3.7's new
    importlib.resources module to avoid having to load the heavier pkg_resources library.
    
    Finally, the CLI now includes support for listing the current parsed configuration,
    listing the files which were used to make it, allowing the user to open their user
    configuration in the default system editor, and allowing them to reset their user
    configuration with the default.
    92b86360