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
nuitka/freezer/Standalone.py
CHANGED
|
@@ -26,7 +26,11 @@ import os
|
|
|
26
26
|
|
|
27
27
|
from nuitka.containers.OrderedSets import OrderedSet
|
|
28
28
|
from nuitka.Errors import NuitkaForbiddenDLLEncounter
|
|
29
|
-
from nuitka.importing.Importing import
|
|
29
|
+
from nuitka.importing.Importing import (
|
|
30
|
+
getPythonUnpackedSearchPath,
|
|
31
|
+
locateModule,
|
|
32
|
+
)
|
|
33
|
+
from nuitka.importing.StandardLibrary import isStandardLibraryPath
|
|
30
34
|
from nuitka.Options import (
|
|
31
35
|
isShowProgress,
|
|
32
36
|
shallNotStoreDependsExeCachedResults,
|
|
@@ -227,6 +231,22 @@ def copyDllsUsed(dist_dir, standalone_entry_points):
|
|
|
227
231
|
)
|
|
228
232
|
|
|
229
233
|
|
|
234
|
+
def _reduceToPythonPath(used_dlls):
|
|
235
|
+
inside_paths = getPythonUnpackedSearchPath()
|
|
236
|
+
|
|
237
|
+
def decideInside(dll_filename):
|
|
238
|
+
return any(
|
|
239
|
+
isFilenameBelowPath(path=inside_path, filename=dll_filename)
|
|
240
|
+
for inside_path in inside_paths
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
used_dlls = set(
|
|
244
|
+
dll_filename for dll_filename in used_dlls if decideInside(dll_filename)
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
return used_dlls
|
|
248
|
+
|
|
249
|
+
|
|
230
250
|
def _detectUsedDLLs(standalone_entry_point, source_dir):
|
|
231
251
|
binary_filename = standalone_entry_point.source_path
|
|
232
252
|
try:
|
|
@@ -244,26 +264,27 @@ def _detectUsedDLLs(standalone_entry_point, source_dir):
|
|
|
244
264
|
else:
|
|
245
265
|
# Plugins generally decide if they allow dependencies from the outside
|
|
246
266
|
# based on the package name.
|
|
247
|
-
allow_outside_dependencies = Plugins.decideAllowOutsideDependencies(
|
|
248
|
-
standalone_entry_point.package_name
|
|
249
|
-
)
|
|
250
267
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
if not allow_outside_dependencies:
|
|
256
|
-
inside_paths = getPythonUnpackedSearchPath()
|
|
268
|
+
if standalone_entry_point.module_name is not None and used_dlls:
|
|
269
|
+
module_name, module_filename, _kind, finding = locateModule(
|
|
270
|
+
standalone_entry_point.module_name, parent_package=None, level=0
|
|
271
|
+
)
|
|
257
272
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
273
|
+
# Make sure we are not surprised here.
|
|
274
|
+
assert (
|
|
275
|
+
module_name == standalone_entry_point.module_name
|
|
276
|
+
), standalone_entry_point.module_name
|
|
277
|
+
assert finding == "absolute", standalone_entry_point.module_name
|
|
278
|
+
|
|
279
|
+
if isStandardLibraryPath(module_filename):
|
|
280
|
+
allow_outside_dependencies = True
|
|
281
|
+
else:
|
|
282
|
+
allow_outside_dependencies = Plugins.decideAllowOutsideDependencies(
|
|
283
|
+
standalone_entry_point.module_name
|
|
262
284
|
)
|
|
263
285
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
)
|
|
286
|
+
if allow_outside_dependencies is False:
|
|
287
|
+
used_dlls = _reduceToPythonPath(used_dlls)
|
|
267
288
|
|
|
268
289
|
# Allow plugins can prevent inclusion, this may discard things from used_dlls.
|
|
269
290
|
removed_dlls = Plugins.removeDllDependencies(
|
|
@@ -293,6 +314,7 @@ def _detectUsedDLLs(standalone_entry_point, source_dir):
|
|
|
293
314
|
logger=inclusion_logger,
|
|
294
315
|
source_path=used_dll,
|
|
295
316
|
dest_path=dest_path,
|
|
317
|
+
module_name=standalone_entry_point.module_name,
|
|
296
318
|
package_name=standalone_entry_point.package_name,
|
|
297
319
|
reason="Used by '%s'" % standalone_entry_point.dest_path,
|
|
298
320
|
)
|
nuitka/importing/Importing.py
CHANGED
|
@@ -37,12 +37,11 @@ it's from the standard library, one can abuse the attribute ``__file__`` of the
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
import collections
|
|
40
|
-
import hashlib
|
|
41
40
|
import os
|
|
42
41
|
import sys
|
|
43
42
|
import zipfile
|
|
44
43
|
|
|
45
|
-
from nuitka import
|
|
44
|
+
from nuitka import SourceCodeReferences
|
|
46
45
|
from nuitka.__past__ import iter_modules
|
|
47
46
|
from nuitka.containers.Namedtuples import makeNamedtupleClass
|
|
48
47
|
from nuitka.containers.OrderedSets import OrderedSet
|
|
@@ -54,7 +53,9 @@ from nuitka.Tracing import my_print, recursion_logger
|
|
|
54
53
|
from nuitka.tree.ReformulationMultidist import locateMultidistModule
|
|
55
54
|
from nuitka.utils.AppDirs import getCacheDir
|
|
56
55
|
from nuitka.utils.FileOperations import listDir, removeDirectory
|
|
56
|
+
from nuitka.utils.Hashing import getFileContentsHash
|
|
57
57
|
from nuitka.utils.Importing import (
|
|
58
|
+
builtin_module_names,
|
|
58
59
|
getModuleFilenameSuffixes,
|
|
59
60
|
getSharedLibrarySuffixes,
|
|
60
61
|
isBuiltinModuleName,
|
|
@@ -68,7 +69,43 @@ from nuitka.utils.Utils import isMacOS, isWin32OrPosixWindows
|
|
|
68
69
|
from .IgnoreListing import isIgnoreListedNotExistingModule
|
|
69
70
|
from .PreloadedPackages import getPreloadedPackagePath, isPreloadedPackagePath
|
|
70
71
|
|
|
71
|
-
|
|
72
|
+
# Debug traces, enabled via --explain-imports
|
|
73
|
+
_debug_module_finding = None
|
|
74
|
+
|
|
75
|
+
# Preference as expressed via --prefer-source-code
|
|
76
|
+
_prefer_source_code_over_extension_modules = None
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def setupImportingFromOptions():
|
|
80
|
+
"""Set up the importing layer from giving options."""
|
|
81
|
+
|
|
82
|
+
# Should only be used inside of here.
|
|
83
|
+
from nuitka import Options
|
|
84
|
+
|
|
85
|
+
# singleton, pylint: disable=global-statement
|
|
86
|
+
global _debug_module_finding
|
|
87
|
+
_debug_module_finding = Options.shallExplainImports()
|
|
88
|
+
|
|
89
|
+
global _prefer_source_code_over_extension_modules
|
|
90
|
+
_prefer_source_code_over_extension_modules = (
|
|
91
|
+
Options.shallPreferSourceCodeOverExtensionModules()
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
# Lets try and have this complete, please report failures.
|
|
95
|
+
if Options.is_debug and not isNuitkaPython():
|
|
96
|
+
_checkRaisingBuiltinComplete()
|
|
97
|
+
|
|
98
|
+
main_filenames = Options.getMainEntryPointFilenames()
|
|
99
|
+
for filename in main_filenames:
|
|
100
|
+
# Inform the importing layer about the main script directory, so it can use
|
|
101
|
+
# it when attempting to follow imports.
|
|
102
|
+
addMainScriptDirectory(main_dir=os.path.dirname(os.path.abspath(filename)))
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def _checkRaisingBuiltinComplete():
|
|
106
|
+
for module_name in builtin_module_names:
|
|
107
|
+
assert module_name in _stdlib_module_raises, module_name
|
|
108
|
+
|
|
72
109
|
|
|
73
110
|
warned_about = set()
|
|
74
111
|
|
|
@@ -186,7 +223,7 @@ def isIgnoreListedImportMaker(source_ref):
|
|
|
186
223
|
return StandardLibrary.isStandardLibraryPath(source_ref.getFilename())
|
|
187
224
|
|
|
188
225
|
|
|
189
|
-
def
|
|
226
|
+
def warnAboutNotFoundImport(importing, module_name, level, source_ref):
|
|
190
227
|
# This probably should not be dealt with here
|
|
191
228
|
if module_name == "":
|
|
192
229
|
return
|
|
@@ -279,6 +316,15 @@ def findModule(module_name, parent_package, level):
|
|
|
279
316
|
else:
|
|
280
317
|
return None, None, None, "not-found"
|
|
281
318
|
|
|
319
|
+
if level == 1 and not module_name:
|
|
320
|
+
# Not actually allowed, but we only catch that at run-time.
|
|
321
|
+
if parent_package is None:
|
|
322
|
+
return None, None, None, "not-found"
|
|
323
|
+
|
|
324
|
+
module_name = parent_package
|
|
325
|
+
parent_package = None
|
|
326
|
+
level = 0
|
|
327
|
+
|
|
282
328
|
# Try relative imports first if we have a parent package.
|
|
283
329
|
if level != 0 and parent_package is not None:
|
|
284
330
|
if module_name:
|
|
@@ -313,37 +359,11 @@ def findModule(module_name, parent_package, level):
|
|
|
313
359
|
|
|
314
360
|
return full_name.getPackageName(), module_filename, module_kind, "relative"
|
|
315
361
|
|
|
316
|
-
if level < 1 and module_name
|
|
362
|
+
if level < 1 and module_name:
|
|
317
363
|
module_name = normalizePackageName(module_name)
|
|
318
364
|
|
|
319
365
|
package_name = module_name.getPackageName()
|
|
320
366
|
|
|
321
|
-
# Built-in module names must not be searched any further.
|
|
322
|
-
if module_name in sys.builtin_module_names:
|
|
323
|
-
if _debug_module_finding:
|
|
324
|
-
my_print(
|
|
325
|
-
"findModule: Absolute imported module '%s' in as built-in':"
|
|
326
|
-
% (module_name,)
|
|
327
|
-
)
|
|
328
|
-
return package_name, None, None, "built-in"
|
|
329
|
-
|
|
330
|
-
# Frozen module names are similar to built-in, but there is no list of
|
|
331
|
-
# them, therefore check loader name. Not useful at this time
|
|
332
|
-
# to make a difference with built-in.
|
|
333
|
-
if python_version >= 0x300 and module_name in sys.modules:
|
|
334
|
-
loader = getattr(sys.modules[module_name], "__loader__", None)
|
|
335
|
-
|
|
336
|
-
if (
|
|
337
|
-
loader is not None
|
|
338
|
-
and getattr(loader, "__name__", "") == "FrozenImporter"
|
|
339
|
-
):
|
|
340
|
-
if _debug_module_finding:
|
|
341
|
-
my_print(
|
|
342
|
-
"findModule: Absolute imported module '%s' in as frozen':"
|
|
343
|
-
% (module_name,)
|
|
344
|
-
)
|
|
345
|
-
return package_name, None, None, "built-in"
|
|
346
|
-
|
|
347
367
|
preloaded_path = getPreloadedPackagePath(module_name)
|
|
348
368
|
|
|
349
369
|
if preloaded_path is not None:
|
|
@@ -393,10 +413,7 @@ def _reportCandidates(package_name, module_name, candidate, candidates):
|
|
|
393
413
|
else module_name
|
|
394
414
|
)
|
|
395
415
|
|
|
396
|
-
if
|
|
397
|
-
candidate.priority == 1
|
|
398
|
-
and Options.shallPreferSourceCodeOverExtensionModules() is None
|
|
399
|
-
):
|
|
416
|
+
if candidate.priority == 1 and _prefer_source_code_over_extension_modules is None:
|
|
400
417
|
for c in candidates:
|
|
401
418
|
# Don't compare to itself and don't consider unused bytecode a problem.
|
|
402
419
|
if c is candidate or c.priority == 3:
|
|
@@ -454,7 +471,7 @@ def _findModuleInPath2(package_name, module_name, search_path):
|
|
|
454
471
|
# Higher values are lower priority.
|
|
455
472
|
priority_map = {
|
|
456
473
|
"PY_COMPILED": 3,
|
|
457
|
-
"PY_SOURCE": 0 if
|
|
474
|
+
"PY_SOURCE": 0 if _prefer_source_code_over_extension_modules else 2,
|
|
458
475
|
"C_EXTENSION": 1,
|
|
459
476
|
}
|
|
460
477
|
|
|
@@ -582,26 +599,26 @@ def _unpackPathElement(path_entry):
|
|
|
582
599
|
if not path_entry:
|
|
583
600
|
return "." # empty means current directory
|
|
584
601
|
|
|
585
|
-
if os.path.isfile(path_entry)
|
|
586
|
-
if path_entry
|
|
587
|
-
|
|
588
|
-
checksum =
|
|
602
|
+
if os.path.isfile(path_entry):
|
|
603
|
+
if path_entry.lower().endswith((".egg", ".zip")):
|
|
604
|
+
if path_entry not in _egg_files:
|
|
605
|
+
checksum = getFileContentsHash(path_entry)
|
|
589
606
|
|
|
590
|
-
|
|
607
|
+
target_dir = os.path.join(getCacheDir(), "egg-content", checksum)
|
|
591
608
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
609
|
+
if not os.path.exists(target_dir):
|
|
610
|
+
try:
|
|
611
|
+
# Not all Python versions allow using with here, pylint: disable=consider-using-with
|
|
612
|
+
zip_ref = zipfile.ZipFile(path_entry, "r")
|
|
613
|
+
zip_ref.extractall(target_dir)
|
|
614
|
+
zip_ref.close()
|
|
615
|
+
except BaseException:
|
|
616
|
+
removeDirectory(target_dir, ignore_errors=True)
|
|
617
|
+
raise
|
|
601
618
|
|
|
602
|
-
|
|
619
|
+
_egg_files[path_entry] = target_dir
|
|
603
620
|
|
|
604
|
-
|
|
621
|
+
return _egg_files[path_entry]
|
|
605
622
|
|
|
606
623
|
return path_entry
|
|
607
624
|
|
|
@@ -614,7 +631,8 @@ def getPythonUnpackedSearchPath():
|
|
|
614
631
|
|
|
615
632
|
|
|
616
633
|
def getPackageSearchPath(package_name):
|
|
617
|
-
|
|
634
|
+
if not _main_paths:
|
|
635
|
+
return None
|
|
618
636
|
|
|
619
637
|
if package_name is None:
|
|
620
638
|
result = (
|
|
@@ -632,8 +650,9 @@ def getPackageSearchPath(package_name):
|
|
|
632
650
|
|
|
633
651
|
if isPackageDir(package_dir):
|
|
634
652
|
result.append(package_dir)
|
|
635
|
-
# Hack for "
|
|
653
|
+
# Hack for "uniconvertor". TODO: Move this to plug-in decision. This
|
|
636
654
|
# fails the above test, but at run time should be a package.
|
|
655
|
+
# spell-checker: ignore uniconvertor
|
|
637
656
|
elif package_name == "uniconvertor.app.modules":
|
|
638
657
|
result.append(package_dir)
|
|
639
658
|
|
|
@@ -678,7 +697,7 @@ def _findModuleInPath(module_name):
|
|
|
678
697
|
|
|
679
698
|
# Free pass for built-in modules, they need not exist.
|
|
680
699
|
if package_name is None and isBuiltinModuleName(module_name):
|
|
681
|
-
return None
|
|
700
|
+
return None, "built-in"
|
|
682
701
|
|
|
683
702
|
search_path = getPackageSearchPath(package_name)
|
|
684
703
|
|
|
@@ -698,7 +717,7 @@ def _findModuleInPath(module_name):
|
|
|
698
717
|
module_name if package_name is None else package_name + "." + module_name,
|
|
699
718
|
)
|
|
700
719
|
|
|
701
|
-
return None
|
|
720
|
+
return None, None
|
|
702
721
|
|
|
703
722
|
if _debug_module_finding:
|
|
704
723
|
my_print("_findModuleInPath: _findModuleInPath2 gave", module_filename)
|
|
@@ -737,6 +756,8 @@ def _findModule(module_name):
|
|
|
737
756
|
module_search_cache[key] = ImportError
|
|
738
757
|
raise
|
|
739
758
|
|
|
759
|
+
# assert len(module_search_cache[key]) == 2, (module_name, module_search_cache[key])
|
|
760
|
+
|
|
740
761
|
return module_search_cache[key]
|
|
741
762
|
|
|
742
763
|
|
|
@@ -747,9 +768,10 @@ def locateModule(module_name, parent_package, level):
|
|
|
747
768
|
as with "__import__" built-in.
|
|
748
769
|
|
|
749
770
|
Returns:
|
|
750
|
-
Returns a
|
|
771
|
+
Returns a tuple of module name the module has considering
|
|
751
772
|
package containing it, and filename of it which can be a
|
|
752
|
-
directory for packages, and the
|
|
773
|
+
directory for packages, the module kind, and the finding
|
|
774
|
+
kind.
|
|
753
775
|
"""
|
|
754
776
|
|
|
755
777
|
if module_name.isMultidistModuleName():
|
|
@@ -762,10 +784,7 @@ def locateModule(module_name, parent_package, level):
|
|
|
762
784
|
)
|
|
763
785
|
|
|
764
786
|
# Allowing ourselves to be lazy.
|
|
765
|
-
|
|
766
|
-
module_kind = None
|
|
767
|
-
else:
|
|
768
|
-
assert module_kind is not None, module_filename
|
|
787
|
+
assert module_kind is not None or module_filename is None, module_name
|
|
769
788
|
|
|
770
789
|
assert module_package is None or (
|
|
771
790
|
type(module_package) is ModuleName and module_package != ""
|
|
@@ -872,3 +891,117 @@ def decideModuleSourceRef(filename, module_name, is_main, is_fake, logger):
|
|
|
872
891
|
source_ref,
|
|
873
892
|
source_filename,
|
|
874
893
|
)
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
# spell-checker: ignore _posixsubprocess,pyexpat,xxsubtype
|
|
897
|
+
|
|
898
|
+
_stdlib_module_raises = {
|
|
899
|
+
"__builtin__": False,
|
|
900
|
+
"_abc": False,
|
|
901
|
+
"_ast": False,
|
|
902
|
+
"_bisect": False,
|
|
903
|
+
"_blake2": False,
|
|
904
|
+
"_bytesio": False,
|
|
905
|
+
"_codecs": False,
|
|
906
|
+
"_codecs_cn": False,
|
|
907
|
+
"_codecs_hk": False,
|
|
908
|
+
"_codecs_iso2022": False,
|
|
909
|
+
"_codecs_jp": False,
|
|
910
|
+
"_codecs_kr": False,
|
|
911
|
+
"_codecs_tw": False,
|
|
912
|
+
"_collections": False,
|
|
913
|
+
"_contextvars": False,
|
|
914
|
+
"_csv": False,
|
|
915
|
+
"_datetime": False,
|
|
916
|
+
"_elementtree": False,
|
|
917
|
+
"_fileio": False,
|
|
918
|
+
"_functools": False,
|
|
919
|
+
"_heapq": False,
|
|
920
|
+
"_hotshot": False,
|
|
921
|
+
"_imp": False,
|
|
922
|
+
"_io": False,
|
|
923
|
+
"_json": False,
|
|
924
|
+
"_locale": False,
|
|
925
|
+
"_lsprof": False,
|
|
926
|
+
"_md5": False,
|
|
927
|
+
"_multibytecodec": False,
|
|
928
|
+
"_opcode": False,
|
|
929
|
+
"_operator": False,
|
|
930
|
+
"_peg_parser": False,
|
|
931
|
+
"_pickle": False,
|
|
932
|
+
"_posixsubprocess": False,
|
|
933
|
+
"_random": False,
|
|
934
|
+
"_subprocess": False,
|
|
935
|
+
"_sha": False, # TODO: Not entirely clear if that's true
|
|
936
|
+
"_sha1": False,
|
|
937
|
+
"_sha256": False,
|
|
938
|
+
"_sha3": False,
|
|
939
|
+
"_sha512": False,
|
|
940
|
+
"_signal": False,
|
|
941
|
+
"_socket": False,
|
|
942
|
+
"_sre": False,
|
|
943
|
+
"_stat": False,
|
|
944
|
+
"_statistics": False,
|
|
945
|
+
"_string": False,
|
|
946
|
+
"_struct": False,
|
|
947
|
+
"_symtable": False,
|
|
948
|
+
"_thread": False,
|
|
949
|
+
"_tracemalloc": False,
|
|
950
|
+
"_tokenize": False,
|
|
951
|
+
"_typing": False,
|
|
952
|
+
"_warnings": False,
|
|
953
|
+
"_weakref": False,
|
|
954
|
+
"_winapi": False,
|
|
955
|
+
"_winreg": False,
|
|
956
|
+
"_xxsubinterpreters": False,
|
|
957
|
+
"array": False,
|
|
958
|
+
"atexit": False,
|
|
959
|
+
"audioop": False,
|
|
960
|
+
"binascii": False,
|
|
961
|
+
"builtins": False,
|
|
962
|
+
"cmath": False,
|
|
963
|
+
"cStringIO": False,
|
|
964
|
+
"cPickle": False,
|
|
965
|
+
"datetime": False,
|
|
966
|
+
"errno": False,
|
|
967
|
+
"exceptions": False,
|
|
968
|
+
"faulthandler": False,
|
|
969
|
+
"fcntl": False,
|
|
970
|
+
"future_builtins": False,
|
|
971
|
+
"gc": False,
|
|
972
|
+
"grp": False,
|
|
973
|
+
"itertools": False,
|
|
974
|
+
"imageop": False,
|
|
975
|
+
"imp": False,
|
|
976
|
+
"operator": False,
|
|
977
|
+
"marshal": False,
|
|
978
|
+
"math": False,
|
|
979
|
+
"mmap": False,
|
|
980
|
+
"msvcrt": False,
|
|
981
|
+
"nt": False,
|
|
982
|
+
"parser": False,
|
|
983
|
+
"posix": False,
|
|
984
|
+
"pwd": False,
|
|
985
|
+
"pyexpat": False,
|
|
986
|
+
"select": False,
|
|
987
|
+
"signal": False,
|
|
988
|
+
"strop": False,
|
|
989
|
+
"spwd": False,
|
|
990
|
+
"sys": False,
|
|
991
|
+
"syslog": False,
|
|
992
|
+
"time": False,
|
|
993
|
+
"thread": False,
|
|
994
|
+
"unicodedata": False,
|
|
995
|
+
"winreg": False,
|
|
996
|
+
"xxsubtype": False,
|
|
997
|
+
"zipimport": False,
|
|
998
|
+
"zlib": False,
|
|
999
|
+
"_ssl": True,
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
def isNonRaisingBuiltinModule(module_name):
|
|
1004
|
+
assert isBuiltinModuleName(module_name), module_name
|
|
1005
|
+
|
|
1006
|
+
# Return None, if we don't know.
|
|
1007
|
+
return _stdlib_module_raises.get(module_name)
|
|
@@ -27,6 +27,7 @@ import sys
|
|
|
27
27
|
|
|
28
28
|
from nuitka.Tracing import recursion_logger
|
|
29
29
|
from nuitka.utils.FileOperations import getFileContentByLine, listDir
|
|
30
|
+
from nuitka.utils.ModuleNames import ModuleName
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
def getLoadedPackages():
|
|
@@ -154,7 +155,7 @@ def setPthImportedPackages(value):
|
|
|
154
155
|
# We need to set this from the outside, pylint: disable=global-statement
|
|
155
156
|
global pth_imported_packages
|
|
156
157
|
|
|
157
|
-
pth_imported_packages = value
|
|
158
|
+
pth_imported_packages = tuple(ModuleName(module_name) for module_name in value)
|
|
158
159
|
|
|
159
160
|
|
|
160
161
|
def getPthImportedPackages():
|