Skip to content

Commit 05ac332

Browse files
committed
Merge branch 'hotfix/0.6.11.4'
2 parents 3ee907a + 3d87c7b commit 05ac332

File tree

12 files changed

+95
-36
lines changed

12 files changed

+95
-36
lines changed

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
nuitka (0.6.11.4+ds-1) unstable; urgency=medium
2+
3+
* New upstream hotfix release.
4+
5+
-- Kay Hayen <kay.hayen@gmail.com> Wed, 27 Jan 2021 17:09:48 +0100
6+
17
nuitka (0.6.11.3+ds-1) unstable; urgency=medium
28

39
* New upstream hotfix release.

nuitka/Options.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,9 @@ def getIconPaths():
665665
result.append(default_icon)
666666
else:
667667
Tracing.general.sysexit(
668-
"Error, on the default icon '%s' does not exist, making --linux-onefile-icon required."
668+
"""\
669+
Error, the default icon %r does not exist, making --linux-onefile-icon required."""
670+
% default_icon
669671
)
670672

671673
return result

nuitka/Version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"""
2121

2222
version_string = """\
23-
Nuitka V0.6.11.3
23+
Nuitka V0.6.11.4
2424
Copyright (C) 2021 Kay Hayen."""
2525

2626

nuitka/build/Backend.scons

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,17 @@ if the_compiler is None or getExecutablePath(the_compiler, env=env) is None:
398398

399399
# Check if there is a WindowsSDK installed.
400400
if msvc_mode or clangcl_mode:
401-
scons_details_logger.info("Using Windows SDK %r." % env["WindowsSDKVersion"])
401+
if "WindowsSDKVersion" not in env:
402+
if "WindowsSDKVersion" in os.environ:
403+
windows_sdk_version = os.environ["WindowsSDKVersion"].rstrip("\\")
404+
else:
405+
windows_sdk_version = None
406+
else:
407+
windows_sdk_version = env["WindowsSDKVersion"]
408+
409+
scons_details_logger.info("Using Windows SDK %r." % windows_sdk_version)
402410

403-
if not env["WindowsSDKVersion"]:
411+
if not windows_sdk_version:
404412
scons_logger.sysexit(
405413
"Error, the Windows SDK must be installed in Visual Studio."
406414
)

nuitka/build/SconsCaching.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def _injectCcache(the_compiler, cc_path, env, python_prefix, assume_yes_for_down
119119
assert getExecutablePath(os.path.basename(the_compiler), env=env) == cc_path
120120

121121
# We use absolute paths for CC, pass it like this, as ccache does not like absolute.
122-
env["CXX"] = env["CC"] = "%s %s" % (ccache_binary, cc_path)
122+
env["CXX"] = env["CC"] = '%s "%s"' % (ccache_binary, cc_path)
123123

124124
# Spare ccache the detection of the compiler, seems it will also misbehave when it's
125125
# prefixed with "ccache" on old gcc versions in terms of detecting need for C++ linkage.

nuitka/build/static_src/CompiledCodeHelpers.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,11 +1787,12 @@ wchar_t const *getBinaryDirectoryWideChars() {
17871787
}
17881788

17891789
binary_directory[0] = 0;
1790-
appendWStringSafeW(binary_directory, short_binary_directory, sizeof(binary_directory));
1790+
appendWStringSafeW(binary_directory, short_binary_directory, sizeof(binary_directory) / sizeof(wchar_t));
17911791

17921792
free(short_binary_directory);
17931793
#else
1794-
appendStringSafeW(binary_directory, getBinaryDirectoryHostEncoded(), sizeof(binary_directory));
1794+
appendStringSafeW(binary_directory, getBinaryDirectoryHostEncoded(),
1795+
sizeof(binary_directory) / sizeof(wchar_t));
17951796
#endif
17961797

17971798
init_done = true;

nuitka/build/static_src/MetaPathBasedLoader.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -829,10 +829,10 @@ static PyObject *loadModule(PyObject *module, PyObject *module_name,
829829
#ifdef _WIN32
830830
wchar_t filename[MAXPATHLEN + 1] = {0};
831831

832-
appendWStringSafeW(filename, getBinaryDirectoryWideChars(), sizeof(filename));
833-
appendCharSafeW(filename, SEP, sizeof(filename));
834-
appendModulenameAsPathW(filename, entry->name, sizeof(filename));
835-
appendStringSafeW(filename, ".pyd", sizeof(filename));
832+
appendWStringSafeW(filename, getBinaryDirectoryWideChars(), sizeof(filename) / sizeof(wchar_t));
833+
appendCharSafeW(filename, SEP, sizeof(filename) / sizeof(wchar_t));
834+
appendModulenameAsPathW(filename, entry->name, sizeof(filename) / sizeof(wchar_t));
835+
appendStringSafeW(filename, ".pyd", sizeof(filename) / sizeof(wchar_t));
836836
#else
837837
char filename[MAXPATHLEN + 1] = {0};
838838

nuitka/build/static_src/WindowsOnefile.c

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@ static unsigned long long readSizeValue(HANDLE exe_file) {
114114
return result;
115115
}
116116

117+
static void printError(char const *message) {
118+
LPCTSTR err_buffer;
119+
120+
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
121+
GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&err_buffer, 0, NULL);
122+
123+
puts(message);
124+
puts(err_buffer);
125+
}
126+
117127
#ifdef _NUITKA_WINMAIN_ENTRY_POINT
118128
int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, char *lpCmdLine, int nCmdShow) {
119129
#if defined(__MINGW32__) && !defined(_W64)
@@ -134,10 +144,11 @@ int main(int argc, char **argv) {
134144

135145
static wchar_t exe_filename[4096] = {0};
136146

137-
DWORD res = GetModuleFileNameW(NULL, exe_filename, sizeof(exe_filename));
138-
assert(res != 0);
139-
140-
// _putws(exe_filename);
147+
DWORD res = GetModuleFileNameW(NULL, exe_filename, sizeof(exe_filename) / sizeof(wchar_t));
148+
if (res == 0) {
149+
printError("Error, failed to locate onefile filename.");
150+
return 1;
151+
}
141152

142153
static wchar_t payload_path[4096] = {0};
143154

@@ -166,24 +177,29 @@ int main(int argc, char **argv) {
166177
}
167178
printf("SHGetFolderPathW failed: %s\n", error_message);
168179
}
180+
181+
return 1;
169182
}
170183

171184
// _putws(payload_path);
172-
appendWCharSafeW(payload_path, L'\\', sizeof(payload_path));
173-
appendWStringSafeW(payload_path, L"" ONEFILE_COMPANY, sizeof(payload_path));
185+
appendWCharSafeW(payload_path, L'\\', sizeof(payload_path) / sizeof(wchar_t));
186+
appendWStringSafeW(payload_path, L"" ONEFILE_COMPANY, sizeof(payload_path) / sizeof(wchar_t));
174187

175188
bool_res = CreateDirectoryW(payload_path, NULL);
176189

177190
appendWCharSafeW(payload_path, L'\\', sizeof(payload_path));
178-
appendWStringSafeW(payload_path, L"" ONEFILE_PRODUCT, sizeof(payload_path));
191+
appendWStringSafeW(payload_path, L"" ONEFILE_PRODUCT, sizeof(payload_path) / sizeof(wchar_t));
179192
bool_res = CreateDirectoryW(payload_path, NULL);
180193

181194
appendWCharSafeW(payload_path, L'\\', sizeof(payload_path));
182-
appendWStringSafeW(payload_path, L"" ONEFILE_VERSION, sizeof(payload_path));
195+
appendWStringSafeW(payload_path, L"" ONEFILE_VERSION, sizeof(payload_path) / sizeof(wchar_t));
183196

184197
#else
185-
res = GetTempPathW(sizeof(payload_path), payload_path);
186-
assert(res != 0);
198+
res = GetTempPathW(sizeof(payload_path) / sizeof(wchar_t), payload_path);
199+
if (res == 0) {
200+
printError("Temporary path cannot be detected.");
201+
return 1;
202+
}
187203

188204
// Best effort to make temp path unique by using PID and time.
189205
{
@@ -194,17 +210,16 @@ int main(int argc, char **argv) {
194210
GetSystemTimeAsFileTime((LPFILETIME)&time);
195211

196212
swprintf(buffer, sizeof(buffer), L"\\onefile_%d_%lld", GetCurrentProcessId(), time);
197-
appendWStringSafeW(payload_path, buffer, sizeof(payload_path));
213+
appendWStringSafeW(payload_path, buffer, sizeof(payload_path) / sizeof(wchar_t));
198214
}
199215
#endif
200-
// _putws(payload_path);
201-
202216
bool_res = CreateDirectoryW(payload_path, NULL);
203217

204-
// _putws(payload_path);
205-
206218
HANDLE exe_file = CreateFileW(exe_filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
207-
assert(exe_file != INVALID_HANDLE_VALUE);
219+
if (exe_file == INVALID_HANDLE_VALUE) {
220+
printError("Error, failed to access unpacked executable.");
221+
return 1;
222+
}
208223

209224
res = SetFilePointer(exe_file, -8, NULL, FILE_END);
210225
assert(res != INVALID_SET_FILE_POINTER);
@@ -254,9 +269,9 @@ int main(int argc, char **argv) {
254269
*w = 0;
255270

256271
target_path[0] = 0;
257-
appendWStringSafeW(target_path, payload_path, sizeof(target_path));
258-
appendWCharSafeW(target_path, L'\\', sizeof(target_path));
259-
appendWStringSafeW(target_path, filename, sizeof(target_path));
272+
appendWStringSafeW(target_path, payload_path, sizeof(target_path) / sizeof(wchar_t));
273+
appendWCharSafeW(target_path, L'\\', sizeof(target_path) / sizeof(wchar_t));
274+
appendWStringSafeW(target_path, filename, sizeof(target_path) / sizeof(wchar_t));
260275

261276
*w = L'\\';
262277

@@ -268,12 +283,12 @@ int main(int argc, char **argv) {
268283
}
269284

270285
target_path[0] = 0;
271-
appendWStringSafeW(target_path, payload_path, sizeof(target_path));
272-
appendWCharSafeW(target_path, L'\\', sizeof(target_path));
273-
appendWStringSafeW(target_path, filename, sizeof(target_path));
286+
appendWStringSafeW(target_path, payload_path, sizeof(target_path) / sizeof(wchar_t));
287+
appendWCharSafeW(target_path, L'\\', sizeof(target_path) / sizeof(wchar_t));
288+
appendWStringSafeW(target_path, filename, sizeof(target_path) / sizeof(wchar_t));
274289

275290
if (first_filename[0] == 0) {
276-
appendWStringSafeW(first_filename, target_path, sizeof(target_path));
291+
appendWStringSafeW(first_filename, target_path, sizeof(target_path) / sizeof(wchar_t));
277292
}
278293

279294
// _putws(target_path);

nuitka/codegen/templates/CodeTemplatesModules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,12 @@
233233
flags_int,
234234
function_name,
235235
argnames,
236+
NULL, // freevars
236237
arg_count_int,
237238
0, // TODO: Missing kw_only_count
238239
0 // TODO: Missing pos_only_count
239240
);
240241
241-
// TODO: More stuff needed for Python3, best to re-order arguments of MAKE_CODEOBJECT.
242242
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
243243
functable_%(module_identifier)s[offset],
244244
code_object->co_name,

nuitka/plugins/standard/ImplicitImports.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from nuitka.plugins.PluginBase import NuitkaPluginBase
3232
from nuitka.PythonVersions import python_version
3333
from nuitka.utils.FileOperations import getFileContentByLine
34+
from nuitka.utils.Importing import getSharedLibrarySuffix
3435
from nuitka.utils.ModuleNames import ModuleName
3536
from nuitka.utils.SharedLibraries import getPyWin32Dir, locateDLL
3637
from nuitka.utils.Utils import getOS, isWin32Windows
@@ -1489,6 +1490,18 @@ def considerExtraDlls(self, dist_dir, module):
14891490

14901491
return result
14911492

1493+
elif full_name == "zmq.libzmq" and isWin32Windows():
1494+
# TODO: Very strange thing for zmq on Windows, needs the .pyd file in wrong dir too. Have
1495+
# this done in a dedicated form somewhere.
1496+
shutil.copyfile(
1497+
os.path.join(dist_dir, "zmq\\libzmq.pyd"),
1498+
os.path.join(
1499+
dist_dir, "libzmq" + getSharedLibrarySuffix(preferred=True)
1500+
),
1501+
)
1502+
1503+
return ()
1504+
14921505
return ()
14931506

14941507
unworthy_namespaces = (

nuitka/utils/FileOperations.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
from .Importing import importFromInlineCopy
4242
from .ThreadedExecutor import RLock, getThreadIdent
43-
from .Utils import getOS
43+
from .Utils import getOS, isWin32Windows
4444

4545
# Locking seems to be only required for Windows mostly, but we can keep
4646
# it for all.
@@ -470,10 +470,21 @@ def copyTree(source_path, dest_path):
470470
copy_tree(source_path, dest_path)
471471

472472

473+
def getWindowsDrive(path):
474+
"""Windows drive for a given path."""
475+
476+
drive, _ = os.path.splitdrive(os.path.abspath(path))
477+
return os.path.normcase(drive)
478+
479+
473480
def isPathBelow(path, filename):
474481
path = os.path.abspath(path)
475482
filename = os.path.abspath(filename)
476483

484+
if isWin32Windows():
485+
if getWindowsDrive(path) != getWindowsDrive(filename):
486+
return False
487+
477488
return os.path.relpath(filename, path).split(os.path.sep)[0] != ".."
478489

479490

tests/standalone/run_all.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,9 @@ def main():
311311
if loaded_filename.startswith("/etc/"):
312312
continue
313313

314+
if loaded_filename.startswith("/usr/etc/"):
315+
continue
316+
314317
if loaded_filename.startswith("/proc/") or loaded_filename == "/proc":
315318
continue
316319

0 commit comments

Comments
 (0)