[Piglit] [PATCH 1/4] framework: allow loading a piglit.conf from more locations
Chad Versace
chad.versace at intel.com
Tue Jul 1 16:44:16 PDT 2014
On Mon, Jun 30, 2014 at 04:53:19PM -0700, Dylan Baker wrote:
> This allows piglit.conf to reside in $HOME/.conf/ (as defined by xdg
> basedir-spec
> http://standards.freedesktop.org/basedir-spec/basedir-spec-0.8.html), in
> the current directory, or in the piglit toplevel directory (in that
> order). This allows piglit.conf to survive git clean and other hardships
> of living in a development directory
>
> Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
> ---
> framework/programs/run.py | 35 ++++++++++++++++++++++++++++-------
> 1 file changed, 28 insertions(+), 7 deletions(-)
> @@ -242,3 +243,23 @@ def resume(input_):
>
> print("Thank you for running Piglit!\n"
> "Results have ben wrriten to {0}".format(results_path))
> +
> +
> +def _get_config(arg):
> + if arg:
> + core.PIGLIT_CONFIG.readfp(arg)
> + else:
> + # Try XDG_CONFIG_DIR, then try the local directory, finally try the
^^^^^^^^^^^^^^
Should be XDG_CONFIG_HOME.
> + # root of the piglit dir relative to this file
> + for d in [os.path.expandvars('$HOME/.config'), '.',
> + os.path.join(os.path.dirname(__file__), '..', '..')]:
Resolution of XDG_CONFIG_HOME should respect the environment variable,
if set. Like this:
xdg_config_dir = os.environ.get('XDG_CONFIG_HOME',
os.path.expanduser('~/.config'))
Respect the XDG_CONFIG_HOME env var, and this patches is
Reviewed-by: Chad Versace <chad.versace at linux.intel.com>
Also, I think that any local piglit.conf should override the one in
$XDG_CONFIG_HOME. But I don't want to stall your series on that
difference of opinion.
More information about the Piglit
mailing list