Changes to completely ignore the registry when it detects that you are
running out of the build directory. This means that it will no longer try to use an older version of the library when an older version has been installed.
This commit is contained in:
parent
436364c8a0
commit
e02e48be6f
|
@ -136,23 +136,31 @@ join(buffer, stuff)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
gotlandmark(landmark)
|
||||||
|
char *landmark;
|
||||||
|
{
|
||||||
|
int n, ok;
|
||||||
|
|
||||||
|
n = strlen(prefix);
|
||||||
|
join(prefix, landmark);
|
||||||
|
ok = ismodule(prefix);
|
||||||
|
prefix[n] = '\0';
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
search_for_prefix(argv0_path, landmark)
|
search_for_prefix(argv0_path, landmark)
|
||||||
char *argv0_path;
|
char *argv0_path;
|
||||||
char *landmark;
|
char *landmark;
|
||||||
{
|
{
|
||||||
int n;
|
|
||||||
|
|
||||||
/* Search from argv0_path, until root is found */
|
/* Search from argv0_path, until landmark is found */
|
||||||
strcpy(prefix, argv0_path);
|
strcpy(prefix, argv0_path);
|
||||||
do {
|
do {
|
||||||
n = strlen(prefix);
|
if (gotlandmark(landmark))
|
||||||
join(prefix, landmark);
|
|
||||||
if (ismodule(prefix)) {
|
|
||||||
prefix[n] = '\0';
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
prefix[n] = '\0';
|
|
||||||
reduce(prefix);
|
reduce(prefix);
|
||||||
} while (prefix[0]);
|
} while (prefix[0]);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -175,7 +183,7 @@ extern const char *PyWin_DLLVersionString; // a string loaded from the DLL at st
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
getpythonregpath(HKEY keyBase, BOOL bWin32s)
|
getpythonregpath(HKEY keyBase)
|
||||||
{
|
{
|
||||||
HKEY newKey = 0;
|
HKEY newKey = 0;
|
||||||
DWORD nameSize = 0;
|
DWORD nameSize = 0;
|
||||||
|
@ -206,11 +214,6 @@ getpythonregpath(HKEY keyBase, BOOL bWin32s)
|
||||||
RegQueryInfoKey(newKey, NULL, NULL, NULL, NULL, NULL, NULL,
|
RegQueryInfoKey(newKey, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
&numEntries, &nameSize, &dataSize, NULL, NULL);
|
&numEntries, &nameSize, &dataSize, NULL, NULL);
|
||||||
}
|
}
|
||||||
if (bWin32s && numEntries==0 && dataSize==0) {
|
|
||||||
/* must hardcode for Win32s */
|
|
||||||
numEntries = 1;
|
|
||||||
dataSize = 511;
|
|
||||||
}
|
|
||||||
if (numEntries) {
|
if (numEntries) {
|
||||||
/* Loop over all subkeys. */
|
/* Loop over all subkeys. */
|
||||||
/* Win32s doesnt know how many subkeys, so we do
|
/* Win32s doesnt know how many subkeys, so we do
|
||||||
|
@ -225,7 +228,6 @@ getpythonregpath(HKEY keyBase, BOOL bWin32s)
|
||||||
if (rc) break;
|
if (rc) break;
|
||||||
rc = RegQueryValue(newKey, keyBuf, NULL, &reqdSize);
|
rc = RegQueryValue(newKey, keyBuf, NULL, &reqdSize);
|
||||||
if (rc) break;
|
if (rc) break;
|
||||||
if (bWin32s && reqdSize==0) reqdSize = 512;
|
|
||||||
dataSize += reqdSize + 1; /* 1 for the ";" */
|
dataSize += reqdSize + 1; /* 1 for the ";" */
|
||||||
}
|
}
|
||||||
dataBuf = malloc(dataSize+1);
|
dataBuf = malloc(dataSize+1);
|
||||||
|
@ -333,6 +335,7 @@ calculate_path()
|
||||||
char *envpath = getenv("PYTHONPATH");
|
char *envpath = getenv("PYTHONPATH");
|
||||||
|
|
||||||
#ifdef MS_WIN32
|
#ifdef MS_WIN32
|
||||||
|
int skiphome = 0;
|
||||||
char *machinepath = NULL;
|
char *machinepath = NULL;
|
||||||
char *userpath = NULL;
|
char *userpath = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -352,15 +355,11 @@ calculate_path()
|
||||||
if (envpath && *envpath == '\0')
|
if (envpath && *envpath == '\0')
|
||||||
envpath = NULL;
|
envpath = NULL;
|
||||||
|
|
||||||
|
|
||||||
#ifdef MS_WIN32
|
#ifdef MS_WIN32
|
||||||
/* Are we running under Windows 3.1(1) Win32s? */
|
if (!gotlandmark(BUILD_LANDMARK)) {
|
||||||
if (PyWin_IsWin32s()) {
|
machinepath = getpythonregpath(HKEY_LOCAL_MACHINE);
|
||||||
/* Only CLASSES_ROOT is supported */
|
userpath = getpythonregpath(HKEY_CURRENT_USER);
|
||||||
machinepath = getpythonregpath(HKEY_CLASSES_ROOT, TRUE);
|
|
||||||
userpath = NULL;
|
|
||||||
} else {
|
|
||||||
machinepath = getpythonregpath(HKEY_LOCAL_MACHINE, FALSE);
|
|
||||||
userpath = getpythonregpath(HKEY_CURRENT_USER, FALSE);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -404,11 +403,11 @@ calculate_path()
|
||||||
/* We can't exit, so print a warning and limp along */
|
/* We can't exit, so print a warning and limp along */
|
||||||
fprintf(stderr, "Can't malloc dynamic PYTHONPATH.\n");
|
fprintf(stderr, "Can't malloc dynamic PYTHONPATH.\n");
|
||||||
if (envpath) {
|
if (envpath) {
|
||||||
fprintf(stderr, "Using default static $PYTHONPATH.\n");
|
fprintf(stderr, "Using environment $PYTHONPATH.\n");
|
||||||
module_search_path = envpath;
|
module_search_path = envpath;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "Using environment $PYTHONPATH.\n");
|
fprintf(stderr, "Using default static path.\n");
|
||||||
module_search_path = PYTHONPATH;
|
module_search_path = PYTHONPATH;
|
||||||
}
|
}
|
||||||
#ifdef MS_WIN32
|
#ifdef MS_WIN32
|
||||||
|
@ -431,12 +430,18 @@ calculate_path()
|
||||||
buf = strchr(buf, '\0');
|
buf = strchr(buf, '\0');
|
||||||
*buf++ = DELIM;
|
*buf++ = DELIM;
|
||||||
free(userpath);
|
free(userpath);
|
||||||
|
skiphome = 1;
|
||||||
}
|
}
|
||||||
if (machinepath) {
|
if (machinepath) {
|
||||||
strcpy(buf, machinepath);
|
strcpy(buf, machinepath);
|
||||||
buf = strchr(buf, '\0');
|
buf = strchr(buf, '\0');
|
||||||
*buf++ = DELIM;
|
*buf++ = DELIM;
|
||||||
free(machinepath);
|
free(machinepath);
|
||||||
|
skiphome = 1;
|
||||||
|
}
|
||||||
|
if (skiphome) {
|
||||||
|
*buf = 0;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (pythonhome == NULL) {
|
if (pythonhome == NULL) {
|
||||||
|
|
Loading…
Reference in New Issue