Skip to content

Commit 113e46c

Browse files
committed
Switch to use platlibdir and stdlibdir for python on windows
1 parent a203ed5 commit 113e46c

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

modules/yup_python/scripting/yup_ScriptEngine.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,14 @@ std::unique_ptr<PyConfig> ScriptEngine::prepareScriptingHome (
113113
zip.uncompressTo (libFolder.getParentDirectory());
114114
}
115115

116+
for (auto entry : RangedDirectoryIterator (destinationFolder, true))
117+
YUP_DBG (entry.getFile().getFullPathName());
118+
116119
PyPreConfig preconfig;
117120
PyPreConfig_InitIsolatedConfig (&preconfig);
118121
preconfig.utf8_mode = 1;
119122

120-
if (PyStatus status = Py_PreInitialize (&preconfig); PyStatus_IsError (status))
123+
if (PyStatus status = Py_PreInitialize (&preconfig); status != PyStatus_Ok())
121124
{
122125
YUP_DBG ("Failed Py_PreInitialize");
123126
return nullptr;
@@ -130,14 +133,14 @@ std::unique_ptr<PyConfig> ScriptEngine::prepareScriptingHome (
130133
config->isolated = 1;
131134
config->install_signal_handlers = 0;
132135

133-
if (auto status = PyConfig_SetBytesString (config.get(), &config->program_name, programName.toRawUTF8()); PyStatus_IsError (status))
136+
if (auto status = PyConfig_SetBytesString (config.get(), &config->program_name, programName.toRawUTF8()); status != PyStatus_Ok())
134137
{
135138
YUP_DBG ("Failed config->program_name");
136139
return nullptr;
137140
}
138141

139142
const auto homePath = destinationFolder.getFullPathName();
140-
if (auto status = PyConfig_SetBytesString (config.get(), &config->home, homePath.toRawUTF8()); PyStatus_IsError (status))
143+
if (auto status = PyConfig_SetBytesString (config.get(), &config->home, homePath.toRawUTF8()); status != PyStatus_Ok())
141144
{
142145
YUP_DBG ("Failed config->home");
143146
return nullptr;
@@ -146,15 +149,15 @@ std::unique_ptr<PyConfig> ScriptEngine::prepareScriptingHome (
146149
#if YUP_WINDOWS
147150
const auto prefixPath = destinationFolder.getFullPathName();
148151

149-
if (auto status = PyConfig_SetBytesString (config.get(), &config->prefix, prefixPath.toRawUTF8()); PyStatus_IsError (status))
152+
if (auto status = PyConfig_SetBytesString (config.get(), &config->platlibdir, prefixPath.toRawUTF8()); status != PyStatus_Ok())
150153
{
151-
YUP_DBG ("Failed config->prefix");
154+
YUP_DBG ("Failed config->platlibdir");
152155
return nullptr;
153156
}
154157

155-
if (auto status = PyConfig_SetBytesString (config.get(), &config->exec_prefix, prefixPath.toRawUTF8()); PyStatus_IsError (status))
158+
if (auto status = PyConfig_SetBytesString (config.get(), &config->stdlib_dir, prefixPath.toRawUTF8()); status != PyStatus_Ok())
156159
{
157-
YUP_DBG ("Failed config->exec_prefix");
160+
YUP_DBG ("Failed config->stdlib_dir");
158161
return nullptr;
159162
}
160163

0 commit comments

Comments
 (0)