Nuitka-winsvc 2.4.11__cp311-cp311-win_amd64.whl → 2.5.6__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.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/METADATA +56 -109
- {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/RECORD +304 -280
- {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/WHEEL +1 -1
- nuitka/Builtins.py +31 -0
- nuitka/HardImportRegistry.py +8 -0
- nuitka/MainControl.py +9 -4
- nuitka/OptionParsing.py +108 -54
- nuitka/Options.py +69 -13
- nuitka/OutputDirectories.py +7 -2
- nuitka/PostProcessing.py +69 -38
- nuitka/Progress.py +16 -1
- nuitka/PythonVersions.py +2 -1
- nuitka/Serialization.py +4 -2
- nuitka/Tracing.py +69 -1
- nuitka/Version.py +2 -2
- nuitka/build/Backend.scons +45 -5
- nuitka/build/CCompilerVersion.scons +6 -0
- nuitka/build/Onefile.scons +6 -0
- nuitka/build/SconsCaching.py +4 -0
- nuitka/build/SconsCompilerSettings.py +14 -3
- nuitka/build/SconsInterface.py +3 -0
- nuitka/build/SconsUtils.py +5 -0
- nuitka/build/include/nuitka/allocator.h +124 -1
- nuitka/build/include/nuitka/calling.h +6 -6
- nuitka/build/include/nuitka/compiled_asyncgen.h +10 -7
- nuitka/build/include/nuitka/compiled_frame.h +2 -1
- nuitka/build/include/nuitka/constants.h +8 -0
- nuitka/build/include/nuitka/debug_settings.h +60 -0
- nuitka/build/include/nuitka/exceptions.h +264 -121
- nuitka/build/include/nuitka/helper/attributes.h +0 -4
- nuitka/build/include/nuitka/helper/calling_generated.h +52 -52
- nuitka/build/include/nuitka/helper/comparisons_dual_eq.h +47 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_ge.h +39 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_gt.h +39 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_le.h +47 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_lt.h +47 -0
- nuitka/build/include/nuitka/helper/comparisons_dual_ne.h +39 -0
- nuitka/build/include/nuitka/helper/dictionaries.h +75 -31
- nuitka/build/include/nuitka/helper/ints.h +86 -37
- nuitka/build/include/nuitka/helper/iterators.h +82 -34
- nuitka/build/include/nuitka/helper/operations.h +3 -0
- nuitka/build/include/nuitka/helper/operations_binary_add.h +6 -0
- nuitka/build/include/nuitka/helper/operations_binary_dual_add.h +34 -0
- nuitka/build/include/nuitka/helper/operations_binary_sub.h +6 -0
- nuitka/build/include/nuitka/helper/operations_inplace_add.h +3 -0
- nuitka/build/include/nuitka/helper/operations_inplace_sub.h +3 -0
- nuitka/build/include/nuitka/helper/raising.h +47 -28
- nuitka/build/include/nuitka/helper/richcomparisons.h +7 -0
- nuitka/build/include/nuitka/helper/tuples.h +12 -0
- nuitka/build/include/nuitka/helpers.h +12 -2
- nuitka/build/include/nuitka/prelude.h +36 -25
- nuitka/build/include/nuitka/printing.h +9 -7
- nuitka/build/include/nuitka/threading.h +15 -1
- nuitka/build/include/nuitka/type_aliases.h +3 -0
- nuitka/build/inline_copy/stubgen/astunparse.py +938 -0
- nuitka/build/inline_copy/stubgen/six.py +998 -0
- nuitka/build/inline_copy/stubgen/stubgen.py +307 -0
- nuitka/build/static_src/CompiledAsyncgenType.c +45 -39
- nuitka/build/static_src/CompiledCellType.c +6 -4
- nuitka/build/static_src/CompiledCodeHelpers.c +106 -40
- nuitka/build/static_src/CompiledCoroutineType.c +41 -31
- nuitka/build/static_src/CompiledFrameType.c +110 -79
- nuitka/build/static_src/CompiledFunctionType.c +173 -151
- nuitka/build/static_src/CompiledGeneratorType.c +51 -49
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +433 -46
- nuitka/build/static_src/CompiledMethodType.c +6 -12
- nuitka/build/static_src/HelpersAllocator.c +266 -28
- nuitka/build/static_src/HelpersAttributes.c +0 -21
- nuitka/build/static_src/HelpersBuiltin.c +23 -14
- nuitka/build/static_src/HelpersCalling.c +7 -7
- nuitka/build/static_src/HelpersCallingGenerated.c +70 -70
- nuitka/build/static_src/HelpersComparisonDualEq.c +183 -0
- nuitka/build/static_src/HelpersComparisonDualGe.c +121 -0
- nuitka/build/static_src/HelpersComparisonDualGt.c +121 -0
- nuitka/build/static_src/HelpersComparisonDualLe.c +183 -0
- nuitka/build/static_src/HelpersComparisonDualLt.c +183 -0
- nuitka/build/static_src/HelpersComparisonDualNe.c +121 -0
- nuitka/build/static_src/HelpersComparisonEq.c +18 -4
- nuitka/build/static_src/HelpersComparisonGe.c +18 -4
- nuitka/build/static_src/HelpersComparisonGt.c +18 -4
- nuitka/build/static_src/HelpersComparisonLe.c +18 -4
- nuitka/build/static_src/HelpersComparisonLt.c +18 -4
- nuitka/build/static_src/HelpersComparisonNe.c +18 -4
- nuitka/build/static_src/HelpersConsole.c +34 -8
- nuitka/build/static_src/HelpersConstantsBlob.c +4 -2
- nuitka/build/static_src/HelpersDeepcopy.c +1 -0
- nuitka/build/static_src/HelpersDictionaries.c +195 -36
- nuitka/build/static_src/HelpersDictionariesGenerated.c +12 -107
- nuitka/build/static_src/HelpersExceptions.c +24 -50
- nuitka/build/static_src/HelpersFiles.c +79 -5
- nuitka/build/static_src/HelpersImport.c +13 -9
- nuitka/build/static_src/HelpersImportHard.c +23 -46
- nuitka/build/static_src/HelpersLists.c +98 -9
- nuitka/build/static_src/HelpersOperationBinaryAdd.c +224 -6
- nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +3 -0
- nuitka/build/static_src/HelpersOperationBinaryBitand.c +5 -5
- nuitka/build/static_src/HelpersOperationBinaryBitor.c +5 -5
- nuitka/build/static_src/HelpersOperationBinaryBitxor.c +5 -5
- nuitka/build/static_src/HelpersOperationBinaryDivmod.c +8 -2
- nuitka/build/static_src/HelpersOperationBinaryDualAdd.c +172 -0
- nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +14 -8
- nuitka/build/static_src/HelpersOperationBinaryLshift.c +36 -36
- nuitka/build/static_src/HelpersOperationBinaryMatmult.c +1 -0
- nuitka/build/static_src/HelpersOperationBinaryMod.c +22 -10
- nuitka/build/static_src/HelpersOperationBinaryMult.c +17 -7
- nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +14 -8
- nuitka/build/static_src/HelpersOperationBinaryPow.c +24 -24
- nuitka/build/static_src/HelpersOperationBinaryRshift.c +4 -4
- nuitka/build/static_src/HelpersOperationBinarySub.c +229 -8
- nuitka/build/static_src/HelpersOperationBinaryTruediv.c +8 -2
- nuitka/build/static_src/HelpersOperationInplaceAdd.c +162 -10
- nuitka/build/static_src/HelpersOperationInplaceBitand.c +5 -5
- nuitka/build/static_src/HelpersOperationInplaceBitor.c +5 -5
- nuitka/build/static_src/HelpersOperationInplaceBitxor.c +5 -5
- nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +11 -6
- nuitka/build/static_src/HelpersOperationInplaceLshift.c +20 -20
- nuitka/build/static_src/HelpersOperationInplaceMatmult.c +1 -0
- nuitka/build/static_src/HelpersOperationInplaceMod.c +11 -6
- nuitka/build/static_src/HelpersOperationInplaceMult.c +11 -6
- nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +11 -6
- nuitka/build/static_src/HelpersOperationInplacePow.c +20 -20
- nuitka/build/static_src/HelpersOperationInplaceRshift.c +4 -4
- nuitka/build/static_src/HelpersOperationInplaceSub.c +163 -10
- nuitka/build/static_src/HelpersOperationInplaceTruediv.c +6 -1
- nuitka/build/static_src/HelpersProfiling.c +1 -1
- nuitka/build/static_src/HelpersRaising.c +255 -310
- nuitka/build/static_src/HelpersStrings.c +1 -1
- nuitka/build/static_src/HelpersTuples.c +2 -2
- nuitka/build/static_src/HelpersTypes.c +98 -2
- nuitka/build/static_src/MainProgram.c +132 -28
- nuitka/build/static_src/MetaPathBasedLoader.c +18 -19
- nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +134 -11
- nuitka/build/static_src/OnefileBootstrap.c +6 -1
- nuitka/code_generation/AsyncgenCodes.py +2 -6
- nuitka/code_generation/BinaryOperationHelperDefinitions.py +269 -167
- nuitka/code_generation/BuiltinCodes.py +9 -1
- nuitka/code_generation/CallCodes.py +16 -16
- nuitka/code_generation/CodeGeneration.py +14 -2
- nuitka/code_generation/CodeHelperSelection.py +1 -1
- nuitka/code_generation/CodeHelpers.py +4 -1
- nuitka/code_generation/CodeObjectCodes.py +2 -2
- nuitka/code_generation/ComparisonCodes.py +13 -2
- nuitka/code_generation/ComparisonHelperDefinitions.py +23 -8
- nuitka/code_generation/Contexts.py +28 -16
- nuitka/code_generation/CoroutineCodes.py +2 -6
- nuitka/code_generation/DictCodes.py +3 -3
- nuitka/code_generation/ErrorCodes.py +34 -50
- nuitka/code_generation/ExceptionCodes.py +165 -96
- nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +25 -10
- nuitka/code_generation/FrameCodes.py +4 -11
- nuitka/code_generation/FunctionCodes.py +2 -6
- nuitka/code_generation/GeneratorCodes.py +2 -6
- nuitka/code_generation/GlobalConstants.py +8 -2
- nuitka/code_generation/GlobalsLocalsCodes.py +2 -2
- nuitka/code_generation/IteratorCodes.py +67 -54
- nuitka/code_generation/LineNumberCodes.py +1 -3
- nuitka/code_generation/ModuleCodes.py +28 -4
- nuitka/code_generation/OperationCodes.py +51 -20
- nuitka/code_generation/PackageResourceCodes.py +37 -0
- nuitka/code_generation/RaisingCodes.py +164 -90
- nuitka/code_generation/Reports.py +13 -5
- nuitka/code_generation/ReturnCodes.py +2 -16
- nuitka/code_generation/TryCodes.py +12 -24
- nuitka/code_generation/TypeAliasCodes.py +48 -0
- nuitka/code_generation/VariableCodes.py +99 -40
- nuitka/code_generation/VariableDeclarations.py +8 -8
- nuitka/code_generation/YieldCodes.py +1 -1
- nuitka/code_generation/c_types/CTypeBases.py +10 -2
- nuitka/code_generation/c_types/CTypeModuleDictVariables.py +3 -0
- nuitka/code_generation/c_types/CTypeNuitkaBooleans.py +3 -4
- nuitka/code_generation/c_types/CTypeNuitkaInts.py +70 -25
- nuitka/code_generation/c_types/CTypeNuitkaVoids.py +1 -1
- nuitka/code_generation/c_types/CTypePyObjectPointers.py +16 -6
- nuitka/code_generation/templates/CodeTemplatesAsyncgens.py +2 -2
- nuitka/code_generation/templates/CodeTemplatesConstants.py +11 -3
- nuitka/code_generation/templates/CodeTemplatesCoroutines.py +2 -2
- nuitka/code_generation/templates/CodeTemplatesExceptions.py +15 -16
- nuitka/code_generation/templates/CodeTemplatesFrames.py +18 -10
- nuitka/code_generation/templates/CodeTemplatesFunction.py +2 -2
- nuitka/code_generation/templates/CodeTemplatesGeneratorFunction.py +2 -2
- nuitka/code_generation/templates/CodeTemplatesIterators.py +1 -35
- nuitka/code_generation/templates/CodeTemplatesModules.py +34 -4
- nuitka/code_generation/templates/CodeTemplatesVariables.py +76 -0
- nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +3 -3
- nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +3 -3
- nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +4 -106
- nuitka/code_generation/templates_c/HelperImportHard.c.j2 +1 -2
- nuitka/code_generation/templates_c/HelperLongTools.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperOperationBinaryDual.c.j2 +115 -0
- nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +9 -9
- nuitka/code_generation/templates_c/HelperOperationComparisonDual.c.j2 +86 -0
- nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +9 -9
- nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +7 -7
- nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +9 -9
- nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +7 -7
- nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +4 -4
- nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperSlotsInt.c.j2 +31 -31
- nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +1 -1
- nuitka/containers/Namedtuples.py +6 -0
- nuitka/containers/OrderedSets.py +105 -5
- nuitka/distutils/Build.py +14 -0
- nuitka/distutils/DistutilCommands.py +50 -10
- nuitka/finalizations/Finalization.py +3 -3
- nuitka/finalizations/FinalizeMarkups.py +10 -14
- nuitka/freezer/DependsExe.py +5 -2
- nuitka/freezer/DllDependenciesMacOS.py +18 -1
- nuitka/freezer/DllDependenciesWin32.py +26 -12
- nuitka/freezer/ImportDetection.py +6 -0
- nuitka/freezer/IncludedDataFiles.py +37 -6
- nuitka/freezer/Onefile.py +1 -0
- nuitka/freezer/Standalone.py +72 -18
- nuitka/importing/Importing.py +33 -6
- nuitka/importing/Recursion.py +5 -2
- nuitka/importing/StandardLibrary.py +57 -59
- nuitka/nodes/AsyncgenNodes.py +3 -6
- nuitka/nodes/BuiltinIteratorNodes.py +2 -2
- nuitka/nodes/BuiltinRefNodes.py +14 -30
- nuitka/nodes/ChildrenHavingMixins.py +439 -46
- nuitka/nodes/ConditionalNodes.py +3 -2
- nuitka/nodes/CoroutineNodes.py +3 -6
- nuitka/nodes/DictionaryNodes.py +1 -1
- nuitka/nodes/ExceptionNodes.py +102 -26
- nuitka/nodes/ExpressionBasesGenerated.py +288 -4
- nuitka/nodes/FrameNodes.py +22 -11
- nuitka/nodes/FunctionNodes.py +3 -3
- nuitka/nodes/GeneratorNodes.py +3 -6
- nuitka/nodes/HardImportNodesGenerated.py +182 -0
- nuitka/nodes/ImportNodes.py +2 -2
- nuitka/nodes/NodeBases.py +28 -1
- nuitka/nodes/NodeMakingHelpers.py +71 -50
- nuitka/nodes/OperatorNodesUnary.py +128 -3
- nuitka/nodes/OsSysNodes.py +37 -6
- nuitka/nodes/OutlineNodes.py +2 -2
- nuitka/nodes/StatementBasesGenerated.py +0 -2
- nuitka/nodes/StatementNodes.py +8 -7
- nuitka/nodes/SubscriptNodes.py +1 -1
- nuitka/nodes/TypeNodes.py +28 -1
- nuitka/nodes/VariableAssignNodes.py +2 -1
- nuitka/nodes/shapes/BuiltinTypeShapes.py +24 -7
- nuitka/nodes/shapes/IteratorShapes.py +71 -0
- nuitka/nodes/shapes/ShapeMixins.py +18 -0
- nuitka/nodes/shapes/StandardShapes.py +47 -44
- nuitka/optimizations/BytecodeDemotion.py +2 -1
- nuitka/plugins/PluginBase.py +64 -22
- nuitka/plugins/Plugins.py +16 -3
- nuitka/plugins/standard/AntiBloatPlugin.py +23 -12
- nuitka/plugins/standard/DllFilesPlugin.py +78 -2
- nuitka/plugins/standard/ImplicitImports.py +5 -15
- nuitka/plugins/standard/KivyPlugin.py +3 -12
- nuitka/plugins/standard/MatplotlibPlugin.py +12 -1
- nuitka/plugins/standard/MultiprocessingPlugin.py +11 -20
- nuitka/plugins/standard/OptionsNannyPlugin.py +5 -4
- nuitka/plugins/standard/PlaywrightPlugin.py +184 -0
- nuitka/plugins/standard/PySidePyQtPlugin.py +8 -0
- nuitka/plugins/standard/TkinterPlugin.py +23 -3
- nuitka/plugins/standard/TransformersPlugin.py +70 -275
- nuitka/plugins/standard/standard.nuitka-package.config.yml +413 -30
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +35 -2
- nuitka/reports/CompilationReportReader.py +12 -0
- nuitka/reports/Reports.py +11 -0
- nuitka/specs/BuiltinParameterSpecs.py +5 -1
- nuitka/specs/HardImportSpecs.py +7 -0
- nuitka/specs/ParameterSpecs.py +4 -4
- nuitka/tools/environments/Virtualenv.py +13 -5
- nuitka/tools/general/dll_report/__main__.py +10 -1
- nuitka/tools/onefile_compressor/OnefileCompressor.py +1 -1
- nuitka/tools/podman/__main__.py +4 -2
- nuitka/tools/specialize/CTypeDescriptions.py +158 -9
- nuitka/tools/specialize/SpecializeC.py +218 -56
- nuitka/tools/testing/Common.py +69 -62
- nuitka/tools/testing/compare_with_cpython/__main__.py +3 -1
- nuitka/tools/testing/measure_construct_performance/__main__.py +1 -8
- nuitka/tools/testing/run_nuitka_tests/__main__.py +77 -11
- nuitka/tools/watch/AutoStage.py +1 -0
- nuitka/tree/Building.py +10 -37
- nuitka/tree/ComplexCallHelperFunctions.py +4 -0
- nuitka/tree/ReformulationAssertStatements.py +31 -14
- nuitka/tree/ReformulationAssignmentStatements.py +5 -1
- nuitka/tree/ReformulationClasses3.py +94 -19
- nuitka/tree/ReformulationDictionaryCreation.py +1 -0
- nuitka/tree/ReformulationFunctionStatements.py +1 -1
- nuitka/tree/ReformulationMatchStatements.py +3 -1
- nuitka/tree/ReformulationYieldExpressions.py +23 -5
- nuitka/utils/CommandLineOptions.py +27 -3
- nuitka/utils/Download.py +2 -2
- nuitka/utils/Execution.py +36 -31
- nuitka/utils/FileOperations.py +18 -39
- nuitka/utils/Hashing.py +5 -1
- nuitka/utils/Importing.py +2 -14
- nuitka/utils/InlineCopies.py +52 -0
- nuitka/utils/InstalledPythons.py +9 -4
- nuitka/utils/Json.py +2 -2
- nuitka/utils/PackageResources.py +44 -0
- nuitka/utils/SharedLibraries.py +24 -0
- nuitka/utils/Signing.py +9 -1
- nuitka/utils/Utils.py +1 -0
- {Nuitka_winsvc-2.4.11.data → Nuitka_winsvc-2.5.6.data}/scripts/nuitka-run.cmd +0 -0
- {Nuitka_winsvc-2.4.11.data → Nuitka_winsvc-2.5.6.data}/scripts/nuitka.cmd +0 -0
- {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/top_level.txt +0 -0
|
@@ -11,7 +11,10 @@ source code comments with Developer Manual sections.
|
|
|
11
11
|
from nuitka.nodes.BuiltinRefNodes import ExpressionBuiltinExceptionRef
|
|
12
12
|
from nuitka.nodes.ConditionalNodes import makeStatementConditional
|
|
13
13
|
from nuitka.nodes.ContainerMakingNodes import makeExpressionMakeTuple
|
|
14
|
-
from nuitka.nodes.ExceptionNodes import
|
|
14
|
+
from nuitka.nodes.ExceptionNodes import (
|
|
15
|
+
StatementRaiseException,
|
|
16
|
+
makeBuiltinMakeExceptionNode,
|
|
17
|
+
)
|
|
15
18
|
from nuitka.nodes.OperatorNodesUnary import ExpressionOperationNot
|
|
16
19
|
from nuitka.Options import hasPythonFlagNoAsserts
|
|
17
20
|
from nuitka.PythonVersions import python_version
|
|
@@ -39,20 +42,34 @@ def buildAssertNode(provider, node, source_ref):
|
|
|
39
42
|
if hasPythonFlagNoAsserts():
|
|
40
43
|
return None
|
|
41
44
|
|
|
42
|
-
if
|
|
43
|
-
exception_value
|
|
44
|
-
|
|
45
|
+
if python_version < 0x3C0:
|
|
46
|
+
if exception_value is not None and python_version >= 0x272:
|
|
47
|
+
exception_value = makeExpressionMakeTuple(
|
|
48
|
+
elements=(exception_value,), source_ref=source_ref
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
raise_statement = StatementRaiseException(
|
|
52
|
+
exception_type=ExpressionBuiltinExceptionRef(
|
|
53
|
+
exception_name="AssertionError", source_ref=source_ref
|
|
54
|
+
),
|
|
55
|
+
exception_value=exception_value,
|
|
56
|
+
exception_trace=None,
|
|
57
|
+
exception_cause=None,
|
|
58
|
+
source_ref=source_ref,
|
|
59
|
+
)
|
|
60
|
+
else:
|
|
61
|
+
raise_statement = StatementRaiseException(
|
|
62
|
+
exception_type=makeBuiltinMakeExceptionNode(
|
|
63
|
+
exception_name="AssertionError",
|
|
64
|
+
args=(exception_value,) if exception_value else (),
|
|
65
|
+
for_raise=False,
|
|
66
|
+
source_ref=source_ref,
|
|
67
|
+
),
|
|
68
|
+
exception_value=None,
|
|
69
|
+
exception_cause=None,
|
|
70
|
+
exception_trace=None,
|
|
71
|
+
source_ref=source_ref,
|
|
45
72
|
)
|
|
46
|
-
|
|
47
|
-
raise_statement = StatementRaiseException(
|
|
48
|
-
exception_type=ExpressionBuiltinExceptionRef(
|
|
49
|
-
exception_name="AssertionError", source_ref=source_ref
|
|
50
|
-
),
|
|
51
|
-
exception_value=exception_value,
|
|
52
|
-
exception_trace=None,
|
|
53
|
-
exception_cause=None,
|
|
54
|
-
source_ref=source_ref,
|
|
55
|
-
)
|
|
56
73
|
|
|
57
74
|
return makeStatementConditional(
|
|
58
75
|
condition=ExpressionOperationNot(
|
|
@@ -53,7 +53,7 @@ from nuitka.nodes.SubscriptNodes import (
|
|
|
53
53
|
StatementAssignmentSubscript,
|
|
54
54
|
StatementDelSubscript,
|
|
55
55
|
)
|
|
56
|
-
from nuitka.nodes.TypeNodes import ExpressionTypeAlias
|
|
56
|
+
from nuitka.nodes.TypeNodes import ExpressionTypeAlias, ExpressionTypeVariable
|
|
57
57
|
from nuitka.nodes.VariableAssignNodes import makeStatementAssignmentVariable
|
|
58
58
|
from nuitka.nodes.VariableDelNodes import makeStatementDelVariable
|
|
59
59
|
from nuitka.nodes.VariableNameNodes import (
|
|
@@ -1221,6 +1221,10 @@ def buildNamedExprNode(provider, node, source_ref):
|
|
|
1221
1221
|
return outline_body
|
|
1222
1222
|
|
|
1223
1223
|
|
|
1224
|
+
def buildTypeVarNode(node, source_ref):
|
|
1225
|
+
return ExpressionTypeVariable(node.name, source_ref=source_ref)
|
|
1226
|
+
|
|
1227
|
+
|
|
1224
1228
|
def buildTypeAliasNode(provider, node, source_ref):
|
|
1225
1229
|
"""Python3.12 or higher, type alias statements."""
|
|
1226
1230
|
|
|
@@ -63,6 +63,7 @@ from nuitka.nodes.NodeMakingHelpers import (
|
|
|
63
63
|
makeRaiseExceptionExpressionFromTemplate,
|
|
64
64
|
mergeStatements,
|
|
65
65
|
)
|
|
66
|
+
from nuitka.nodes.OperatorNodes import makeBinaryOperationNode
|
|
66
67
|
from nuitka.nodes.ReturnNodes import StatementReturn
|
|
67
68
|
from nuitka.nodes.StatementNodes import StatementExpressionOnly
|
|
68
69
|
from nuitka.nodes.SubscriptNodes import makeExpressionIndexLookup
|
|
@@ -70,9 +71,13 @@ from nuitka.nodes.TypeNodes import (
|
|
|
70
71
|
ExpressionBuiltinType1,
|
|
71
72
|
ExpressionSubtypeCheck,
|
|
72
73
|
ExpressionTypeCheck,
|
|
74
|
+
ExpressionTypeMakeGeneric,
|
|
73
75
|
)
|
|
74
76
|
from nuitka.nodes.VariableAssignNodes import makeStatementAssignmentVariable
|
|
75
|
-
from nuitka.nodes.VariableNameNodes import
|
|
77
|
+
from nuitka.nodes.VariableNameNodes import (
|
|
78
|
+
ExpressionVariableNameRef,
|
|
79
|
+
StatementAssignmentVariableName,
|
|
80
|
+
)
|
|
76
81
|
from nuitka.nodes.VariableRefNodes import (
|
|
77
82
|
ExpressionTempVariableRef,
|
|
78
83
|
ExpressionVariableRef,
|
|
@@ -177,11 +182,36 @@ def buildClassNode3(provider, node, source_ref):
|
|
|
177
182
|
|
|
178
183
|
# Only local variable, for provision to methods.
|
|
179
184
|
class_variable = class_locals_scope.getLocalVariable(
|
|
180
|
-
owner=class_creation_function,
|
|
185
|
+
owner=class_creation_function,
|
|
186
|
+
variable_name="__class__",
|
|
181
187
|
)
|
|
182
188
|
|
|
183
189
|
class_locals_scope.registerProvidedVariable(class_variable)
|
|
184
190
|
|
|
191
|
+
if python_version >= 0x3C0:
|
|
192
|
+
type_param_nodes = node.type_params
|
|
193
|
+
else:
|
|
194
|
+
type_param_nodes = None
|
|
195
|
+
|
|
196
|
+
if type_param_nodes is not None:
|
|
197
|
+
type_params_expressions = buildNodeTuple(
|
|
198
|
+
provider=provider, nodes=type_param_nodes, source_ref=source_ref
|
|
199
|
+
)
|
|
200
|
+
else:
|
|
201
|
+
type_params_expressions = ()
|
|
202
|
+
|
|
203
|
+
type_variables = []
|
|
204
|
+
|
|
205
|
+
for type_params_expression in type_params_expressions:
|
|
206
|
+
type_variable = class_locals_scope.getLocalVariable(
|
|
207
|
+
owner=class_creation_function,
|
|
208
|
+
variable_name=type_params_expression.name,
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
class_locals_scope.registerProvidedVariable(type_variable)
|
|
212
|
+
|
|
213
|
+
type_variables.append(type_variable)
|
|
214
|
+
|
|
185
215
|
class_variable_ref = ExpressionVariableRef(
|
|
186
216
|
variable=class_variable, source_ref=source_ref
|
|
187
217
|
)
|
|
@@ -238,6 +268,35 @@ def buildClassNode3(provider, node, source_ref):
|
|
|
238
268
|
),
|
|
239
269
|
]
|
|
240
270
|
|
|
271
|
+
for type_variable, type_params_expression in zip(
|
|
272
|
+
type_variables, type_params_expressions
|
|
273
|
+
):
|
|
274
|
+
statements.append(
|
|
275
|
+
makeStatementAssignmentVariable(
|
|
276
|
+
variable=type_variable,
|
|
277
|
+
source=type_params_expression,
|
|
278
|
+
source_ref=source_ref,
|
|
279
|
+
)
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
if type_params_expressions:
|
|
283
|
+
statements.append(
|
|
284
|
+
StatementAssignmentVariableName(
|
|
285
|
+
provider=class_creation_function,
|
|
286
|
+
variable_name="__type_params__",
|
|
287
|
+
source=makeExpressionMakeTuple(
|
|
288
|
+
elements=tuple(
|
|
289
|
+
ExpressionVariableRef(
|
|
290
|
+
variable=type_variable, source_ref=source_ref
|
|
291
|
+
)
|
|
292
|
+
for type_variable in type_variables
|
|
293
|
+
),
|
|
294
|
+
source_ref=source_ref,
|
|
295
|
+
),
|
|
296
|
+
source_ref=source_ref,
|
|
297
|
+
)
|
|
298
|
+
)
|
|
299
|
+
|
|
241
300
|
if class_doc is not None:
|
|
242
301
|
statements.append(
|
|
243
302
|
StatementAssignmentVariableName(
|
|
@@ -250,17 +309,10 @@ def buildClassNode3(provider, node, source_ref):
|
|
|
250
309
|
)
|
|
251
310
|
)
|
|
252
311
|
|
|
253
|
-
# The "__qualname__" attribute
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
qualname_ref = makeConstantRefNode(
|
|
258
|
-
constant=qualname, source_ref=source_ref, user_provided=True
|
|
259
|
-
)
|
|
260
|
-
else:
|
|
261
|
-
qualname_ref = ExpressionFunctionQualnameRef(
|
|
262
|
-
function_body=class_creation_function, source_ref=source_ref
|
|
263
|
-
)
|
|
312
|
+
# The "__qualname__" attribute has a dedicated node.
|
|
313
|
+
qualname_ref = ExpressionFunctionQualnameRef(
|
|
314
|
+
function_body=class_creation_function, source_ref=source_ref
|
|
315
|
+
)
|
|
264
316
|
|
|
265
317
|
statements.append(
|
|
266
318
|
StatementLocalsDictOperationSet(
|
|
@@ -290,7 +342,9 @@ def buildClassNode3(provider, node, source_ref):
|
|
|
290
342
|
|
|
291
343
|
needs_orig_bases = _needsOrigBases(static_qualname)
|
|
292
344
|
|
|
293
|
-
|
|
345
|
+
has_bases = node.bases or type_params_expressions
|
|
346
|
+
|
|
347
|
+
if has_bases:
|
|
294
348
|
tmp_bases = provider.allocateTempVariable(
|
|
295
349
|
temp_scope=temp_scope, name="bases", temp_type="object"
|
|
296
350
|
)
|
|
@@ -310,7 +364,7 @@ def buildClassNode3(provider, node, source_ref):
|
|
|
310
364
|
|
|
311
365
|
needs_orig_bases = False
|
|
312
366
|
|
|
313
|
-
if
|
|
367
|
+
if has_bases and needs_orig_bases:
|
|
314
368
|
statements.append(
|
|
315
369
|
makeStatementConditional(
|
|
316
370
|
condition=makeComparisonExpression(
|
|
@@ -403,13 +457,33 @@ def buildClassNode3(provider, node, source_ref):
|
|
|
403
457
|
|
|
404
458
|
statements = []
|
|
405
459
|
|
|
406
|
-
if
|
|
460
|
+
if has_bases:
|
|
461
|
+
if node.bases:
|
|
462
|
+
bases_value = _buildBasesTupleCreationNode(
|
|
463
|
+
provider=provider, elements=node.bases, source_ref=source_ref
|
|
464
|
+
)
|
|
465
|
+
|
|
466
|
+
if type_params_expressions:
|
|
467
|
+
bases_value = makeBinaryOperationNode(
|
|
468
|
+
operator="Add",
|
|
469
|
+
left=bases_value,
|
|
470
|
+
right=ExpressionTypeMakeGeneric(
|
|
471
|
+
type_params=ExpressionVariableNameRef(
|
|
472
|
+
provider=class_creation_function,
|
|
473
|
+
variable_name="__type_params__",
|
|
474
|
+
source_ref=source_ref,
|
|
475
|
+
),
|
|
476
|
+
source_ref=source_ref,
|
|
477
|
+
),
|
|
478
|
+
source_ref=source_ref,
|
|
479
|
+
)
|
|
480
|
+
else:
|
|
481
|
+
assert False
|
|
482
|
+
|
|
407
483
|
statements.append(
|
|
408
484
|
makeStatementAssignmentVariable(
|
|
409
485
|
variable=tmp_bases_orig if needs_orig_bases else tmp_bases,
|
|
410
|
-
source=
|
|
411
|
-
provider=provider, elements=node.bases, source_ref=source_ref
|
|
412
|
-
),
|
|
486
|
+
source=bases_value,
|
|
413
487
|
source_ref=source_ref,
|
|
414
488
|
)
|
|
415
489
|
)
|
|
@@ -882,6 +956,7 @@ subclass of the metaclasses of all its bases""",
|
|
|
882
956
|
source_ref=internal_source_ref,
|
|
883
957
|
),
|
|
884
958
|
),
|
|
959
|
+
for_raise=False,
|
|
885
960
|
source_ref=internal_source_ref,
|
|
886
961
|
),
|
|
887
962
|
exception_value=None,
|
|
@@ -618,7 +618,7 @@ def buildParameterAnnotations(provider, node, source_ref):
|
|
|
618
618
|
for arg in node.args.kwonlyargs:
|
|
619
619
|
extractArgAnnotation(arg)
|
|
620
620
|
|
|
621
|
-
if python_version <
|
|
621
|
+
if python_version < 0x300:
|
|
622
622
|
if node.args.varargannotation is not None:
|
|
623
623
|
addAnnotation(
|
|
624
624
|
key=node.args.vararg,
|
|
@@ -393,7 +393,7 @@ def _buildMatchClass(provider, pattern, make_against, source_ref):
|
|
|
393
393
|
source_ref=source_ref,
|
|
394
394
|
)
|
|
395
395
|
|
|
396
|
-
item_conditions = item_conditions or
|
|
396
|
+
item_conditions = list(item_conditions or ())
|
|
397
397
|
|
|
398
398
|
item_conditions.insert(
|
|
399
399
|
0,
|
|
@@ -404,6 +404,8 @@ def _buildMatchClass(provider, pattern, make_against, source_ref):
|
|
|
404
404
|
),
|
|
405
405
|
)
|
|
406
406
|
|
|
407
|
+
item_conditions = tuple(item_conditions)
|
|
408
|
+
|
|
407
409
|
class_conditions_list.append(item_conditions)
|
|
408
410
|
class_assignments_list.append(item_assignments)
|
|
409
411
|
|
|
@@ -23,17 +23,35 @@ from .SyntaxErrors import raiseSyntaxError
|
|
|
23
23
|
from .TreeHelpers import buildNode
|
|
24
24
|
|
|
25
25
|
|
|
26
|
+
def _getErrorMessageYieldFromOutsideFunction():
|
|
27
|
+
# Need to use "exec" to detect the syntax error, pylint: disable=W0122
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
exec("""yield from ()""")
|
|
31
|
+
except SyntaxError as e:
|
|
32
|
+
if "yield from" in str(e):
|
|
33
|
+
return "yield from"
|
|
34
|
+
else:
|
|
35
|
+
return "yield"
|
|
36
|
+
|
|
37
|
+
|
|
26
38
|
def _checkInsideGenerator(construct_name, provider, node, source_ref):
|
|
39
|
+
|
|
27
40
|
if provider.isCompiledPythonModule():
|
|
41
|
+
# Bug compatibility
|
|
42
|
+
if construct_name == "yield from":
|
|
43
|
+
construct_error_name = _getErrorMessageYieldFromOutsideFunction()
|
|
44
|
+
else:
|
|
45
|
+
construct_error_name = construct_name
|
|
46
|
+
|
|
28
47
|
raiseSyntaxError(
|
|
29
|
-
"'%s' outside function"
|
|
30
|
-
% (construct_name if construct_name == "await" else "yield"),
|
|
48
|
+
"'%s' outside function" % construct_error_name,
|
|
31
49
|
source_ref.atColumnNumber(node.col_offset),
|
|
32
50
|
)
|
|
33
51
|
|
|
34
|
-
# This yield is forbidden in 3.5, but allowed in 3.6, but
|
|
52
|
+
# This yield is forbidden in 3.5, but allowed in 3.6, but "yield from"
|
|
35
53
|
# is neither.
|
|
36
|
-
if provider.isExpressionAsyncgenObjectBody() and construct_name == "
|
|
54
|
+
if provider.isExpressionAsyncgenObjectBody() and construct_name == "yield from":
|
|
37
55
|
raiseSyntaxError(
|
|
38
56
|
"'%s' inside async function"
|
|
39
57
|
% ("yield" if node.__class__ is ast.Yield else "yield from",),
|
|
@@ -80,7 +98,7 @@ def buildYieldNode(provider, node, source_ref):
|
|
|
80
98
|
def buildYieldFromNode(provider, node, source_ref):
|
|
81
99
|
assert python_version >= 0x300
|
|
82
100
|
|
|
83
|
-
_checkInsideGenerator("
|
|
101
|
+
_checkInsideGenerator("yield from", provider, node, source_ref)
|
|
84
102
|
|
|
85
103
|
return ExpressionYieldFrom(
|
|
86
104
|
expression=buildNode(provider, node.value, source_ref), source_ref=source_ref
|
|
@@ -12,21 +12,44 @@ from optparse import (
|
|
|
12
12
|
OptionParser,
|
|
13
13
|
)
|
|
14
14
|
|
|
15
|
+
from nuitka.Tracing import formatTerminalLink
|
|
16
|
+
|
|
15
17
|
# For re-export only:
|
|
16
18
|
from optparse import SUPPRESS_HELP # isort:skip pylint: disable=unused-import
|
|
17
19
|
|
|
18
20
|
|
|
19
21
|
class OurOptionGroup(OptionGroup):
|
|
22
|
+
def __init__(self, *args, **kwargs):
|
|
23
|
+
link = kwargs.pop("link", None)
|
|
24
|
+
|
|
25
|
+
OptionGroup.__init__(self, *args, **kwargs)
|
|
26
|
+
|
|
27
|
+
self.link = link
|
|
28
|
+
|
|
29
|
+
def format_help(self, formatter):
|
|
30
|
+
old_title = self.title
|
|
31
|
+
|
|
32
|
+
try:
|
|
33
|
+
if self.link is not None:
|
|
34
|
+
link = "https://nuitka.net/help/%s.html" % self.link
|
|
35
|
+
|
|
36
|
+
self.title = formatTerminalLink(self.title, link)
|
|
37
|
+
return OptionGroup.format_help(self, formatter)
|
|
38
|
+
finally:
|
|
39
|
+
self.title = old_title
|
|
40
|
+
|
|
20
41
|
def add_option(self, *args, **kwargs):
|
|
21
42
|
require_compiling = kwargs.pop("require_compiling", True)
|
|
22
43
|
github_action = kwargs.pop("github_action", True)
|
|
23
44
|
github_action_default = kwargs.pop("github_action_default", None)
|
|
45
|
+
link = kwargs.pop("github_action_default", None)
|
|
24
46
|
|
|
25
47
|
result = OptionGroup.add_option(self, *args, **kwargs)
|
|
26
48
|
|
|
27
49
|
result.require_compiling = require_compiling
|
|
28
50
|
result.github_action = github_action
|
|
29
51
|
result.github_action_default = github_action_default
|
|
52
|
+
result.link = link
|
|
30
53
|
|
|
31
54
|
return result
|
|
32
55
|
|
|
@@ -99,11 +122,11 @@ class OurOptionParser(OptionParser):
|
|
|
99
122
|
|
|
100
123
|
return result
|
|
101
124
|
|
|
102
|
-
def add_option_group(self, group):
|
|
125
|
+
def add_option_group(self, group, link=None):
|
|
103
126
|
# We restrain ourselves here, pylint: disable=arguments-differ
|
|
104
127
|
|
|
105
128
|
if isinstance(group, str):
|
|
106
|
-
group = OurOptionGroup(self, group)
|
|
129
|
+
group = OurOptionGroup(self, group, link=link)
|
|
107
130
|
self.option_groups.append(group)
|
|
108
131
|
|
|
109
132
|
return group
|
|
@@ -152,7 +175,8 @@ class OurHelpFormatter(IndentedHelpFormatter):
|
|
|
152
175
|
if option.takes_value():
|
|
153
176
|
metavar = option.metavar or option.dest.upper()
|
|
154
177
|
long_opts = [
|
|
155
|
-
self._long_opt_fmt % (
|
|
178
|
+
self._long_opt_fmt % (long_opt, metavar)
|
|
179
|
+
for long_opt in option._long_opts
|
|
156
180
|
]
|
|
157
181
|
else:
|
|
158
182
|
long_opts = option._long_opts
|
nuitka/utils/Download.py
CHANGED
|
@@ -167,10 +167,10 @@ def getCachedDownloadedMinGW64(target_arch, assume_yes_for_downloads):
|
|
|
167
167
|
# Large URLs, pylint: disable=line-too-long
|
|
168
168
|
|
|
169
169
|
if target_arch == "x86_64":
|
|
170
|
-
url = "https://github.com/brechtsanders/winlibs_mingw/releases/download/
|
|
170
|
+
url = "https://github.com/brechtsanders/winlibs_mingw/releases/download/14.2.0posix-19.1.1-12.0.0-msvcrt-r2/winlibs-x86_64-posix-seh-gcc-14.2.0-llvm-19.1.1-mingw-w64msvcrt-12.0.0-r2.zip"
|
|
171
171
|
binary = r"mingw64\bin\gcc.exe"
|
|
172
172
|
elif target_arch == "x86":
|
|
173
|
-
url = "https://github.com/brechtsanders/winlibs_mingw/releases/download/
|
|
173
|
+
url = "https://github.com/brechtsanders/winlibs_mingw/releases/download/14.2.0posix-19.1.1-12.0.0-msvcrt-r2/winlibs-i686-posix-dwarf-gcc-14.2.0-llvm-19.1.1-mingw-w64msvcrt-12.0.0-r2.zip"
|
|
174
174
|
binary = r"mingw32\bin\gcc.exe"
|
|
175
175
|
elif target_arch == "arm64":
|
|
176
176
|
return None
|
nuitka/utils/Execution.py
CHANGED
|
@@ -328,21 +328,24 @@ def wrapCommandForDebuggerForSubprocess(*args):
|
|
|
328
328
|
return args
|
|
329
329
|
|
|
330
330
|
|
|
331
|
+
@contextmanager
|
|
331
332
|
def getNullOutput():
|
|
333
|
+
r = open(os.devnull, "wb")
|
|
334
|
+
|
|
332
335
|
try:
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
+
yield r
|
|
337
|
+
finally:
|
|
338
|
+
r.close()
|
|
336
339
|
|
|
337
340
|
|
|
341
|
+
@contextmanager
|
|
338
342
|
def getNullInput():
|
|
339
|
-
|
|
343
|
+
r = open(os.devnull, "rb")
|
|
344
|
+
|
|
340
345
|
try:
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
subprocess.NULLDEV = open(os.devnull, "rb")
|
|
345
|
-
return subprocess.NULLDEV
|
|
346
|
+
yield r
|
|
347
|
+
finally:
|
|
348
|
+
r.close()
|
|
346
349
|
|
|
347
350
|
|
|
348
351
|
def executeToolChecked(
|
|
@@ -364,13 +367,14 @@ def executeToolChecked(
|
|
|
364
367
|
command[0] = getExecutablePath(tool)
|
|
365
368
|
|
|
366
369
|
with withEnvironmentVarOverridden("LC_ALL", "C"):
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
370
|
+
with getNullInput() as null_input:
|
|
371
|
+
process = subprocess.Popen(
|
|
372
|
+
command,
|
|
373
|
+
stdin=null_input,
|
|
374
|
+
stdout=subprocess.PIPE,
|
|
375
|
+
stderr=subprocess.PIPE,
|
|
376
|
+
shell=False,
|
|
377
|
+
)
|
|
374
378
|
|
|
375
379
|
stdout, stderr = process.communicate()
|
|
376
380
|
result = process.poll()
|
|
@@ -413,21 +417,22 @@ def createProcess(
|
|
|
413
417
|
else:
|
|
414
418
|
kw_args["preexec_fn"] = os.setsid
|
|
415
419
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
420
|
+
with getNullInput() as null_input:
|
|
421
|
+
process = subprocess.Popen(
|
|
422
|
+
command,
|
|
423
|
+
# Note: Empty string should also be allowed for stdin, therefore check
|
|
424
|
+
# for default "False" and "None" precisely.
|
|
425
|
+
stdin=subprocess.PIPE if stdin not in (False, None) else null_input,
|
|
426
|
+
stdout=subprocess.PIPE if stdout is None else stdout,
|
|
427
|
+
stderr=subprocess.PIPE if stderr is None else stderr,
|
|
428
|
+
shell=shell,
|
|
429
|
+
# On Windows, closing file descriptions is not working with capturing outputs.
|
|
430
|
+
close_fds=not isWin32Windows(),
|
|
431
|
+
env=env,
|
|
432
|
+
# For tools that want short paths to work.
|
|
433
|
+
cwd=getExternalUsePath(os.getcwd()) if external_cwd else None,
|
|
434
|
+
**kw_args
|
|
435
|
+
)
|
|
431
436
|
|
|
432
437
|
return process
|
|
433
438
|
|
nuitka/utils/FileOperations.py
CHANGED
|
@@ -28,17 +28,10 @@ from nuitka.__past__ import ( # pylint: disable=redefined-builtin
|
|
|
28
28
|
FileNotFoundError,
|
|
29
29
|
PermissionError,
|
|
30
30
|
basestring,
|
|
31
|
-
raw_input,
|
|
32
31
|
unicode,
|
|
33
32
|
)
|
|
34
33
|
from nuitka.PythonVersions import python_version
|
|
35
|
-
from nuitka.Tracing import
|
|
36
|
-
flushStandardOutputs,
|
|
37
|
-
general,
|
|
38
|
-
my_print,
|
|
39
|
-
options_logger,
|
|
40
|
-
printLine,
|
|
41
|
-
)
|
|
34
|
+
from nuitka.Tracing import general, my_print, options_logger, queryUser
|
|
42
35
|
|
|
43
36
|
from .Importing import importFromInlineCopy
|
|
44
37
|
from .ThreadedExecutor import RLock, getThreadIdent
|
|
@@ -447,7 +440,7 @@ def getFileList(
|
|
|
447
440
|
fullname = os.path.join(root, filename)
|
|
448
441
|
|
|
449
442
|
if normalize:
|
|
450
|
-
fullname =
|
|
443
|
+
fullname = getNormalizedPath(fullname)
|
|
451
444
|
|
|
452
445
|
result.append(fullname)
|
|
453
446
|
|
|
@@ -834,7 +827,7 @@ def getFileFirstLine(filename, mode="r", encoding=None):
|
|
|
834
827
|
|
|
835
828
|
|
|
836
829
|
def openTextFile(filename, mode, encoding=None, errors=None):
|
|
837
|
-
if python_version >=
|
|
830
|
+
if python_version >= 0x370:
|
|
838
831
|
mode = mode.replace("U", "")
|
|
839
832
|
|
|
840
833
|
return codecs.open(filename, mode, encoding=encoding, errors=errors)
|
|
@@ -897,7 +890,7 @@ def changeTextFileContents(filename, contents, encoding=None, compare_only=False
|
|
|
897
890
|
or getFileContents(filename, encoding=encoding) != contents
|
|
898
891
|
):
|
|
899
892
|
if not compare_only:
|
|
900
|
-
putTextFileContents(filename, contents)
|
|
893
|
+
putTextFileContents(filename, contents, encoding=encoding)
|
|
901
894
|
|
|
902
895
|
return True
|
|
903
896
|
else:
|
|
@@ -1024,33 +1017,6 @@ def copyFileWithPermissions(source_path, dest_path, dist_dir):
|
|
|
1024
1017
|
os.chmod(dest_path, source_mode)
|
|
1025
1018
|
|
|
1026
1019
|
|
|
1027
|
-
def queryUser(question, choices, default, default_non_interactive):
|
|
1028
|
-
assert default in choices, (default, choices)
|
|
1029
|
-
assert default_non_interactive in choices, (default, choices)
|
|
1030
|
-
|
|
1031
|
-
prompt = "%s? %s : " % (
|
|
1032
|
-
question,
|
|
1033
|
-
"/".join(
|
|
1034
|
-
"[%s]" % choice.title() if choice == default else choice.title()
|
|
1035
|
-
for choice in choices
|
|
1036
|
-
),
|
|
1037
|
-
)
|
|
1038
|
-
|
|
1039
|
-
# Integrates with progress bar by closing it.
|
|
1040
|
-
printLine(prompt, end="")
|
|
1041
|
-
flushStandardOutputs()
|
|
1042
|
-
|
|
1043
|
-
try:
|
|
1044
|
-
reply = raw_input() or default
|
|
1045
|
-
except EOFError:
|
|
1046
|
-
reply = default_non_interactive
|
|
1047
|
-
|
|
1048
|
-
if reply == "y":
|
|
1049
|
-
reply = "yes"
|
|
1050
|
-
|
|
1051
|
-
return reply.lower()
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
1020
|
def copyFile(source_path, dest_path):
|
|
1055
1021
|
"""Improved version of shutil.copy
|
|
1056
1022
|
|
|
@@ -1202,7 +1168,7 @@ def getWindowsLongPathName(filename):
|
|
|
1202
1168
|
while True:
|
|
1203
1169
|
output_buf = ctypes.create_unicode_buffer(output_buf_size)
|
|
1204
1170
|
needed = GetLongPathNameW(
|
|
1205
|
-
os.path.abspath(filename), output_buf, output_buf_size
|
|
1171
|
+
getNormalizedPath(os.path.abspath(filename)), output_buf, output_buf_size
|
|
1206
1172
|
)
|
|
1207
1173
|
|
|
1208
1174
|
if needed == 0:
|
|
@@ -1472,6 +1438,16 @@ def isFilesystemEncodable(filename):
|
|
|
1472
1438
|
return True
|
|
1473
1439
|
|
|
1474
1440
|
|
|
1441
|
+
def makeFilesystemEncodable(filename):
|
|
1442
|
+
if not os.path.isabs(filename):
|
|
1443
|
+
filename = os.path.abspath(filename)
|
|
1444
|
+
|
|
1445
|
+
if not isFilesystemEncodable(filename):
|
|
1446
|
+
filename = getExternalUsePath(filename)
|
|
1447
|
+
|
|
1448
|
+
return filename
|
|
1449
|
+
|
|
1450
|
+
|
|
1475
1451
|
def openPickleFile(filename, mode, protocol=-1):
|
|
1476
1452
|
file_handle = openTextFile(filename, mode)
|
|
1477
1453
|
|
|
@@ -1539,6 +1515,9 @@ def getNormalizedPath(path):
|
|
|
1539
1515
|
if isWin32Windows():
|
|
1540
1516
|
path = path.replace("/", "\\")
|
|
1541
1517
|
|
|
1518
|
+
if isMacOS():
|
|
1519
|
+
path = os.path.expanduser(path)
|
|
1520
|
+
|
|
1542
1521
|
return path
|
|
1543
1522
|
|
|
1544
1523
|
|
nuitka/utils/Hashing.py
CHANGED
|
@@ -7,6 +7,7 @@ Offers support for hashing incrementally and files esp. without having
|
|
|
7
7
|
to read their contents.
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
|
+
import struct
|
|
10
11
|
from binascii import crc32
|
|
11
12
|
|
|
12
13
|
from nuitka.__past__ import md5, unicode
|
|
@@ -111,10 +112,13 @@ class HashCRC32(HashBase):
|
|
|
111
112
|
self.hash = crc32(value, self.hash)
|
|
112
113
|
|
|
113
114
|
def asDigest(self):
|
|
115
|
+
if self.hash < 0:
|
|
116
|
+
return struct.unpack("I", struct.pack("i", self.hash))[0]
|
|
117
|
+
|
|
114
118
|
return self.hash
|
|
115
119
|
|
|
116
120
|
def asHexDigest(self):
|
|
117
|
-
return hex(self.
|
|
121
|
+
return hex(self.asDigest())[2:]
|
|
118
122
|
|
|
119
123
|
|
|
120
124
|
# Part of "Nuitka", an optimizing Python compiler that is compatible and
|