Nuitka-winsvc 1.8.6__cp312-cp312-win_amd64.whl → 1.9.3__cp312-cp312-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/RECORD +212 -203
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/WHEEL +1 -1
- nuitka/BytecodeCaching.py +4 -1
- nuitka/HardImportRegistry.py +348 -0
- nuitka/MainControl.py +45 -25
- nuitka/OptionParsing.py +31 -20
- nuitka/Options.py +47 -16
- nuitka/Progress.py +32 -2
- nuitka/PythonFlavors.py +1 -1
- nuitka/PythonVersions.py +61 -0
- nuitka/Tracing.py +25 -12
- nuitka/TreeXML.py +5 -5
- nuitka/Variables.py +15 -24
- nuitka/Version.py +16 -6
- nuitka/__main__.py +15 -0
- nuitka/__past__.py +15 -17
- nuitka/build/Backend.scons +44 -35
- nuitka/build/CCompilerVersion.scons +10 -9
- nuitka/build/Onefile.scons +11 -26
- nuitka/build/SconsCaching.py +2 -0
- nuitka/build/SconsCompilerSettings.py +72 -22
- nuitka/build/SconsHacks.py +1 -0
- nuitka/build/SconsInterface.py +5 -0
- nuitka/build/SconsSpawn.py +16 -3
- nuitka/build/SconsUtils.py +11 -12
- nuitka/build/include/nuitka/checksum_tools.h +0 -4
- nuitka/build/include/nuitka/compiled_asyncgen.h +1 -1
- nuitka/build/include/nuitka/compiled_coroutine.h +1 -1
- nuitka/build/include/nuitka/compiled_frame.h +7 -4
- nuitka/build/include/nuitka/compiled_function.h +13 -3
- nuitka/build/include/nuitka/compiled_generator.h +1 -1
- nuitka/build/include/nuitka/constants.h +2 -0
- nuitka/build/include/nuitka/environment_variables.h +45 -0
- nuitka/build/include/nuitka/exceptions.h +32 -4
- nuitka/build/include/nuitka/filesystem_paths.h +6 -1
- nuitka/build/include/nuitka/freelists.h +11 -1
- nuitka/build/include/nuitka/helper/dictionaries.h +1 -1
- nuitka/build/include/nuitka/helper/import_hard.h +3 -0
- nuitka/build/include/nuitka/helpers.h +2 -0
- nuitka/build/include/nuitka/importing.h +3 -0
- nuitka/build/include/nuitka/prelude.h +17 -6
- nuitka/build/include/nuitka/unfreezing.h +1 -1
- nuitka/build/inline_copy/bin/scons.py +14 -0
- nuitka/build/inline_copy/tqdm/tqdm/__init__.py +2 -2
- nuitka/build/inline_copy/tqdm/tqdm/utils.py +14 -8
- nuitka/build/inline_copy/zlib/LICENSE +22 -0
- nuitka/build/inline_copy/zlib/crc32.c +1049 -0
- nuitka/build/inline_copy/zlib/crc32.h +9446 -0
- nuitka/build/inline_copy/zlib/zconf.h +551 -0
- nuitka/build/inline_copy/zlib/zlib.h +1938 -0
- nuitka/build/inline_copy/zlib/zutil.h +275 -0
- nuitka/build/static_src/CompiledAsyncgenType.c +41 -41
- nuitka/build/static_src/CompiledCodeHelpers.c +14 -7
- nuitka/build/static_src/CompiledCoroutineType.c +60 -51
- nuitka/build/static_src/CompiledFrameType.c +12 -12
- nuitka/build/static_src/CompiledFunctionType.c +149 -28
- nuitka/build/static_src/CompiledGeneratorType.c +64 -65
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +1 -1
- nuitka/build/static_src/CompiledMethodType.c +5 -3
- nuitka/build/static_src/HelperEnvironmentVariables.c +120 -0
- nuitka/build/static_src/HelpersAttributes.c +1 -1
- nuitka/build/static_src/HelpersBuiltin.c +1 -1
- nuitka/build/static_src/HelpersChecksumTools.c +19 -4
- nuitka/build/static_src/HelpersComparisonEq.c +4 -4
- nuitka/build/static_src/HelpersComparisonNe.c +4 -4
- nuitka/build/static_src/HelpersConstantsBlob.c +40 -23
- nuitka/build/static_src/HelpersDictionaries.c +3 -1
- nuitka/build/static_src/HelpersDictionariesGenerated.c +9 -9
- nuitka/build/static_src/HelpersFilesystemPaths.c +12 -2
- nuitka/build/static_src/HelpersImport.c +29 -1
- nuitka/build/static_src/HelpersImportHard.c +19 -0
- nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +5 -4
- nuitka/build/static_src/HelpersPythonPgo.c +5 -5
- nuitka/build/static_src/HelpersSafeStrings.c +2 -1
- nuitka/build/static_src/HelpersStrings.c +12 -10
- nuitka/build/static_src/HelpersTypes.c +1 -1
- nuitka/build/static_src/InspectPatcher.c +3 -2
- nuitka/build/static_src/MainProgram.c +182 -214
- nuitka/build/static_src/MetaPathBasedLoader.c +36 -23
- nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +4 -2
- nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +38 -2
- nuitka/build/static_src/OnefileBootstrap.c +124 -93
- nuitka/code_generation/CodeGeneration.py +4 -2
- nuitka/code_generation/CodeObjectCodes.py +5 -1
- nuitka/code_generation/ConstantCodes.py +4 -0
- nuitka/code_generation/Contexts.py +111 -3
- nuitka/code_generation/DictCodes.py +5 -5
- nuitka/code_generation/FunctionCodes.py +4 -2
- nuitka/code_generation/GlobalConstants.py +10 -0
- nuitka/code_generation/ImportCodes.py +69 -33
- nuitka/code_generation/ModuleCodes.py +4 -1
- nuitka/code_generation/Namify.py +6 -5
- nuitka/code_generation/YieldCodes.py +3 -3
- nuitka/code_generation/templates/CodeTemplatesModules.py +61 -95
- nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +3 -3
- nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +2 -2
- nuitka/distutils/DistutilCommands.py +3 -0
- nuitka/finalizations/FinalizeMarkups.py +1 -1
- nuitka/freezer/DependsExe.py +2 -1
- nuitka/freezer/DllDependenciesPosix.py +11 -1
- nuitka/freezer/IncludedEntryPoints.py +54 -16
- nuitka/freezer/Onefile.py +7 -3
- nuitka/freezer/Standalone.py +39 -17
- nuitka/importing/Importing.py +195 -62
- nuitka/importing/PreloadedPackages.py +2 -1
- nuitka/importing/Recursion.py +98 -27
- nuitka/importing/StandardLibrary.py +7 -4
- nuitka/nodes/BuiltinOpenNodes.py +28 -1
- nuitka/nodes/BuiltinRangeNodes.py +2 -2
- nuitka/nodes/BuiltinSumNodes.py +1 -1
- nuitka/nodes/ChildrenHavingMixins.py +326 -2
- nuitka/nodes/HardImportNodesGenerated.py +141 -38
- nuitka/nodes/ImportHardNodes.py +0 -8
- nuitka/nodes/ImportNodes.py +267 -361
- nuitka/nodes/IterationHandles.py +36 -17
- nuitka/nodes/LocalsScopes.py +3 -1
- nuitka/nodes/NodeBases.py +8 -14
- nuitka/nodes/OperatorNodes.py +9 -9
- nuitka/nodes/OutlineNodes.py +3 -3
- nuitka/nodes/PackageMetadataNodes.py +19 -9
- nuitka/nodes/SliceNodes.py +1 -1
- nuitka/nodes/VariableAssignNodes.py +25 -15
- nuitka/nodes/VariableRefNodes.py +7 -7
- nuitka/nodes/YieldNodes.py +2 -2
- nuitka/nodes/shapes/BuiltinTypeShapes.py +81 -6
- nuitka/nodes/shapes/ShapeMixins.py +21 -0
- nuitka/nodes/shapes/StandardShapes.py +9 -3
- nuitka/optimizations/OptimizeBuiltinCalls.py +1 -1
- nuitka/optimizations/TraceCollections.py +75 -0
- nuitka/pgo/PGO.py +14 -6
- nuitka/plugins/PluginBase.py +83 -11
- nuitka/plugins/Plugins.py +78 -35
- nuitka/plugins/standard/AntiBloatPlugin.py +46 -1
- nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +1 -1
- nuitka/plugins/standard/DelvewheelPlugin.py +2 -1
- nuitka/plugins/standard/DillPlugin.py +3 -99
- nuitka/plugins/standard/DllFilesPlugin.py +45 -0
- nuitka/plugins/standard/GiPlugin.py +23 -10
- nuitka/plugins/standard/GlfwPlugin.py +1 -0
- nuitka/plugins/standard/ImplicitImports.py +267 -15
- nuitka/plugins/standard/KivyPlugin.py +1 -0
- nuitka/plugins/standard/MatplotlibPlugin.py +43 -25
- nuitka/plugins/standard/OptionsNannyPlugin.py +5 -6
- nuitka/plugins/standard/PkgResourcesPlugin.py +1 -1
- nuitka/plugins/standard/PmwPlugin.py +1 -1
- nuitka/plugins/standard/PySidePyQtPlugin.py +37 -20
- nuitka/plugins/standard/TkinterPlugin.py +44 -30
- nuitka/plugins/standard/TransformersPlugin.py +3 -1
- nuitka/plugins/standard/standard.nuitka-package.config.yml +522 -86
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +8 -1
- nuitka/reports/CompilationReportReader.py +53 -0
- nuitka/reports/LicenseReport.rst.j2 +4 -4
- nuitka/reports/Reports.py +129 -47
- nuitka/specs/HardImportSpecs.py +6 -0
- nuitka/tools/data_composer/DataComposer.py +29 -17
- nuitka/tools/onefile_compressor/OnefileCompressor.py +173 -110
- nuitka/tools/podman/__main__.py +17 -2
- nuitka/tools/scanning/DisplayPackageDLLs.py +11 -2
- nuitka/tools/scanning/DisplayPackageData.py +1 -1
- nuitka/tools/specialize/CTypeDescriptions.py +36 -27
- nuitka/tools/specialize/SpecializeC.py +1 -1
- nuitka/tools/specialize/SpecializePython.py +16 -0
- nuitka/tools/testing/Common.py +3 -4
- nuitka/tools/testing/OutputComparison.py +23 -0
- nuitka/tools/testing/SearchModes.py +2 -2
- nuitka/tools/testing/compare_with_cpython/__main__.py +13 -4
- nuitka/tools/testing/measure_construct_performance/__main__.py +2 -5
- nuitka/tools/watch/__main__.py +194 -56
- nuitka/tree/Building.py +8 -2
- nuitka/tree/ComplexCallHelperFunctions.py +45 -15
- nuitka/tree/ReformulationAssignmentStatements.py +18 -12
- nuitka/tree/ReformulationCallExpressions.py +1 -1
- nuitka/tree/ReformulationClasses.py +11 -5
- nuitka/tree/ReformulationClasses3.py +30 -12
- nuitka/tree/ReformulationComparisonExpressions.py +4 -2
- nuitka/tree/ReformulationContractionExpressions.py +19 -11
- nuitka/tree/ReformulationDictionaryCreation.py +9 -3
- nuitka/tree/ReformulationExecStatements.py +6 -6
- nuitka/tree/ReformulationForLoopStatements.py +5 -5
- nuitka/tree/ReformulationFunctionStatements.py +6 -2
- nuitka/tree/ReformulationImportStatements.py +7 -2
- nuitka/tree/ReformulationLambdaExpressions.py +1 -1
- nuitka/tree/ReformulationMatchStatements.py +3 -1
- nuitka/tree/ReformulationNamespacePackages.py +7 -3
- nuitka/tree/ReformulationPrintStatements.py +1 -1
- nuitka/tree/ReformulationSequenceCreation.py +18 -6
- nuitka/tree/ReformulationWithStatements.py +8 -8
- nuitka/tree/ReformulationYieldExpressions.py +2 -2
- nuitka/tree/SourceHandling.py +27 -5
- nuitka/tree/VariableClosure.py +11 -1
- nuitka/utils/AppDirs.py +2 -2
- nuitka/utils/CStrings.py +39 -3
- nuitka/utils/CommandLineOptions.py +42 -1
- nuitka/utils/Distributions.py +305 -38
- nuitka/utils/Download.py +27 -8
- nuitka/utils/FileOperations.py +103 -20
- nuitka/utils/Hashing.py +2 -3
- nuitka/utils/Importing.py +60 -3
- nuitka/utils/InstalledPythons.py +31 -36
- nuitka/utils/Jinja2.py +11 -5
- nuitka/utils/ModuleNames.py +11 -3
- nuitka/utils/ReExecute.py +7 -0
- nuitka/utils/SharedLibraries.py +38 -14
- nuitka/utils/SlotMetaClasses.py +55 -0
- nuitka/utils/Utils.py +10 -0
- nuitka/utils/Yaml.py +9 -1
- nuitka/build/inline_copy/tqdm/tqdm/_tqdm_gui.py +0 -9
- nuitka/build/inline_copy/tqdm/tqdm/gui.py +0 -191
- {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka-run.bat +0 -0
- {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka.bat +0 -0
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/top_level.txt +0 -0
|
@@ -77,7 +77,7 @@ static bool hasFrozenModule(char const *name) {
|
|
|
77
77
|
return true;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
static char *
|
|
80
|
+
static char *appendModuleNameAsPath(char *buffer, char const *module_name, size_t buffer_size) {
|
|
81
81
|
// Skip to the end
|
|
82
82
|
while (*buffer != 0) {
|
|
83
83
|
buffer++;
|
|
@@ -105,7 +105,7 @@ static char *appendModulenameAsPath(char *buffer, char const *module_name, size_
|
|
|
105
105
|
|
|
106
106
|
#if defined(_WIN32) && defined(_NUITKA_STANDALONE)
|
|
107
107
|
|
|
108
|
-
static void
|
|
108
|
+
static void appendModuleNameAsPathW(wchar_t *buffer, char const *module_name, size_t buffer_size) {
|
|
109
109
|
// Skip to the end
|
|
110
110
|
while (*buffer != 0) {
|
|
111
111
|
buffer++;
|
|
@@ -150,7 +150,7 @@ static void patchCodeObjectPaths(PyCodeObject *code_object, PyObject *module_pat
|
|
|
150
150
|
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_RELATIVE_PATH_FROM_NAME(char const *name, bool is_package, bool dir_only) {
|
|
151
151
|
char buffer[MAXPATHLEN + 1] = {0};
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
appendModuleNameAsPath(buffer, name, sizeof(buffer));
|
|
154
154
|
|
|
155
155
|
if (dir_only == false) {
|
|
156
156
|
if (is_package) {
|
|
@@ -184,15 +184,17 @@ static PyObject *loadModuleFromCodeObject(PyObject *module, PyCodeObject *code_o
|
|
|
184
184
|
bool is_package) {
|
|
185
185
|
assert(code_object != NULL);
|
|
186
186
|
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
{
|
|
188
|
+
NUITKA_MAY_BE_UNUSED bool b_res = Nuitka_SetModuleString(name, module);
|
|
189
|
+
assert(b_res != false);
|
|
190
|
+
}
|
|
189
191
|
|
|
190
192
|
char buffer[MAXPATHLEN + 1] = {0};
|
|
191
193
|
|
|
192
194
|
PyObject *module_path_entry = NULL;
|
|
193
195
|
|
|
194
196
|
if (is_package) {
|
|
195
|
-
|
|
197
|
+
appendModuleNameAsPath(buffer, name, sizeof(buffer));
|
|
196
198
|
PyObject *module_path_entry_base = Nuitka_String_FromString(buffer);
|
|
197
199
|
|
|
198
200
|
module_path_entry = MAKE_RELATIVE_PATH(module_path_entry_base);
|
|
@@ -201,7 +203,7 @@ static PyObject *loadModuleFromCodeObject(PyObject *module, PyCodeObject *code_o
|
|
|
201
203
|
appendCharSafe(buffer, SEP, sizeof(buffer));
|
|
202
204
|
appendStringSafe(buffer, "__init__.py", sizeof(buffer));
|
|
203
205
|
} else {
|
|
204
|
-
|
|
206
|
+
appendModuleNameAsPath(buffer, name, sizeof(buffer));
|
|
205
207
|
appendStringSafe(buffer, ".py", sizeof(buffer));
|
|
206
208
|
}
|
|
207
209
|
|
|
@@ -386,7 +388,7 @@ static bool scanModuleInPackagePath(PyThreadState *tstate, PyObject *module_name
|
|
|
386
388
|
PyObject *candidates = MAKE_LIST_EMPTY(0);
|
|
387
389
|
|
|
388
390
|
// Search only relative to the parent name of course.
|
|
389
|
-
char const *
|
|
391
|
+
char const *module_relative_name_str = Nuitka_String_AsString(module_name) + strlen(parent_module_name) + 1;
|
|
390
392
|
|
|
391
393
|
Py_ssize_t parent_path_size = PyList_GET_SIZE(parent_path);
|
|
392
394
|
|
|
@@ -408,8 +410,8 @@ static bool scanModuleInPackagePath(PyThreadState *tstate, PyObject *module_name
|
|
|
408
410
|
if (Nuitka_String_CheckExact(filename)) {
|
|
409
411
|
char const *filename_str = Nuitka_String_AsString(filename);
|
|
410
412
|
|
|
411
|
-
if (strncmp(filename_str,
|
|
412
|
-
filename_str[strlen(
|
|
413
|
+
if (strncmp(filename_str, module_relative_name_str, strlen(module_relative_name_str)) == 0 &&
|
|
414
|
+
filename_str[strlen(module_relative_name_str)] == '.') {
|
|
413
415
|
LIST_APPEND1(candidates, PyTuple_Pack(2, path_element, filename));
|
|
414
416
|
}
|
|
415
417
|
}
|
|
@@ -419,7 +421,7 @@ static bool scanModuleInPackagePath(PyThreadState *tstate, PyObject *module_name
|
|
|
419
421
|
#if 0
|
|
420
422
|
PRINT_STRING("CANDIDATES:");
|
|
421
423
|
PRINT_STRING(Nuitka_String_AsString(module_name));
|
|
422
|
-
PRINT_STRING(
|
|
424
|
+
PRINT_STRING(module_relative_name_str);
|
|
423
425
|
PRINT_ITEM(candidates);
|
|
424
426
|
PRINT_NEW_LINE();
|
|
425
427
|
#endif
|
|
@@ -442,7 +444,7 @@ static bool scanModuleInPackagePath(PyThreadState *tstate, PyObject *module_name
|
|
|
442
444
|
|
|
443
445
|
char const *candidate_str = Nuitka_String_AsString(candidate);
|
|
444
446
|
|
|
445
|
-
if (strcmp(suffix_str, candidate_str + strlen(
|
|
447
|
+
if (strcmp(suffix_str, candidate_str + strlen(module_relative_name_str)) == 0) {
|
|
446
448
|
PyObject *fullpath = JOIN_PATH2(directory, candidate);
|
|
447
449
|
|
|
448
450
|
if (installed_extension_modules == NULL) {
|
|
@@ -723,6 +725,8 @@ static PyObject *callIntoExtensionModule(PyThreadState *tstate, char const *full
|
|
|
723
725
|
#else
|
|
724
726
|
// This code would work for all versions, we are avoiding access to interpreter
|
|
725
727
|
// structure internals of 3.8 or higher.
|
|
728
|
+
// spell-checker: ignore getdlopenflags,dlopenflags
|
|
729
|
+
|
|
726
730
|
static PyObject *dlopenflags_object = NULL;
|
|
727
731
|
if (dlopenflags_object == NULL) {
|
|
728
732
|
dlopenflags_object = CALL_FUNCTION_NO_ARGS(tstate, Nuitka_SysGetObject("getdlopenflags"));
|
|
@@ -985,14 +989,14 @@ static PyObject *loadModule(PyThreadState *tstate, PyObject *module, PyObject *m
|
|
|
985
989
|
|
|
986
990
|
appendWStringSafeW(filename, getBinaryDirectoryWideChars(true), sizeof(filename) / sizeof(wchar_t));
|
|
987
991
|
appendCharSafeW(filename, SEP, sizeof(filename) / sizeof(wchar_t));
|
|
988
|
-
|
|
992
|
+
appendModuleNameAsPathW(filename, entry->name, sizeof(filename) / sizeof(wchar_t));
|
|
989
993
|
appendStringSafeW(filename, ".pyd", sizeof(filename) / sizeof(wchar_t));
|
|
990
994
|
#else
|
|
991
995
|
char filename[MAXPATHLEN + 1] = {0};
|
|
992
996
|
|
|
993
997
|
appendStringSafe(filename, getBinaryDirectoryHostEncoded(true), sizeof(filename));
|
|
994
998
|
appendCharSafe(filename, SEP, sizeof(filename));
|
|
995
|
-
|
|
999
|
+
appendModuleNameAsPath(filename, entry->name, sizeof(filename));
|
|
996
1000
|
appendStringSafe(filename, ".so", sizeof(filename));
|
|
997
1001
|
|
|
998
1002
|
#endif
|
|
@@ -1027,15 +1031,20 @@ static PyObject *loadModule(PyThreadState *tstate, PyObject *module, PyObject *m
|
|
|
1027
1031
|
assert((entry->flags & NUITKA_EXTENSION_MODULE_FLAG) == 0);
|
|
1028
1032
|
assert(entry->python_initfunc);
|
|
1029
1033
|
|
|
1030
|
-
|
|
1031
|
-
|
|
1034
|
+
{
|
|
1035
|
+
NUITKA_MAY_BE_UNUSED bool res = Nuitka_SetModule(module_name, module);
|
|
1036
|
+
assert(res != false);
|
|
1037
|
+
}
|
|
1032
1038
|
|
|
1033
1039
|
// Run the compiled module code, we get the module returned.
|
|
1040
|
+
#if PYTHON_VERSION < 0x300
|
|
1041
|
+
NUITKA_MAY_BE_UNUSED
|
|
1042
|
+
#endif
|
|
1034
1043
|
PyObject *result = entry->python_initfunc(tstate, module, entry);
|
|
1035
1044
|
CHECK_OBJECT_X(result);
|
|
1036
1045
|
|
|
1037
|
-
#if PYTHON_VERSION >=
|
|
1038
|
-
if (result != NULL) {
|
|
1046
|
+
#if PYTHON_VERSION >= 0x300
|
|
1047
|
+
if (likely(result != NULL)) {
|
|
1039
1048
|
_fixupSpecAttribute(tstate, result);
|
|
1040
1049
|
}
|
|
1041
1050
|
#endif
|
|
@@ -1822,8 +1831,8 @@ static PyObject *Nuitka_Loader_get__module__(struct Nuitka_LoaderObject *loader,
|
|
|
1822
1831
|
return result;
|
|
1823
1832
|
}
|
|
1824
1833
|
|
|
1825
|
-
static PyGetSetDef
|
|
1826
|
-
|
|
1834
|
+
static PyGetSetDef Nuitka_Loader_tp_getset[] = {{(char *)"__module__", (getter)Nuitka_Loader_get__module__, NULL, NULL},
|
|
1835
|
+
{NULL}};
|
|
1827
1836
|
|
|
1828
1837
|
PyTypeObject Nuitka_Loader_Type = {
|
|
1829
1838
|
PyVarObject_HEAD_INIT(NULL, 0) "nuitka_module_loader",
|
|
@@ -1854,7 +1863,7 @@ PyTypeObject Nuitka_Loader_Type = {
|
|
|
1854
1863
|
0, // tp_iternext
|
|
1855
1864
|
Nuitka_Loader_methods, // tp_methods
|
|
1856
1865
|
0, // tp_members
|
|
1857
|
-
|
|
1866
|
+
Nuitka_Loader_tp_getset, // tp_getset
|
|
1858
1867
|
};
|
|
1859
1868
|
|
|
1860
1869
|
/* Used by modules to register child loaders for packages. */
|
|
@@ -1924,8 +1933,11 @@ void registerMetaPathBasedUnfreezer(struct Nuitka_MetaPathBasedLoaderEntry *_loa
|
|
|
1924
1933
|
Nuitka_PyType_Ready(&Nuitka_Loader_Type, NULL, true, false, false, false, false);
|
|
1925
1934
|
|
|
1926
1935
|
#ifdef _NUITKA_EXE
|
|
1927
|
-
|
|
1928
|
-
|
|
1936
|
+
{
|
|
1937
|
+
NUITKA_MAY_BE_UNUSED int res =
|
|
1938
|
+
PyDict_SetItemString((PyObject *)dict_builtin, "__nuitka_loader_type", (PyObject *)&Nuitka_Loader_Type);
|
|
1939
|
+
assert(res == 0);
|
|
1940
|
+
}
|
|
1929
1941
|
#endif
|
|
1930
1942
|
|
|
1931
1943
|
#if PYTHON_VERSION >= 0x370
|
|
@@ -1967,6 +1979,7 @@ void setEarlyFrozenModulesFileAttribute(PyThreadState *tstate) {
|
|
|
1967
1979
|
PyObject *file_value = MAKE_RELATIVE_PATH_FROM_NAME(Nuitka_String_AsString(key), is_package, false);
|
|
1968
1980
|
PyObject_SetAttr(value, const_str_plain___file__, file_value);
|
|
1969
1981
|
Py_DECREF(file_value);
|
|
1982
|
+
CHECK_OBJECT(file_value);
|
|
1970
1983
|
}
|
|
1971
1984
|
}
|
|
1972
1985
|
}
|
|
@@ -76,8 +76,10 @@ class nuitka_distribution(Distribution):\n\
|
|
|
76
76
|
importlib_metadata_distribution = PyObject_GetAttrString(module, "distribution");
|
|
77
77
|
CHECK_OBJECT(importlib_metadata_distribution);
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
{
|
|
80
|
+
NUITKA_MAY_BE_UNUSED bool bool_res = Nuitka_DelModuleString(tstate, "nuitka_distribution_patch");
|
|
81
|
+
assert(bool_res != false);
|
|
82
|
+
}
|
|
81
83
|
|
|
82
84
|
Py_DECREF(module);
|
|
83
85
|
}
|
|
@@ -137,8 +137,10 @@ static PyObject *Nuitka_ResourceReaderFiles_iterdir(struct Nuitka_ResourceReader
|
|
|
137
137
|
CHECK_OBJECT(joined);
|
|
138
138
|
|
|
139
139
|
PyObject *files_object = Nuitka_ResourceReaderFiles_New(tstate, files->m_loader_entry, joined);
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
{
|
|
141
|
+
NUITKA_MAY_BE_UNUSED bool res = LIST_APPEND1(files_objects, files_object);
|
|
142
|
+
assert(res);
|
|
143
|
+
}
|
|
142
144
|
|
|
143
145
|
CHECK_OBJECT(files_object);
|
|
144
146
|
Py_DECREF(joined);
|
|
@@ -314,6 +316,39 @@ static PyObject *Nuitka_ResourceReaderFiles_joinpath(struct Nuitka_ResourceReade
|
|
|
314
316
|
return result;
|
|
315
317
|
}
|
|
316
318
|
|
|
319
|
+
// def def as_posix(self):
|
|
320
|
+
// """
|
|
321
|
+
// Return Traversable child in self
|
|
322
|
+
// """
|
|
323
|
+
//
|
|
324
|
+
|
|
325
|
+
static PyObject *Nuitka_ResourceReaderFiles_as_posix(struct Nuitka_ResourceReaderFilesObject *files, PyObject *args,
|
|
326
|
+
PyObject *kwds) {
|
|
327
|
+
PyThreadState *tstate = PyThreadState_GET();
|
|
328
|
+
PyObject *path = _Nuitka_ResourceReaderFiles_GetPath(tstate, files);
|
|
329
|
+
|
|
330
|
+
#ifdef _WIN32
|
|
331
|
+
|
|
332
|
+
#if PYTHON_VERSION < 0x300
|
|
333
|
+
PyObject *result;
|
|
334
|
+
|
|
335
|
+
if (PyString_Check(path)) {
|
|
336
|
+
result = STR_REPLACE3(tstate, path, const_str_backslash, const_str_slash);
|
|
337
|
+
} else {
|
|
338
|
+
result = UNICODE_REPLACE3(tstate, path, const_str_backslash, const_str_slash);
|
|
339
|
+
}
|
|
340
|
+
#else
|
|
341
|
+
PyObject *result = UNICODE_REPLACE3(tstate, path, const_str_backslash, const_str_slash);
|
|
342
|
+
#endif
|
|
343
|
+
|
|
344
|
+
Py_DECREF(path);
|
|
345
|
+
|
|
346
|
+
return result;
|
|
347
|
+
#else
|
|
348
|
+
return path;
|
|
349
|
+
#endif
|
|
350
|
+
}
|
|
351
|
+
|
|
317
352
|
PyObject *Nuitka_ResourceReaderFiles_nb_truediv(struct Nuitka_ResourceReaderFilesObject *files, PyObject *arg) {
|
|
318
353
|
PyObject *joined;
|
|
319
354
|
|
|
@@ -424,6 +459,7 @@ static PyMethodDef Nuitka_ResourceReaderFiles_methods[] = {
|
|
|
424
459
|
{"__exit__", (PyCFunction)Nuitka_ResourceReaderFiles_exit, METH_VARARGS, NULL},
|
|
425
460
|
{"__fspath__", (PyCFunction)Nuitka_ResourceReaderFiles_fspath, METH_NOARGS, NULL},
|
|
426
461
|
{"absolute", (PyCFunction)Nuitka_ResourceReaderFiles_absolute, METH_NOARGS, NULL},
|
|
462
|
+
{"as_posix", (PyCFunction)Nuitka_ResourceReaderFiles_as_posix, METH_NOARGS, NULL},
|
|
427
463
|
|
|
428
464
|
// Nuitka specific, for "importlib.resource.as_file" overload.
|
|
429
465
|
{"as_file", (PyCFunction)Nuitka_ResourceReaderFiles_as_file, METH_NOARGS, NULL},
|
|
@@ -84,10 +84,6 @@
|
|
|
84
84
|
#define _NUITKA_AUTO_UPDATE_BOOL 1
|
|
85
85
|
#define _NUITKA_AUTO_UPDATE_URL_SPEC "https://..."
|
|
86
86
|
|
|
87
|
-
#if __APPLE__
|
|
88
|
-
#define _NUITKA_PAYLOAD_FROM_MACOS_SECTION
|
|
89
|
-
#endif
|
|
90
|
-
|
|
91
87
|
#endif
|
|
92
88
|
|
|
93
89
|
#if _NUITKA_ONEFILE_COMPRESSION_BOOL == 1
|
|
@@ -111,10 +107,15 @@
|
|
|
111
107
|
#include "decompress/zstd_decompress_block.c"
|
|
112
108
|
#endif
|
|
113
109
|
|
|
114
|
-
// Some handy macro definitions, e.g. unlikely
|
|
110
|
+
// Some handy macro definitions, e.g. unlikely and NUITKA_MAY_BE_UNUSED
|
|
115
111
|
#include "nuitka/hedley.h"
|
|
116
112
|
#define likely(x) HEDLEY_LIKELY(x)
|
|
117
113
|
#define unlikely(x) HEDLEY_UNLIKELY(x)
|
|
114
|
+
#ifdef __GNUC__
|
|
115
|
+
#define NUITKA_MAY_BE_UNUSED __attribute__((__unused__))
|
|
116
|
+
#else
|
|
117
|
+
#define NUITKA_MAY_BE_UNUSED
|
|
118
|
+
#endif
|
|
118
119
|
|
|
119
120
|
#include "HelpersChecksumTools.c"
|
|
120
121
|
#include "HelpersFilesystemPaths.c"
|
|
@@ -134,7 +135,9 @@ static void fatalIOError(char const *message, error_code_t error_code) {
|
|
|
134
135
|
}
|
|
135
136
|
|
|
136
137
|
// Failure to expand the template for where to extract to.
|
|
137
|
-
static void fatalErrorTempFiles(void) {
|
|
138
|
+
static void fatalErrorTempFiles(void) {
|
|
139
|
+
fatalIOError("Error, couldn't unpack file to target path.", getLastErrorCode());
|
|
140
|
+
}
|
|
138
141
|
|
|
139
142
|
#if _NUITKA_ONEFILE_COMPRESSION_BOOL == 1
|
|
140
143
|
static void fatalErrorAttachedData(void) { fatalError("Error, couldn't decode attached data."); }
|
|
@@ -142,11 +145,10 @@ static void fatalErrorAttachedData(void) { fatalError("Error, couldn't decode at
|
|
|
142
145
|
|
|
143
146
|
static void fatalErrorHeaderAttachedData(void) { fatalError("Error, couldn't find attached data header."); }
|
|
144
147
|
|
|
145
|
-
// Left over data in attached payload should not happen.
|
|
146
|
-
static void fatalErrorReadAttachedData(void) { fatalError("Error, couldn't read attached data."); }
|
|
147
|
-
|
|
148
148
|
// Out of memory error.
|
|
149
|
+
#if !defined(_WIN32) || _NUITKA_ONEFILE_COMPRESSION_BOOL == 1
|
|
149
150
|
static void fatalErrorMemory(void) { fatalError("Error, couldn't allocate memory."); }
|
|
151
|
+
#endif
|
|
150
152
|
|
|
151
153
|
// Could not launch child process.
|
|
152
154
|
static void fatalErrorChild(char const *message, error_code_t error_code) { fatalIOError(message, error_code); }
|
|
@@ -205,27 +207,21 @@ static void setEnvironVar(char const *var_name, char const *value) {
|
|
|
205
207
|
|
|
206
208
|
static unsigned char const *payload_data = NULL;
|
|
207
209
|
static unsigned char const *payload_current = NULL;
|
|
208
|
-
static
|
|
210
|
+
static unsigned long long payload_size = 0;
|
|
209
211
|
|
|
210
|
-
#ifdef
|
|
212
|
+
#ifdef __APPLE__
|
|
211
213
|
|
|
212
214
|
#include <mach-o/getsect.h>
|
|
213
215
|
#include <mach-o/ldsyms.h>
|
|
214
216
|
|
|
215
|
-
static
|
|
217
|
+
static void initPayloadData(void) {
|
|
216
218
|
const struct mach_header *header = &_mh_execute_header;
|
|
217
219
|
|
|
218
220
|
unsigned long section_size;
|
|
219
221
|
|
|
220
|
-
|
|
221
|
-
stream_end_pos = (size_t)section_size;
|
|
222
|
-
|
|
223
|
-
return result;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
static void initPayloadData(void) {
|
|
227
|
-
payload_data = findMacOSBinarySection();
|
|
222
|
+
payload_data = getsectiondata(header, "payload", "payload", §ion_size);
|
|
228
223
|
payload_current = payload_data;
|
|
224
|
+
payload_size = section_size;
|
|
229
225
|
}
|
|
230
226
|
|
|
231
227
|
static void closePayloadData(void) {}
|
|
@@ -233,9 +229,12 @@ static void closePayloadData(void) {}
|
|
|
233
229
|
#elif defined(_WIN32)
|
|
234
230
|
|
|
235
231
|
static void initPayloadData(void) {
|
|
236
|
-
|
|
237
|
-
|
|
232
|
+
HRSRC windows_resource = FindResource(NULL, MAKEINTRESOURCE(27), RT_RCDATA);
|
|
233
|
+
|
|
234
|
+
payload_data = (const unsigned char *)LockResource(LoadResource(NULL, windows_resource));
|
|
238
235
|
payload_current = payload_data;
|
|
236
|
+
|
|
237
|
+
payload_size = SizeofResource(NULL, windows_resource);
|
|
239
238
|
}
|
|
240
239
|
|
|
241
240
|
// Note: it appears unlocking the resource is not actually foreseen.
|
|
@@ -296,10 +295,6 @@ static void releaseZSTD(void) {
|
|
|
296
295
|
|
|
297
296
|
#endif
|
|
298
297
|
|
|
299
|
-
#if _NUITKA_ONEFILE_COMPRESSION_BOOL == 1
|
|
300
|
-
static size_t getPosition(void) { return payload_current - payload_data; }
|
|
301
|
-
#endif
|
|
302
|
-
|
|
303
298
|
static void readChunk(void *buffer, size_t size) {
|
|
304
299
|
// printf("Reading %d\n", size);
|
|
305
300
|
|
|
@@ -307,21 +302,8 @@ static void readChunk(void *buffer, size_t size) {
|
|
|
307
302
|
payload_current += size;
|
|
308
303
|
}
|
|
309
304
|
|
|
310
|
-
#if _NUITKA_ONEFILE_COMPRESSION_BOOL == 1
|
|
311
|
-
static void const *readChunkPointer(size_t size) {
|
|
312
|
-
// printf("Reading %d\n", size);
|
|
313
|
-
|
|
314
|
-
void const *result = payload_current;
|
|
315
|
-
payload_current += size;
|
|
316
|
-
|
|
317
|
-
return result;
|
|
318
|
-
}
|
|
319
|
-
#endif
|
|
320
|
-
|
|
321
305
|
static void readPayloadChunk(void *buffer, size_t size) {
|
|
322
|
-
#if _NUITKA_ONEFILE_COMPRESSION_BOOL == 1
|
|
323
|
-
|
|
324
|
-
// bool no_payload = false;
|
|
306
|
+
#if _NUITKA_ONEFILE_COMPRESSION_BOOL == 1 && _NUITKA_ONEFILE_ARCHIVE_BOOL == 0
|
|
325
307
|
bool end_of_buffer = false;
|
|
326
308
|
|
|
327
309
|
// Loop until finished with asked chunk.
|
|
@@ -372,28 +354,7 @@ static void readPayloadChunk(void *buffer, size_t size) {
|
|
|
372
354
|
if (input.size != input.pos) {
|
|
373
355
|
fatalErrorAttachedData();
|
|
374
356
|
}
|
|
375
|
-
|
|
376
|
-
// No input available, make it available from stream respecting end.
|
|
377
|
-
size_t to_read = ZSTD_DStreamInSize();
|
|
378
|
-
size_t payload_available = stream_end_pos - getPosition();
|
|
379
|
-
|
|
380
|
-
static size_t payload_so_far = 0;
|
|
381
|
-
|
|
382
|
-
if (payload_available == 0) {
|
|
383
|
-
continue;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
if (to_read > payload_available) {
|
|
387
|
-
to_read = payload_available;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
input.src = readChunkPointer(to_read);
|
|
391
|
-
input.pos = 0;
|
|
392
|
-
input.size = to_read;
|
|
393
|
-
|
|
394
|
-
payload_so_far += to_read;
|
|
395
357
|
}
|
|
396
|
-
|
|
397
358
|
#else
|
|
398
359
|
readChunk(buffer, size);
|
|
399
360
|
#endif
|
|
@@ -424,6 +385,15 @@ static unsigned long long readPayloadSizeValue(void) {
|
|
|
424
385
|
return result;
|
|
425
386
|
}
|
|
426
387
|
|
|
388
|
+
#if _NUITKA_ONEFILE_ARCHIVE_BOOL == 1 && _NUITKA_ONEFILE_COMPRESSION_BOOL == 1
|
|
389
|
+
static unsigned long long readArchiveFileSizeValue(void) {
|
|
390
|
+
unsigned long long result;
|
|
391
|
+
readPayloadChunk(&result, sizeof(unsigned int));
|
|
392
|
+
|
|
393
|
+
return result;
|
|
394
|
+
}
|
|
395
|
+
#endif
|
|
396
|
+
|
|
427
397
|
static filename_char_t readPayloadFilenameCharacter(void) {
|
|
428
398
|
filename_char_t result;
|
|
429
399
|
|
|
@@ -450,6 +420,74 @@ static filename_char_t *readPayloadFilename(void) {
|
|
|
450
420
|
return buffer;
|
|
451
421
|
}
|
|
452
422
|
|
|
423
|
+
static void writeContainedFile(FILE_HANDLE target_file, unsigned long long file_size) {
|
|
424
|
+
#if _NUITKA_ONEFILE_ARCHIVE_BOOL == 1
|
|
425
|
+
|
|
426
|
+
#if _NUITKA_ONEFILE_COMPRESSION_BOOL == 0
|
|
427
|
+
if (target_file != FILE_HANDLE_NULL) {
|
|
428
|
+
if (writeFileChunk(target_file, payload_current, file_size) == false) {
|
|
429
|
+
fatalErrorTempFiles();
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
payload_current += file_size;
|
|
434
|
+
#else
|
|
435
|
+
if (target_file != FILE_HANDLE_NULL) {
|
|
436
|
+
|
|
437
|
+
// Nothing available, make sure to make it available from existing input.
|
|
438
|
+
while (input.pos < input.size) {
|
|
439
|
+
// printf("available input %ld %ld\n", input.pos, input.size);
|
|
440
|
+
|
|
441
|
+
output.pos = 0;
|
|
442
|
+
output.size = ZSTD_DStreamOutSize();
|
|
443
|
+
|
|
444
|
+
size_t const ret = ZSTD_decompressStream(dest_ctx, &output, &input);
|
|
445
|
+
if (ZSTD_isError(ret)) {
|
|
446
|
+
fatalErrorAttachedData();
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// printf("available output %ld %ld\n", output.pos, output.size);
|
|
450
|
+
|
|
451
|
+
if (writeFileChunk(target_file, (char const *)output.dst, output.pos) == false) {
|
|
452
|
+
fatalErrorTempFiles();
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// printf("made output %ld %lld\n", output.pos, file_size);
|
|
456
|
+
file_size -= output.pos;
|
|
457
|
+
assert(file_size >= 0);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
assert(file_size == 0);
|
|
461
|
+
}
|
|
462
|
+
#endif
|
|
463
|
+
#else
|
|
464
|
+
while (file_size > 0) {
|
|
465
|
+
static char chunk[32768];
|
|
466
|
+
|
|
467
|
+
long chunk_size;
|
|
468
|
+
|
|
469
|
+
// Doing min manually, as otherwise the compiler is confused from types.
|
|
470
|
+
if (file_size <= sizeof(chunk)) {
|
|
471
|
+
chunk_size = (long)file_size;
|
|
472
|
+
} else {
|
|
473
|
+
chunk_size = sizeof(chunk);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
readPayloadChunk(chunk, chunk_size);
|
|
477
|
+
|
|
478
|
+
if (target_file != FILE_HANDLE_NULL) {
|
|
479
|
+
if (writeFileChunk(target_file, chunk, chunk_size) == false) {
|
|
480
|
+
fatalErrorTempFiles();
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
file_size -= chunk_size;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
assert(file_size == 0);
|
|
488
|
+
#endif
|
|
489
|
+
}
|
|
490
|
+
|
|
453
491
|
// Zero means, not yet created, created unsuccessfully, terminated already.
|
|
454
492
|
#if defined(_WIN32)
|
|
455
493
|
HANDLE handle_process = 0;
|
|
@@ -1019,20 +1057,18 @@ int main(int argc, char **argv) {
|
|
|
1019
1057
|
|
|
1020
1058
|
initPayloadData();
|
|
1021
1059
|
|
|
1022
|
-
#if !defined(
|
|
1060
|
+
#if !defined(__APPLE__) && !defined(_WIN32)
|
|
1023
1061
|
const off_t size_end_offset = exe_file_mapped.file_size;
|
|
1024
1062
|
|
|
1025
1063
|
NUITKA_PRINT_TIMING("ONEFILE: Determining payload start position.");
|
|
1026
1064
|
|
|
1027
|
-
unsigned long long
|
|
1065
|
+
assert(sizeof(payload_size) == sizeof(unsigned long long));
|
|
1028
1066
|
memcpy(&payload_size, payload_data + size_end_offset - sizeof(payload_size), sizeof(payload_size));
|
|
1029
1067
|
|
|
1030
1068
|
unsigned long long start_pos = size_end_offset - sizeof(payload_size) - payload_size;
|
|
1031
1069
|
|
|
1032
1070
|
payload_current += start_pos;
|
|
1033
1071
|
payload_data += start_pos;
|
|
1034
|
-
|
|
1035
|
-
stream_end_pos = size_end_offset - sizeof(payload_size) - start_pos;
|
|
1036
1072
|
#endif
|
|
1037
1073
|
|
|
1038
1074
|
NUITKA_PRINT_TIMING("ONEFILE: Checking header for compression.");
|
|
@@ -1044,12 +1080,20 @@ int main(int argc, char **argv) {
|
|
|
1044
1080
|
fatalErrorHeaderAttachedData();
|
|
1045
1081
|
}
|
|
1046
1082
|
|
|
1083
|
+
NUITKA_PRINT_TIMING("ONEFILE: Header is OK.");
|
|
1084
|
+
|
|
1047
1085
|
// The 'X' stands for no compression, 'Y' is compressed, handle that.
|
|
1048
1086
|
#if _NUITKA_ONEFILE_COMPRESSION_BOOL == 1
|
|
1049
1087
|
if (header[2] != 'Y') {
|
|
1050
1088
|
fatalErrorHeaderAttachedData();
|
|
1051
1089
|
}
|
|
1052
1090
|
initZSTD();
|
|
1091
|
+
|
|
1092
|
+
input.src = payload_current;
|
|
1093
|
+
input.pos = 0;
|
|
1094
|
+
input.size = payload_size;
|
|
1095
|
+
|
|
1096
|
+
assert(payload_size > 0);
|
|
1053
1097
|
#else
|
|
1054
1098
|
if (header[2] != 'X') {
|
|
1055
1099
|
fatalErrorHeaderAttachedData();
|
|
@@ -1134,6 +1178,20 @@ int main(int argc, char **argv) {
|
|
|
1134
1178
|
}
|
|
1135
1179
|
#endif
|
|
1136
1180
|
|
|
1181
|
+
#if _NUITKA_ONEFILE_ARCHIVE_BOOL == 1
|
|
1182
|
+
#if _NUITKA_ONEFILE_COMPRESSION_BOOL == 1
|
|
1183
|
+
uint32_t contained_archive_file_size = readArchiveFileSizeValue();
|
|
1184
|
+
|
|
1185
|
+
input.src = payload_current;
|
|
1186
|
+
input.pos = 0;
|
|
1187
|
+
input.size = contained_archive_file_size;
|
|
1188
|
+
|
|
1189
|
+
output.pos = 0;
|
|
1190
|
+
output.size = 0;
|
|
1191
|
+
|
|
1192
|
+
payload_current += contained_archive_file_size;
|
|
1193
|
+
#endif
|
|
1194
|
+
#endif
|
|
1137
1195
|
FILE_HANDLE target_file = FILE_HANDLE_NULL;
|
|
1138
1196
|
|
|
1139
1197
|
if (needs_write) {
|
|
@@ -1141,34 +1199,7 @@ int main(int argc, char **argv) {
|
|
|
1141
1199
|
target_file = createFileForWritingChecked(target_path);
|
|
1142
1200
|
}
|
|
1143
1201
|
|
|
1144
|
-
|
|
1145
|
-
static char chunk[32768];
|
|
1146
|
-
|
|
1147
|
-
long chunk_size;
|
|
1148
|
-
|
|
1149
|
-
// Doing min manually, as otherwise the compiler is confused from types.
|
|
1150
|
-
if (file_size <= sizeof(chunk)) {
|
|
1151
|
-
chunk_size = (long)file_size;
|
|
1152
|
-
} else {
|
|
1153
|
-
chunk_size = sizeof(chunk);
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
// TODO: Does zstd support skipping data as well, such that we
|
|
1157
|
-
// do not have to fully decode.
|
|
1158
|
-
readPayloadChunk(chunk, chunk_size);
|
|
1159
|
-
|
|
1160
|
-
if (target_file != FILE_HANDLE_NULL) {
|
|
1161
|
-
if (writeFileChunk(target_file, chunk, chunk_size) == false) {
|
|
1162
|
-
fatalErrorTempFiles();
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
file_size -= chunk_size;
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
if (file_size != 0) {
|
|
1170
|
-
fatalErrorReadAttachedData();
|
|
1171
|
-
}
|
|
1202
|
+
writeContainedFile(target_file, file_size);
|
|
1172
1203
|
|
|
1173
1204
|
#if !defined(_WIN32) && !defined(__MSYS__)
|
|
1174
1205
|
if ((file_flags & 1) && (target_file != FILE_HANDLE_NULL)) {
|
|
@@ -364,8 +364,8 @@ from .VariableCodes import (
|
|
|
364
364
|
)
|
|
365
365
|
from .YieldCodes import (
|
|
366
366
|
generateYieldCode,
|
|
367
|
+
generateYieldFromAwaitableCode,
|
|
367
368
|
generateYieldFromCode,
|
|
368
|
-
generateYieldFromWaitableCode,
|
|
369
369
|
)
|
|
370
370
|
|
|
371
371
|
_generated_functions = {}
|
|
@@ -776,6 +776,7 @@ addExpressionDispatchDict(
|
|
|
776
776
|
"EXPRESSION_FUNCTION_CREATION_OLD": generateFunctionCreationCode,
|
|
777
777
|
"EXPRESSION_FUNCTION_CALL": generateFunctionCallCode,
|
|
778
778
|
"EXPRESSION_FUNCTION_ERROR_STR": generateFunctionErrorStrCode,
|
|
779
|
+
"EXPRESSION_IMPORT_MODULE_BUILTIN": generateImportModuleFixedCode,
|
|
779
780
|
"EXPRESSION_IMPORT_MODULE_FIXED": generateImportModuleFixedCode,
|
|
780
781
|
"EXPRESSION_IMPORT_MODULE_HARD": generateImportModuleHardCode,
|
|
781
782
|
"EXPRESSION_IMPORT_MODULE_NAME_HARD_MAYBE_EXISTS": generateImportModuleNameHardCode,
|
|
@@ -865,7 +866,7 @@ addExpressionDispatchDict(
|
|
|
865
866
|
"EXPRESSION_VARIABLE_OR_BUILTIN_REF": generateVariableReferenceCode,
|
|
866
867
|
"EXPRESSION_YIELD": generateYieldCode,
|
|
867
868
|
"EXPRESSION_YIELD_FROM": generateYieldFromCode,
|
|
868
|
-
"
|
|
869
|
+
"EXPRESSION_YIELD_FROM_AWAITABLE": generateYieldFromAwaitableCode,
|
|
869
870
|
"EXPRESSION_ASYNC_WAIT": generateAsyncWaitCode,
|
|
870
871
|
"EXPRESSION_ASYNC_WAIT_ENTER": generateAsyncWaitCode,
|
|
871
872
|
"EXPRESSION_ASYNC_WAIT_EXIT": generateAsyncWaitCode,
|
|
@@ -916,6 +917,7 @@ addExpressionDispatchDict(
|
|
|
916
917
|
"EXPRESSION_OS_PATH_ISFILE_REF": generateImportModuleNameHardCode,
|
|
917
918
|
"EXPRESSION_OS_PATH_ISDIR_REF": generateImportModuleNameHardCode,
|
|
918
919
|
"EXPRESSION_OS_PATH_BASENAME_REF": generateImportModuleNameHardCode,
|
|
920
|
+
"EXPRESSION_BUILTINS_OPEN_REF": generateImportModuleNameHardCode,
|
|
919
921
|
"EXPRESSION_CTYPES_CDLL_REF": generateImportModuleNameHardCode,
|
|
920
922
|
"EXPRESSION_CTYPES_CDLL_SINCE38_CALL": generateCtypesCdllCallCode,
|
|
921
923
|
"EXPRESSION_CTYPES_CDLL_BEFORE38_CALL": generateCtypesCdllCallCode,
|
|
@@ -22,6 +22,7 @@ Right now only the creation is done here. But more should be added later on.
|
|
|
22
22
|
|
|
23
23
|
import os
|
|
24
24
|
|
|
25
|
+
from nuitka.__past__ import unicode
|
|
25
26
|
from nuitka.Options import getFileReferenceMode
|
|
26
27
|
from nuitka.PythonVersions import python_version
|
|
27
28
|
|
|
@@ -113,8 +114,11 @@ def getCodeObjectsInitCode(context):
|
|
|
113
114
|
else:
|
|
114
115
|
template = "module_filename_obj = MAKE_RELATIVE_PATH(%s); CHECK_OBJECT(module_filename_obj);"
|
|
115
116
|
|
|
117
|
+
if str is bytes and type(module_filename) is unicode:
|
|
118
|
+
module_filename = module_filename.encode("utf8")
|
|
119
|
+
|
|
116
120
|
# The code object will not work from any other type, cannot be e.g. unicode.
|
|
117
|
-
assert type(module_filename) is str, type(module_filename)
|
|
121
|
+
assert type(module_filename) is str, (type(module_filename), module_filename)
|
|
118
122
|
|
|
119
123
|
statements.append(template % (context.getConstantCode(constant=module_filename)))
|
|
120
124
|
|
|
@@ -187,3 +187,7 @@ def addDistributionMetadataValue(name, distribution):
|
|
|
187
187
|
package_name = getDistributionTopLevelPackageNames(distribution)[0]
|
|
188
188
|
|
|
189
189
|
metadata_values[name] = (package_name, metadata, entry_points)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def getDistributionMetadataValues():
|
|
193
|
+
return sorted(tuple(metadata_values.items()))
|