[PATCH] Minimal fix for non-py2exe config search path

Thomas Arendsen Hein thomas at intevation.de
Sun May 14 12:43:01 CDT 2006


* Stephen Darnell <stephen at darnell.plus.com> [20060505 10:43]:
> This patch prevents looking in the python directory for configuration files.
> I don't have py2exe installed but it seems that sys.frozen should be present
> in that case.
> 
> # HG changeset patch
> # User Stephen Darnell <stephen at darnell.plus.com>
> # Node ID 9d436e9b98aeefbe73cd870a65d1a75baaa2dbb7
> # Parent  b8b7a79a4d8823acd9a7527a234577cb60873b9a
> On win, only use executable path for rc files when built with py2exe
> 
> diff -r b8b7a79a4d88 -r 9d436e9b98ae mercurial/util.py
> --- a/mercurial/util.py	Thu May 04 22:38:14 2006 -0700
> +++ b/mercurial/util.py	Fri May 05 09:36:51 2006 +0100
> @@ -520,9 +520,11 @@ if os.name == 'nt':
> 
>     def system_rcpath():
>         try:
> -            return system_rcpath_win32()
> +            if hasattr(sys, "frozen"):
> +                return system_rcpath_win32()
>         except:
> -            return [r'c:\mercurial\mercurial.ini']
> +            pass
> +        return [r'c:\mercurial\mercurial.ini']
> 
>     def os_rcpath():
>         '''return default os-specific hgrc search path'''

Would be better to always look in both locations so the user is less
surprised?

And why doesn't something like
os.path.join(os.path.dirname(sys.argv[0]), 'mercurial.ini')
work on windows?

Thomas

-- 
Email: thomas at intevation.de
http://intevation.de/~thomas/


More information about the Mercurial mailing list