Nuitka-winsvc 2.3.9__cp311-cp311-win_amd64.whl → 2.4.1__cp311-cp311-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.
Potentially problematic release.
This version of Nuitka-winsvc might be problematic. Click here for more details.
- Nuitka_winsvc-2.3.9.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.1.data/scripts/nuitka-run.cmd +1 -1
- {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/RECORD +213 -210
- {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/WHEEL +1 -1
- nuitka/CacheCleanup.py +6 -1
- nuitka/HardImportRegistry.py +29 -2
- nuitka/MainControl.py +62 -35
- nuitka/ModuleRegistry.py +11 -3
- nuitka/OptionParsing.py +78 -39
- nuitka/Options.py +142 -35
- nuitka/OutputDirectories.py +5 -0
- nuitka/PostProcessing.py +23 -14
- nuitka/PythonFlavors.py +22 -4
- nuitka/PythonVersions.py +18 -0
- nuitka/Tracing.py +26 -23
- nuitka/TreeXML.py +6 -3
- nuitka/Version.py +1 -1
- nuitka/__main__.py +55 -10
- nuitka/build/Backend.scons +6 -1
- nuitka/build/CCompilerVersion.scons +1 -0
- nuitka/build/Onefile.scons +4 -0
- nuitka/build/SconsCaching.py +1 -0
- nuitka/build/SconsCompilerSettings.py +1 -0
- nuitka/build/SconsHacks.py +5 -1
- nuitka/build/SconsInterface.py +2 -0
- nuitka/build/SconsUtils.py +5 -2
- nuitka/build/include/nuitka/allocator.h +27 -5
- nuitka/build/include/nuitka/calling.h +1 -1
- nuitka/build/include/nuitka/compiled_frame.h +23 -23
- nuitka/build/include/nuitka/compiled_method.h +1 -1
- nuitka/build/include/nuitka/exception_groups.h +0 -2
- nuitka/build/include/nuitka/helper/attributes.h +7 -1
- nuitka/build/include/nuitka/helper/subscripts.h +1 -1
- nuitka/build/include/nuitka/helpers.h +7 -4
- nuitka/build/include/nuitka/prelude.h +6 -10
- nuitka/build/include/nuitka/printing.h +2 -0
- nuitka/build/include/nuitka/unfreezing.h +5 -5
- nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +4 -1
- nuitka/build/static_src/CompiledAsyncgenType.c +2 -4
- nuitka/build/static_src/CompiledCellType.c +7 -7
- nuitka/build/static_src/CompiledCodeHelpers.c +51 -36
- nuitka/build/static_src/CompiledCoroutineType.c +2 -4
- nuitka/build/static_src/CompiledFrameType.c +109 -82
- nuitka/build/static_src/CompiledFunctionType.c +36 -9
- nuitka/build/static_src/CompiledGeneratorType.c +12 -10
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +2 -2
- nuitka/build/static_src/CompiledMethodType.c +14 -13
- nuitka/build/static_src/HelpersAttributes.c +13 -15
- nuitka/build/static_src/HelpersBuiltin.c +18 -9
- nuitka/build/static_src/HelpersCalling.c +13 -13
- nuitka/build/static_src/HelpersCallingGenerated.c +22 -22
- nuitka/build/static_src/HelpersComparisonEq.c +110 -110
- nuitka/build/static_src/HelpersComparisonEqUtils.c +1 -1
- nuitka/build/static_src/HelpersComparisonGe.c +110 -110
- nuitka/build/static_src/HelpersComparisonGt.c +110 -110
- nuitka/build/static_src/HelpersComparisonLe.c +110 -110
- nuitka/build/static_src/HelpersComparisonLt.c +110 -110
- nuitka/build/static_src/HelpersComparisonNe.c +110 -110
- nuitka/build/static_src/HelpersConstantsBlob.c +480 -481
- nuitka/build/static_src/HelpersDictionaries.c +9 -0
- nuitka/build/static_src/HelpersFiles.c +2 -2
- nuitka/build/static_src/HelpersFilesystemPaths.c +28 -13
- nuitka/build/static_src/HelpersHeapStorage.c +4 -0
- nuitka/build/static_src/HelpersImport.c +1 -1
- nuitka/build/static_src/HelpersLists.c +5 -1
- nuitka/build/static_src/HelpersMatching.c +95 -35
- nuitka/build/static_src/HelpersOperationInplaceAdd.c +23 -23
- nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -0
- nuitka/build/static_src/HelpersOperationInplaceBitand.c +11 -11
- nuitka/build/static_src/HelpersOperationInplaceBitor.c +11 -11
- nuitka/build/static_src/HelpersOperationInplaceBitxor.c +11 -11
- nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +17 -17
- nuitka/build/static_src/HelpersOperationInplaceLshift.c +9 -9
- nuitka/build/static_src/HelpersOperationInplaceMatmult.c +10 -10
- nuitka/build/static_src/HelpersOperationInplaceMod.c +47 -47
- nuitka/build/static_src/HelpersOperationInplaceMult.c +28 -28
- nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +17 -17
- nuitka/build/static_src/HelpersOperationInplacePow.c +17 -17
- nuitka/build/static_src/HelpersOperationInplaceRshift.c +9 -9
- nuitka/build/static_src/HelpersOperationInplaceSub.c +17 -17
- nuitka/build/static_src/HelpersOperationInplaceTruediv.c +17 -17
- nuitka/build/static_src/HelpersSequences.c +1 -1
- nuitka/build/static_src/HelpersTypes.c +8 -4
- nuitka/build/static_src/MainProgram.c +28 -9
- nuitka/build/static_src/MetaPathBasedLoader.c +126 -110
- nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +13 -4
- nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +30 -1
- nuitka/build/static_src/OnefileBootstrap.c +34 -6
- nuitka/code_generation/AttributeCodes.py +12 -10
- nuitka/code_generation/CodeGeneration.py +6 -7
- nuitka/code_generation/ConstantCodes.py +53 -10
- nuitka/code_generation/GlobalConstants.py +6 -6
- nuitka/code_generation/Indentation.py +3 -4
- nuitka/code_generation/LoaderCodes.py +3 -0
- nuitka/code_generation/LocalsDictCodes.py +36 -14
- nuitka/code_generation/MatchCodes.py +23 -4
- nuitka/code_generation/ModuleCodes.py +0 -7
- nuitka/code_generation/Namify.py +2 -0
- nuitka/code_generation/PackageResourceCodes.py +5 -1
- nuitka/code_generation/templates/CodeTemplatesConstants.py +6 -4
- nuitka/code_generation/templates/CodeTemplatesLoader.py +1 -1
- nuitka/code_generation/templates/CodeTemplatesModules.py +3 -3
- nuitka/code_generation/templates/CodeTemplatesVariables.py +16 -2
- nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +2 -2
- nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +7 -7
- nuitka/freezer/DependsExe.py +3 -1
- nuitka/freezer/DllDependenciesMacOS.py +28 -14
- nuitka/freezer/IncludedDataFiles.py +12 -3
- nuitka/freezer/IncludedEntryPoints.py +8 -2
- nuitka/freezer/Onefile.py +6 -1
- nuitka/freezer/Standalone.py +9 -2
- nuitka/importing/Importing.py +14 -5
- nuitka/importing/Recursion.py +3 -0
- nuitka/nodes/AttributeNodesGenerated.py +21 -12
- nuitka/nodes/BuiltinOpenNodes.py +5 -0
- nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +11 -11
- nuitka/nodes/BuiltinRefNodes.py +41 -1
- nuitka/nodes/ChildrenHavingMixins.py +143 -355
- nuitka/nodes/ClassNodes.py +30 -12
- nuitka/nodes/CodeObjectSpecs.py +9 -0
- nuitka/nodes/ExpressionBasesGenerated.py +11 -11
- nuitka/nodes/FunctionNodes.py +11 -12
- nuitka/nodes/FutureSpecs.py +16 -3
- nuitka/nodes/GeneratorNodes.py +2 -2
- nuitka/nodes/HardImportNodesGenerated.py +11 -134
- nuitka/nodes/LocalsScopes.py +19 -23
- nuitka/nodes/MatchNodes.py +18 -7
- nuitka/nodes/ModuleAttributeNodes.py +1 -20
- nuitka/nodes/ModuleNodes.py +23 -6
- nuitka/nodes/NodeBases.py +13 -11
- nuitka/nodes/NodeMetaClasses.py +26 -10
- nuitka/nodes/ReturnNodes.py +1 -1
- nuitka/nodes/StatementBasesGenerated.py +11 -11
- nuitka/nodes/SubscriptNodes.py +4 -4
- nuitka/nodes/VariableAssignNodes.py +1 -1
- nuitka/nodes/VariableRefNodes.py +28 -2
- nuitka/nodes/shapes/BuiltinTypeShapes.py +21 -1
- nuitka/optimizations/FunctionInlining.py +3 -6
- nuitka/optimizations/Optimization.py +13 -12
- nuitka/optimizations/TraceCollections.py +19 -4
- nuitka/plugins/PluginBase.py +121 -133
- nuitka/plugins/Plugins.py +91 -3
- nuitka/plugins/YamlPluginBase.py +121 -0
- nuitka/plugins/standard/AntiBloatPlugin.py +87 -28
- nuitka/plugins/standard/DataFilesPlugin.py +15 -6
- nuitka/plugins/standard/DelvewheelPlugin.py +7 -3
- nuitka/plugins/standard/DllFilesPlugin.py +5 -3
- nuitka/plugins/standard/ImplicitImports.py +34 -20
- nuitka/plugins/standard/MatplotlibPlugin.py +3 -1
- nuitka/plugins/standard/MultiprocessingPlugin.py +2 -2
- nuitka/plugins/standard/OptionsNannyPlugin.py +1 -1
- nuitka/plugins/standard/PySidePyQtPlugin.py +11 -12
- nuitka/plugins/standard/SpacyPlugin.py +136 -0
- nuitka/plugins/standard/standard.nuitka-package.config.yml +491 -186
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +17 -0
- nuitka/reports/Reports.py +53 -5
- nuitka/specs/BuiltinParameterSpecs.py +1 -1
- nuitka/specs/HardImportSpecs.py +0 -6
- nuitka/tools/data_composer/DataComposer.py +29 -27
- nuitka/tools/environments/CreateEnvironment.py +1 -0
- nuitka/tools/environments/Virtualenv.py +25 -11
- nuitka/tools/general/find_module/FindModuleCode.py +13 -3
- nuitka/tools/onefile_compressor/OnefileCompressor.py +21 -4
- nuitka/tools/scanning/DisplayPackageDLLs.py +17 -3
- nuitka/tools/specialize/CTypeDescriptions.py +13 -7
- nuitka/tools/specialize/SpecializePython.py +18 -1
- nuitka/tools/testing/Common.py +19 -6
- nuitka/tools/testing/check_reference_counts/__main__.py +1 -1
- nuitka/tools/testing/run_nuitka_tests/__main__.py +0 -20
- nuitka/tools/watch/AutoStage.py +144 -0
- nuitka/tools/watch/__main__.py +79 -32
- nuitka/tree/Building.py +105 -104
- nuitka/tree/ComplexCallHelperFunctions.py +16 -26
- nuitka/tree/InternalModule.py +9 -1
- nuitka/tree/ReformulationAssignmentStatements.py +29 -59
- nuitka/tree/ReformulationClasses.py +10 -17
- nuitka/tree/ReformulationClasses3.py +69 -43
- nuitka/tree/ReformulationComparisonExpressions.py +6 -16
- nuitka/tree/ReformulationContractionExpressions.py +14 -23
- nuitka/tree/ReformulationDictionaryCreation.py +6 -10
- nuitka/tree/ReformulationExecStatements.py +10 -10
- nuitka/tree/ReformulationForLoopStatements.py +6 -12
- nuitka/tree/ReformulationFunctionStatements.py +22 -28
- nuitka/tree/ReformulationImportStatements.py +8 -10
- nuitka/tree/ReformulationLambdaExpressions.py +3 -6
- nuitka/tree/ReformulationMatchStatements.py +166 -60
- nuitka/tree/ReformulationMultidist.py +3 -1
- nuitka/tree/ReformulationNamespacePackages.py +1 -1
- nuitka/tree/ReformulationPrintStatements.py +3 -6
- nuitka/tree/ReformulationSequenceCreation.py +13 -26
- nuitka/tree/ReformulationTryFinallyStatements.py +15 -0
- nuitka/tree/ReformulationWithStatements.py +12 -16
- nuitka/tree/SourceHandling.py +13 -8
- nuitka/tree/VariableClosure.py +5 -21
- nuitka/utils/Distributions.py +80 -11
- nuitka/utils/Download.py +38 -31
- nuitka/utils/Execution.py +21 -9
- nuitka/utils/FileOperations.py +55 -28
- nuitka/utils/Images.py +6 -1
- nuitka/utils/Importing.py +1 -1
- nuitka/utils/ModuleNames.py +11 -5
- nuitka/utils/ReExecute.py +17 -13
- nuitka/utils/SharedLibraries.py +69 -41
- nuitka/utils/Signing.py +3 -1
- nuitka/utils/StaticLibraries.py +51 -41
- nuitka/utils/Timing.py +1 -1
- nuitka/utils/Utils.py +29 -7
- /Nuitka_winsvc-2.3.9.data/scripts/nuitka.bat → /Nuitka_winsvc-2.4.1.data/scripts/nuitka.cmd +0 -0
- {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/top_level.txt +0 -0
|
@@ -14,7 +14,8 @@ import re
|
|
|
14
14
|
from nuitka.containers.OrderedDicts import OrderedDict
|
|
15
15
|
from nuitka.Errors import NuitkaForbiddenImportEncounter
|
|
16
16
|
from nuitka.ModuleRegistry import getModuleByName
|
|
17
|
-
from nuitka.
|
|
17
|
+
from nuitka.Options import isExperimental
|
|
18
|
+
from nuitka.plugins.YamlPluginBase import NuitkaYamlPluginBase
|
|
18
19
|
from nuitka.utils.ModuleNames import ModuleName
|
|
19
20
|
|
|
20
21
|
# spell-checker: ignore dask,numba,statsmodels,matplotlib,sqlalchemy,ipykernel
|
|
@@ -40,6 +41,7 @@ class NuitkaPluginAntiBloat(NuitkaYamlPluginBase):
|
|
|
40
41
|
noinclude_setuptools_mode,
|
|
41
42
|
noinclude_pytest_mode,
|
|
42
43
|
noinclude_unittest_mode,
|
|
44
|
+
noinclude_pydoc_mode,
|
|
43
45
|
noinclude_ipython_mode,
|
|
44
46
|
noinclude_dask_mode,
|
|
45
47
|
noinclude_numba_mode,
|
|
@@ -47,7 +49,8 @@ class NuitkaPluginAntiBloat(NuitkaYamlPluginBase):
|
|
|
47
49
|
custom_choices,
|
|
48
50
|
show_changes,
|
|
49
51
|
):
|
|
50
|
-
# Many details, due to many repetitive arguments,
|
|
52
|
+
# Many details, due to many repetitive arguments,
|
|
53
|
+
# pylint: disable=too-many-branches,too-many-locals,too-many-statements
|
|
51
54
|
|
|
52
55
|
NuitkaYamlPluginBase.__init__(self)
|
|
53
56
|
|
|
@@ -60,6 +63,8 @@ class NuitkaPluginAntiBloat(NuitkaYamlPluginBase):
|
|
|
60
63
|
noinclude_pytest_mode = noinclude_default_mode
|
|
61
64
|
if noinclude_unittest_mode is None:
|
|
62
65
|
noinclude_unittest_mode = noinclude_default_mode
|
|
66
|
+
if noinclude_pydoc_mode is None:
|
|
67
|
+
noinclude_pydoc_mode = noinclude_default_mode
|
|
63
68
|
if noinclude_ipython_mode is None:
|
|
64
69
|
noinclude_ipython_mode = noinclude_default_mode
|
|
65
70
|
if noinclude_dask_mode is None:
|
|
@@ -102,6 +107,10 @@ class NuitkaPluginAntiBloat(NuitkaYamlPluginBase):
|
|
|
102
107
|
noinclude_setuptools_mode,
|
|
103
108
|
"setuptools",
|
|
104
109
|
)
|
|
110
|
+
self.handled_modules["numpy.distutils"] = (
|
|
111
|
+
noinclude_setuptools_mode,
|
|
112
|
+
"setuptools",
|
|
113
|
+
)
|
|
105
114
|
else:
|
|
106
115
|
self.control_tags["use_setuptools"] = True
|
|
107
116
|
|
|
@@ -173,6 +182,11 @@ class NuitkaPluginAntiBloat(NuitkaYamlPluginBase):
|
|
|
173
182
|
else:
|
|
174
183
|
self.control_tags["use_dask"] = True
|
|
175
184
|
|
|
185
|
+
if noinclude_pydoc_mode != "allow":
|
|
186
|
+
self.handled_modules["pydoc"] = noinclude_pydoc_mode, "pydoc"
|
|
187
|
+
else:
|
|
188
|
+
self.control_tags["use_pydoc"] = True
|
|
189
|
+
|
|
176
190
|
if noinclude_numba_mode != "allow":
|
|
177
191
|
self.handled_modules["numba"] = noinclude_numba_mode, "numba"
|
|
178
192
|
self.handled_modules["sparse"] = noinclude_numba_mode, "numba"
|
|
@@ -289,6 +303,17 @@ What to do if a unittest import is encountered. This package can be big with
|
|
|
289
303
|
dependencies, and should definitely be avoided.""",
|
|
290
304
|
)
|
|
291
305
|
|
|
306
|
+
group.add_option(
|
|
307
|
+
"--noinclude-pydoc-mode",
|
|
308
|
+
action="store",
|
|
309
|
+
dest="noinclude_pydoc_mode",
|
|
310
|
+
choices=_mode_choices,
|
|
311
|
+
default=None,
|
|
312
|
+
help="""\
|
|
313
|
+
What to do if a pydoc import is encountered. This package use is mark of useless
|
|
314
|
+
code for deployments and should be avoided.""",
|
|
315
|
+
)
|
|
316
|
+
|
|
292
317
|
group.add_option(
|
|
293
318
|
"--noinclude-IPython-mode",
|
|
294
319
|
action="store",
|
|
@@ -375,8 +400,8 @@ Error, cannot exec module '%s', context code '%s' due to: %s"""
|
|
|
375
400
|
# To allow detection if it did anything.
|
|
376
401
|
change_count = 0
|
|
377
402
|
|
|
378
|
-
for replace_src, replace_code in
|
|
379
|
-
"replacements"
|
|
403
|
+
for replace_src, replace_code in (
|
|
404
|
+
anti_bloat_config.get("replacements") or {}
|
|
380
405
|
).items():
|
|
381
406
|
# Avoid the eval, if the replace doesn't hit.
|
|
382
407
|
if replace_src not in source_code:
|
|
@@ -401,8 +426,8 @@ Error, cannot exec module '%s', context code '%s' due to: %s"""
|
|
|
401
426
|
if old != source_code:
|
|
402
427
|
change_count += 1
|
|
403
428
|
|
|
404
|
-
for replace_src, replace_dst in
|
|
405
|
-
"replacements_plain"
|
|
429
|
+
for replace_src, replace_dst in (
|
|
430
|
+
anti_bloat_config.get("replacements_plain") or {}
|
|
406
431
|
).items():
|
|
407
432
|
old = source_code
|
|
408
433
|
source_code = source_code.replace(replace_src, replace_dst)
|
|
@@ -410,14 +435,16 @@ Error, cannot exec module '%s', context code '%s' due to: %s"""
|
|
|
410
435
|
if old != source_code:
|
|
411
436
|
change_count += 1
|
|
412
437
|
|
|
413
|
-
for replace_src, replace_dst in
|
|
414
|
-
"replacements_re"
|
|
438
|
+
for replace_src, replace_dst in (
|
|
439
|
+
anti_bloat_config.get("replacements_re") or {}
|
|
415
440
|
).items():
|
|
416
441
|
old = source_code
|
|
417
|
-
source_code = re.sub(replace_src, replace_dst, source_code)
|
|
442
|
+
source_code = re.sub(replace_src, replace_dst, source_code, re.S)
|
|
418
443
|
|
|
419
444
|
if old != source_code:
|
|
420
445
|
change_count += 1
|
|
446
|
+
elif isExperimental("display-anti-bloat-mismatches"):
|
|
447
|
+
self.info("No match in %s no match %r" % (module_name, replace_src))
|
|
421
448
|
|
|
422
449
|
append_code = anti_bloat_config.get("append_result", "")
|
|
423
450
|
if type(append_code) in (tuple, list):
|
|
@@ -604,30 +631,62 @@ class %(class_name)s:
|
|
|
604
631
|
return result
|
|
605
632
|
|
|
606
633
|
def _getModuleBloatModeOverrides(self, using_module_name, intended_module_name):
|
|
607
|
-
|
|
608
|
-
|
|
634
|
+
# Finding a matching configuration aborts the search, not finding one
|
|
635
|
+
# means default behavior should apply.
|
|
636
|
+
for _config_module_name, bloat_mode_overrides in self.getYamlConfigItem(
|
|
637
|
+
module_name=using_module_name,
|
|
638
|
+
section="anti-bloat",
|
|
639
|
+
item_name="bloat-mode-overrides",
|
|
640
|
+
default={},
|
|
641
|
+
decide_relevant=(lambda config_item: intended_module_name in config_item),
|
|
642
|
+
recursive=True,
|
|
643
|
+
):
|
|
644
|
+
return bloat_mode_overrides[intended_module_name]
|
|
609
645
|
|
|
610
|
-
|
|
611
|
-
for anti_bloat_config in config:
|
|
612
|
-
bloat_mode_overrides = anti_bloat_config.get(
|
|
613
|
-
"bloat-mode-overrides", ()
|
|
614
|
-
)
|
|
646
|
+
return None
|
|
615
647
|
|
|
616
|
-
|
|
617
|
-
|
|
648
|
+
def decideAnnotations(self, module_name):
|
|
649
|
+
# Finding a matching configuration aborts the search, not finding one
|
|
650
|
+
# means default behavior should apply.
|
|
651
|
+
for _config_module_name, annotations_config_value in self.getYamlConfigItem(
|
|
652
|
+
module_name=module_name,
|
|
653
|
+
section="anti-bloat",
|
|
654
|
+
item_name="annotations",
|
|
655
|
+
default=None,
|
|
656
|
+
decide_relevant=(lambda config_item: config_item in ("yes", "no")),
|
|
657
|
+
recursive=True,
|
|
658
|
+
):
|
|
659
|
+
return annotations_config_value == "yes"
|
|
618
660
|
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
661
|
+
return None
|
|
662
|
+
|
|
663
|
+
def decideDocStrings(self, module_name):
|
|
664
|
+
# Finding a matching configuration aborts the search, not finding one
|
|
665
|
+
# means default behavior should apply.
|
|
666
|
+
for _config_module_name, doc_strings_config_value in self.getYamlConfigItem(
|
|
667
|
+
module_name=module_name,
|
|
668
|
+
section="anti-bloat",
|
|
669
|
+
item_name="doc_strings",
|
|
670
|
+
default=None,
|
|
671
|
+
decide_relevant=(lambda config_item: config_item in ("yes", "no")),
|
|
672
|
+
recursive=True,
|
|
673
|
+
):
|
|
674
|
+
return doc_strings_config_value == "yes"
|
|
626
675
|
|
|
627
|
-
|
|
676
|
+
return None
|
|
628
677
|
|
|
629
|
-
|
|
630
|
-
|
|
678
|
+
def decideAsserts(self, module_name):
|
|
679
|
+
# Finding a matching configuration aborts the search, not finding one
|
|
680
|
+
# means default behavior should apply.
|
|
681
|
+
for _config_module_name, asserts_config_value in self.getYamlConfigItem(
|
|
682
|
+
module_name=module_name,
|
|
683
|
+
section="anti-bloat",
|
|
684
|
+
item_name="asserts",
|
|
685
|
+
default=None,
|
|
686
|
+
decide_relevant=(lambda config_item: config_item in ("yes", "no")),
|
|
687
|
+
recursive=True,
|
|
688
|
+
):
|
|
689
|
+
return asserts_config_value == "yes"
|
|
631
690
|
|
|
632
691
|
return None
|
|
633
692
|
|
|
@@ -11,7 +11,7 @@ import pkgutil
|
|
|
11
11
|
from nuitka import Options
|
|
12
12
|
from nuitka.code_generation.ConstantCodes import addDistributionMetadataValue
|
|
13
13
|
from nuitka.containers.OrderedSets import OrderedSet
|
|
14
|
-
from nuitka.plugins.
|
|
14
|
+
from nuitka.plugins.YamlPluginBase import NuitkaYamlPluginBase
|
|
15
15
|
from nuitka.PythonFlavors import isDebianPackagePython
|
|
16
16
|
from nuitka.utils.Distributions import getDistribution
|
|
17
17
|
from nuitka.utils.FileOperations import (
|
|
@@ -45,7 +45,11 @@ class NuitkaPluginDataFileCollector(NuitkaYamlPluginBase):
|
|
|
45
45
|
|
|
46
46
|
# Default to near module or inside package folder.
|
|
47
47
|
if target_dir is None:
|
|
48
|
-
if
|
|
48
|
+
if (
|
|
49
|
+
module.isCompiledPythonPackage()
|
|
50
|
+
or module.isUncompiledPythonPackage()
|
|
51
|
+
or module.isExtensionModulePackage()
|
|
52
|
+
):
|
|
49
53
|
target_dir = module_name.asPath()
|
|
50
54
|
else:
|
|
51
55
|
package_name = module_name.getPackageName()
|
|
@@ -97,7 +101,7 @@ class NuitkaPluginDataFileCollector(NuitkaYamlPluginBase):
|
|
|
97
101
|
|
|
98
102
|
for empty_dir in empty_dirs:
|
|
99
103
|
yield self.makeIncludedEmptyDirectory(
|
|
100
|
-
dest_path=os.path.join(target_dir, empty_dir),
|
|
104
|
+
dest_path=os.path.normpath(os.path.join(target_dir, empty_dir)),
|
|
101
105
|
reason="empty dir needed for %r" % module_name.asString(),
|
|
102
106
|
tags="config",
|
|
103
107
|
)
|
|
@@ -130,7 +134,7 @@ class NuitkaPluginDataFileCollector(NuitkaYamlPluginBase):
|
|
|
130
134
|
if os.path.isdir(source_path):
|
|
131
135
|
yield self.makeIncludedDataDirectory(
|
|
132
136
|
source_path=source_path,
|
|
133
|
-
dest_path=os.path.join(target_dir, data_dir),
|
|
137
|
+
dest_path=os.path.normpath(os.path.join(target_dir, data_dir)),
|
|
134
138
|
reason="package data directory '%s' for %r"
|
|
135
139
|
% (data_dir, module_name.asString()),
|
|
136
140
|
tags="config",
|
|
@@ -150,7 +154,7 @@ class NuitkaPluginDataFileCollector(NuitkaYamlPluginBase):
|
|
|
150
154
|
if os.path.isdir(source_path):
|
|
151
155
|
yield self.makeIncludedDataDirectory(
|
|
152
156
|
source_path=source_path,
|
|
153
|
-
dest_path=os.path.join(target_dir, raw_dir),
|
|
157
|
+
dest_path=os.path.normpath(os.path.join(target_dir, raw_dir)),
|
|
154
158
|
reason="package raw directory '%s' for %r"
|
|
155
159
|
% (raw_dir, module_name.asString()),
|
|
156
160
|
tags="config",
|
|
@@ -187,7 +191,12 @@ class NuitkaPluginDataFileCollector(NuitkaYamlPluginBase):
|
|
|
187
191
|
distribution = getDistribution(distribution_name)
|
|
188
192
|
|
|
189
193
|
if distribution is not None:
|
|
190
|
-
addDistributionMetadataValue(
|
|
194
|
+
addDistributionMetadataValue(
|
|
195
|
+
distribution_name=distribution_name,
|
|
196
|
+
distribution=distribution,
|
|
197
|
+
reason="According to Yaml configuration 'include-metadata' for '%s'"
|
|
198
|
+
% module_name.asString(),
|
|
199
|
+
)
|
|
191
200
|
|
|
192
201
|
def considerDataFiles(self, module):
|
|
193
202
|
full_name = module.getFullName()
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import os
|
|
9
9
|
import re
|
|
10
10
|
|
|
11
|
-
from nuitka import
|
|
11
|
+
from nuitka.Options import isStandaloneMode
|
|
12
12
|
from nuitka.plugins.PluginBase import NuitkaPluginBase
|
|
13
13
|
from nuitka.PythonFlavors import isAnacondaPython
|
|
14
14
|
from nuitka.utils.FileOperations import listDllFilesFromDirectory
|
|
@@ -42,7 +42,7 @@ class NuitkaPluginDelvewheel(NuitkaPluginBase):
|
|
|
42
42
|
|
|
43
43
|
@staticmethod
|
|
44
44
|
def isRelevant():
|
|
45
|
-
return
|
|
45
|
+
return isStandaloneMode()
|
|
46
46
|
|
|
47
47
|
# This is used by our exec below, to capture the dll directory without using a free
|
|
48
48
|
# variable.
|
|
@@ -75,7 +75,7 @@ class NuitkaPluginDelvewheel(NuitkaPluginBase):
|
|
|
75
75
|
|
|
76
76
|
# Fake the "__file__" to the proper value to the exec.
|
|
77
77
|
exec_globals = {
|
|
78
|
-
"__file__":
|
|
78
|
+
"__file__": source_filename,
|
|
79
79
|
"add_dll_directory": self._add_dll_directory,
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -111,6 +111,10 @@ class NuitkaPluginDelvewheel(NuitkaPluginBase):
|
|
|
111
111
|
detection_value=delvewheel_version,
|
|
112
112
|
)
|
|
113
113
|
|
|
114
|
+
def getModuleSpecificDllPaths(self, module_name):
|
|
115
|
+
if module_name in self.dll_directories:
|
|
116
|
+
yield self.dll_directories[module_name]
|
|
117
|
+
|
|
114
118
|
def getExtraDlls(self, module):
|
|
115
119
|
full_name = module.getFullName()
|
|
116
120
|
|
|
@@ -13,7 +13,7 @@ import os
|
|
|
13
13
|
import sys
|
|
14
14
|
|
|
15
15
|
from nuitka.Options import isStandaloneMode
|
|
16
|
-
from nuitka.plugins.
|
|
16
|
+
from nuitka.plugins.YamlPluginBase import NuitkaYamlPluginBase
|
|
17
17
|
from nuitka.PythonVersions import python_version
|
|
18
18
|
from nuitka.utils.Distributions import (
|
|
19
19
|
getDistributionFromModuleName,
|
|
@@ -41,7 +41,7 @@ class NuitkaPluginDllFiles(NuitkaYamlPluginBase):
|
|
|
41
41
|
def isRelevant():
|
|
42
42
|
return isStandaloneMode()
|
|
43
43
|
|
|
44
|
-
def _handleDllConfigFromFilenames(self,
|
|
44
|
+
def _handleDllConfigFromFilenames(self, dll_config, full_name, dest_path):
|
|
45
45
|
# A lot of details here, pylint: disable=too-many-locals
|
|
46
46
|
|
|
47
47
|
# The "when" is at that level too for these.
|
|
@@ -260,7 +260,9 @@ conditions are missing, or this version of the module needs treatment added."""
|
|
|
260
260
|
full_name=full_name, condition=dll_config.get("when", "True")
|
|
261
261
|
):
|
|
262
262
|
for dll_entry_point in self._handleDllConfig(
|
|
263
|
-
dll_config=dll_config,
|
|
263
|
+
dll_config=dll_config,
|
|
264
|
+
full_name=full_name,
|
|
265
|
+
count=count,
|
|
264
266
|
):
|
|
265
267
|
yield dll_entry_point
|
|
266
268
|
found += 1
|
|
@@ -15,7 +15,7 @@ import os
|
|
|
15
15
|
from nuitka.__past__ import iter_modules, unicode
|
|
16
16
|
from nuitka.importing.Importing import locateModule
|
|
17
17
|
from nuitka.importing.Recursion import decideRecursion
|
|
18
|
-
from nuitka.plugins.
|
|
18
|
+
from nuitka.plugins.YamlPluginBase import NuitkaYamlPluginBase
|
|
19
19
|
from nuitka.utils.ModuleNames import ModuleName
|
|
20
20
|
from nuitka.utils.Utils import isMacOS, isWin32Windows
|
|
21
21
|
|
|
@@ -84,6 +84,31 @@ class NuitkaPluginImplicitImports(NuitkaYamlPluginBase):
|
|
|
84
84
|
|
|
85
85
|
yield current
|
|
86
86
|
|
|
87
|
+
def _resolveImplicitImportsConfig(self, full_name, dependency):
|
|
88
|
+
if "(" in dependency:
|
|
89
|
+
value = self.evaluateExpression(
|
|
90
|
+
full_name=full_name,
|
|
91
|
+
expression=dependency,
|
|
92
|
+
config_name="depends value",
|
|
93
|
+
extra_context=None,
|
|
94
|
+
single_value=False,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
if type(value) in (str, unicode):
|
|
98
|
+
value = (value,)
|
|
99
|
+
|
|
100
|
+
for v in value:
|
|
101
|
+
if "*" in v or "?" in v:
|
|
102
|
+
for resolved in self._resolveModulePattern(v):
|
|
103
|
+
yield resolved
|
|
104
|
+
else:
|
|
105
|
+
yield v
|
|
106
|
+
elif "*" in dependency or "?" in dependency:
|
|
107
|
+
for resolved in self._resolveModulePattern(dependency):
|
|
108
|
+
yield resolved
|
|
109
|
+
else:
|
|
110
|
+
yield dependency
|
|
111
|
+
|
|
87
112
|
def _handleImplicitImportsConfig(self, module, config):
|
|
88
113
|
full_name = module.getFullName()
|
|
89
114
|
|
|
@@ -102,25 +127,11 @@ class NuitkaPluginImplicitImports(NuitkaYamlPluginBase):
|
|
|
102
127
|
else:
|
|
103
128
|
dependency = full_name.getSiblingNamed(dependency[1:]).asString()
|
|
104
129
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
extra_context=None,
|
|
111
|
-
single_value=False,
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
if type(value) in (str, unicode):
|
|
115
|
-
value = (value,)
|
|
116
|
-
|
|
117
|
-
for v in value:
|
|
118
|
-
yield v
|
|
119
|
-
elif "*" in dependency or "?" in dependency:
|
|
120
|
-
for resolved in self._resolveModulePattern(dependency):
|
|
121
|
-
yield resolved
|
|
122
|
-
else:
|
|
123
|
-
yield dependency
|
|
130
|
+
for value in self._resolveImplicitImportsConfig(
|
|
131
|
+
full_name=full_name,
|
|
132
|
+
dependency=dependency,
|
|
133
|
+
):
|
|
134
|
+
yield value
|
|
124
135
|
|
|
125
136
|
def _getImportsByFullname(self, module, full_name):
|
|
126
137
|
"""Provides names of modules to imported implicitly."""
|
|
@@ -255,6 +266,9 @@ class NuitkaPluginImplicitImports(NuitkaYamlPluginBase):
|
|
|
255
266
|
elif full_name == crypto_module_name + ".Cipher.PKCS1_v1_5":
|
|
256
267
|
yield crypto_module_name + ".Cipher._pkcs1_decode"
|
|
257
268
|
|
|
269
|
+
elif full_name == crypto_module_name + ".Cipher.PKCS1_OAEP":
|
|
270
|
+
yield crypto_module_name + ".Cipher._pkcs1_decode"
|
|
271
|
+
|
|
258
272
|
elif full_name == crypto_module_name + ".Math._IntegerCustom":
|
|
259
273
|
yield crypto_module_name + ".Math._modexp"
|
|
260
274
|
|
|
@@ -75,7 +75,9 @@ from inspect import getsource
|
|
|
75
75
|
("matplotlib_version", "__version__"),
|
|
76
76
|
),
|
|
77
77
|
)
|
|
78
|
-
except NuitkaCalledProcessError:
|
|
78
|
+
except NuitkaCalledProcessError as e:
|
|
79
|
+
self.debug("Exception during detection: %r" % e)
|
|
80
|
+
|
|
79
81
|
if "MPLBACKEND" not in os.environ:
|
|
80
82
|
self.sysexit(
|
|
81
83
|
"""\
|
|
@@ -124,10 +124,10 @@ Monkey patching "multiprocessing" for compiled methods.""",
|
|
|
124
124
|
|
|
125
125
|
# For the call stack, this may look bad or different to what CPython
|
|
126
126
|
# does, but such is life. The forking module was split up into multiple
|
|
127
|
-
# modules in
|
|
127
|
+
# modules in Python3 so this is doubled. TODO: Move the version check
|
|
128
128
|
# into the code and let Nuitka compile time optimize it, which will also
|
|
129
129
|
# make sure joblib support is there for Python2 as well.
|
|
130
|
-
if python_version >=
|
|
130
|
+
if python_version >= 0x300:
|
|
131
131
|
source_code += """
|
|
132
132
|
def __nuitka_freeze_support():
|
|
133
133
|
import sys
|
|
@@ -1433,7 +1433,7 @@ class NuitkaPluginNoQt(NuitkaPluginBase):
|
|
|
1433
1433
|
"""This is a plugins for suppression of all Qt binding plugins."""
|
|
1434
1434
|
|
|
1435
1435
|
plugin_name = "no-qt"
|
|
1436
|
-
plugin_desc = "Disable all Qt bindings
|
|
1436
|
+
plugin_desc = "Disable inclusion of all Qt bindings."
|
|
1437
1437
|
|
|
1438
1438
|
warned_about = set()
|
|
1439
1439
|
|
|
@@ -1442,22 +1442,21 @@ class NuitkaPluginNoQt(NuitkaPluginBase):
|
|
|
1442
1442
|
):
|
|
1443
1443
|
top_package_name = module_name.getTopLevelPackageName()
|
|
1444
1444
|
|
|
1445
|
-
if
|
|
1446
|
-
if top_package_name in
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
"""\
|
|
1445
|
+
if top_package_name in getQtBindingNames():
|
|
1446
|
+
if isStandaloneMode() and top_package_name not in self.warned_about:
|
|
1447
|
+
self.info(
|
|
1448
|
+
"""\
|
|
1450
1449
|
Unwanted import of '%(unwanted)s' that is forbidden encountered, preventing \
|
|
1451
1450
|
its use. As a result an "ImportError" might be given at run time. Uninstall \
|
|
1452
1451
|
it for full compatible behavior with the uncompiled code to debug it."""
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1452
|
+
% {
|
|
1453
|
+
"unwanted": top_package_name,
|
|
1454
|
+
}
|
|
1455
|
+
)
|
|
1457
1456
|
|
|
1458
|
-
|
|
1457
|
+
self.warned_about.add(top_package_name)
|
|
1459
1458
|
|
|
1460
|
-
|
|
1459
|
+
return (False, "Not included due to all Qt bindings disallowed.")
|
|
1461
1460
|
|
|
1462
1461
|
def getEvaluationConditionControlTags(self):
|
|
1463
1462
|
return {"use_noqt": True}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
""" Plugin for spacy.
|
|
5
|
+
|
|
6
|
+
spell-checker: ignore spacy
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from nuitka.code_generation.ConstantCodes import addDistributionMetadataValue
|
|
10
|
+
from nuitka.containers.OrderedSets import OrderedSet
|
|
11
|
+
from nuitka.Options import isStandaloneMode
|
|
12
|
+
from nuitka.plugins.PluginBase import NuitkaPluginBase
|
|
13
|
+
from nuitka.utils.Distributions import getEntryPointGroup
|
|
14
|
+
from nuitka.utils.ModuleNames import ModuleName
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class NuitkaPluginSpacy(NuitkaPluginBase):
|
|
18
|
+
"""This class represents the main logic of the plugin."""
|
|
19
|
+
|
|
20
|
+
plugin_name = "spacy"
|
|
21
|
+
plugin_desc = "Required by 'spacy' package."
|
|
22
|
+
|
|
23
|
+
def __init__(self, include_language_models):
|
|
24
|
+
self.include_language_models = tuple(
|
|
25
|
+
ModuleName(include_language_model)
|
|
26
|
+
for include_language_model in include_language_models
|
|
27
|
+
)
|
|
28
|
+
self.available_language_models = None
|
|
29
|
+
|
|
30
|
+
self.used_language_model_names = None
|
|
31
|
+
|
|
32
|
+
@staticmethod
|
|
33
|
+
def isAlwaysEnabled():
|
|
34
|
+
return True
|
|
35
|
+
|
|
36
|
+
@staticmethod
|
|
37
|
+
def isRelevant():
|
|
38
|
+
return isStandaloneMode()
|
|
39
|
+
|
|
40
|
+
@classmethod
|
|
41
|
+
def addPluginCommandLineOptions(cls, group):
|
|
42
|
+
group.add_option(
|
|
43
|
+
"--spacy-language-model",
|
|
44
|
+
action="append",
|
|
45
|
+
dest="include_language_models",
|
|
46
|
+
default=[],
|
|
47
|
+
help="""\
|
|
48
|
+
Spacy language models to use. Can be specified multiple times. Use 'all' to
|
|
49
|
+
include all downloaded models.""",
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
def _getInstalledSpaceLanguageModels(self):
|
|
53
|
+
if self.available_language_models is None:
|
|
54
|
+
self.available_language_models = tuple(
|
|
55
|
+
entry_point.module_name
|
|
56
|
+
for entry_point in sorted(getEntryPointGroup("spacy_models"))
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
return self.available_language_models
|
|
60
|
+
|
|
61
|
+
def getImplicitImports(self, module):
|
|
62
|
+
if module.getFullName() == "spacy":
|
|
63
|
+
self.used_language_model_names = OrderedSet()
|
|
64
|
+
|
|
65
|
+
if "all" in self.include_language_models:
|
|
66
|
+
self.used_language_model_names.update(
|
|
67
|
+
self._getInstalledSpaceLanguageModels()
|
|
68
|
+
)
|
|
69
|
+
else:
|
|
70
|
+
for include_language_model_name in self.include_language_models:
|
|
71
|
+
if (
|
|
72
|
+
include_language_model_name
|
|
73
|
+
in self._getInstalledSpaceLanguageModels()
|
|
74
|
+
):
|
|
75
|
+
self.used_language_model_names.add(include_language_model_name)
|
|
76
|
+
else:
|
|
77
|
+
self.sysexit(
|
|
78
|
+
"""\
|
|
79
|
+
Error, requested to include language model '%s' that was \
|
|
80
|
+
not found, the list of installed ones is '%s'."""
|
|
81
|
+
% (
|
|
82
|
+
include_language_model_name,
|
|
83
|
+
",".join(self._getInstalledSpaceLanguageModels()),
|
|
84
|
+
)
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
if not self.used_language_model_names:
|
|
88
|
+
self.warning(
|
|
89
|
+
"""\
|
|
90
|
+
No language models included. Use the option '--spacy-language-model=language_model_name' to \
|
|
91
|
+
include one. Use 'all' to include all downloaded ones, or select from the list of installed \
|
|
92
|
+
ones: %s"""
|
|
93
|
+
% ",".join(self._getInstalledSpaceLanguageModels())
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
for used_language_model_name in self.used_language_model_names:
|
|
97
|
+
yield used_language_model_name
|
|
98
|
+
|
|
99
|
+
def considerDataFiles(self, module):
|
|
100
|
+
if module.getFullName() == "spacy":
|
|
101
|
+
# Do not use it accidentally for anything else
|
|
102
|
+
del module
|
|
103
|
+
|
|
104
|
+
for used_language_model_name in self.used_language_model_names:
|
|
105
|
+
# Meta data is required for language models to be accepted.
|
|
106
|
+
addDistributionMetadataValue(
|
|
107
|
+
distribution_name=used_language_model_name.asString(),
|
|
108
|
+
distribution=None,
|
|
109
|
+
reason="for 'spacy' to locate the language model",
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
module_folder = self.locateModule(used_language_model_name)
|
|
113
|
+
|
|
114
|
+
yield self.makeIncludedDataDirectory(
|
|
115
|
+
source_path=module_folder,
|
|
116
|
+
dest_path=used_language_model_name.asPath(),
|
|
117
|
+
reason="model data for %r" % (used_language_model_name.asString()),
|
|
118
|
+
tags="spacy",
|
|
119
|
+
raw=True,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
124
|
+
# integrates with CPython, but also works on its own.
|
|
125
|
+
#
|
|
126
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
127
|
+
# you may not use this file except in compliance with the License.
|
|
128
|
+
# You may obtain a copy of the License at
|
|
129
|
+
#
|
|
130
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
131
|
+
#
|
|
132
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
133
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
134
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
135
|
+
# See the License for the specific language governing permissions and
|
|
136
|
+
# limitations under the License.
|