Patchwork [3,of,3] exewrapper: add comments about PYTHONHOME

login
register
mail settings
Submitter Adrian Buehlmann
Date Oct. 14, 2015, 10:38 a.m.
Message ID <cc306e37fbaf8cf45b23.1444819095@kork>
Download mbox | patch
Permalink /patch/11046/
State Accepted
Headers show

Comments

Adrian Buehlmann - Oct. 14, 2015, 10:38 a.m.
# HG changeset patch
# User Adrian Buehlmann <adrian@cadifra.com>
# Date 1444818229 -7200
# Node ID cc306e37fbaf8cf45b23dd1a7467daf89607376e
# Parent  0bda366cf908c3ed6b67efed9d648efb3066bd78
exewrapper: add comments about PYTHONHOME

This has been a repeating source of confusion for users of HackableMercurial.

Note that users of HackableMercurial should *not* and are *not* expected to set
PYTHONHOME.
Augie Fackler - Oct. 14, 2015, 2:52 p.m.
On Wed, Oct 14, 2015 at 12:38:15PM +0200, Adrian Buehlmann wrote:
> # HG changeset patch
> # User Adrian Buehlmann <adrian@cadifra.com>
> # Date 1444818229 -7200
> # Node ID cc306e37fbaf8cf45b23dd1a7467daf89607376e
> # Parent  0bda366cf908c3ed6b67efed9d648efb3066bd78
> exewrapper: add comments about PYTHONHOME

queued these, many thanks

>
> This has been a repeating source of confusion for users of HackableMercurial.
>
> Note that users of HackableMercurial should *not* and are *not* expected to set
> PYTHONHOME.
>
> diff --git a/mercurial/exewrapper.c b/mercurial/exewrapper.c
> --- a/mercurial/exewrapper.c
> +++ b/mercurial/exewrapper.c
> @@ -67,10 +67,19 @@
>       }
>
>       pydll = NULL;
> +	/*
> +	We first check, that environment variable PYTHONHOME is *not* set.
> +	This just mimicks the behavior of the regular python.exe, which uses
> +	PYTHONHOME to find its installation directory (if it has been set).
> +	Note: Users of HackableMercurial are expected to *not* set PYTHONHOME!
> +	*/
>       if (GetEnvironmentVariable("PYTHONHOME", envpyhome,
>                                  sizeof(envpyhome)) == 0)
>       {
> -		/* environment var PYTHONHOME is not set */
> +		/*
> +		Environment var PYTHONHOME is *not* set. Let's see if we are
> +		running inside a HackableMercurial.
> +		*/
>
>               p = strrchr(pyhome, '\\');
>               if (p == NULL) {
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/exewrapper.c b/mercurial/exewrapper.c
--- a/mercurial/exewrapper.c
+++ b/mercurial/exewrapper.c
@@ -67,10 +67,19 @@ 
 	}
 
 	pydll = NULL;
+	/*
+	We first check, that environment variable PYTHONHOME is *not* set.
+	This just mimicks the behavior of the regular python.exe, which uses
+	PYTHONHOME to find its installation directory (if it has been set).
+	Note: Users of HackableMercurial are expected to *not* set PYTHONHOME!
+	*/
 	if (GetEnvironmentVariable("PYTHONHOME", envpyhome,
 				   sizeof(envpyhome)) == 0)
 	{
-		/* environment var PYTHONHOME is not set */
+		/*
+		Environment var PYTHONHOME is *not* set. Let's see if we are
+		running inside a HackableMercurial.
+		*/
 
 		p = strrchr(pyhome, '\\');
 		if (p == NULL) {