Nuitka-winsvc 2.3.11__cp311-cp311-win_amd64.whl → 2.4.5__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.11.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.5.data/scripts/nuitka-run.cmd +1 -1
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/RECORD +213 -210
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/WHEEL +1 -1
- nuitka/CacheCleanup.py +6 -1
- nuitka/HardImportRegistry.py +30 -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/Progress.py +2 -1
- nuitka/PythonFlavors.py +22 -4
- nuitka/PythonVersions.py +18 -0
- nuitka/Tracing.py +1 -0
- nuitka/TreeXML.py +6 -3
- nuitka/Version.py +1 -1
- nuitka/__main__.py +55 -10
- nuitka/__past__.py +5 -0
- nuitka/build/Backend.scons +6 -1
- nuitka/build/CCompilerVersion.scons +1 -0
- nuitka/build/Onefile.scons +4 -0
- nuitka/build/SconsCaching.py +2 -1
- nuitka/build/SconsCompilerSettings.py +1 -0
- nuitka/build/SconsHacks.py +5 -1
- nuitka/build/SconsInterface.py +2 -0
- nuitka/build/SconsUtils.py +4 -1
- 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 +10 -3
- nuitka/build/include/nuitka/prelude.h +6 -15
- nuitka/build/include/nuitka/printing.h +2 -0
- nuitka/build/include/nuitka/unfreezing.h +11 -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 +49 -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 +16 -7
- 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/HelpersFilesystemPaths.c +28 -13
- 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/InspectPatcher.c +14 -2
- nuitka/build/static_src/MainProgram.c +20 -1
- nuitka/build/static_src/MetaPathBasedLoader.c +163 -140
- nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +13 -4
- nuitka/build/static_src/OnefileBootstrap.c +100 -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/Emission.py +1 -1
- nuitka/code_generation/GlobalConstants.py +6 -6
- nuitka/code_generation/Indentation.py +4 -5
- 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 +1 -8
- nuitka/code_generation/Namify.py +2 -0
- nuitka/code_generation/PackageResourceCodes.py +5 -1
- nuitka/code_generation/templates/CodeTemplatesConstants.py +22 -4
- nuitka/code_generation/templates/CodeTemplatesLoader.py +1 -1
- nuitka/code_generation/templates/CodeTemplatesModules.py +27 -9
- 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 +5 -12
- nuitka/freezer/IncludedDataFiles.py +15 -4
- 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 +7 -11
- 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 +3 -2
- 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/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 +92 -4
- 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 +489 -182
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +6 -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 +8 -0
- 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 +21 -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 +13 -2
- 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 +32 -8
- 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.11.data/scripts/nuitka.bat → /Nuitka_winsvc-2.4.5.data/scripts/nuitka.cmd +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/top_level.txt +0 -0
|
@@ -299,15 +299,6 @@ Do not use Python2.6 even if available on the system. Default is %default.""",
|
|
|
299
299
|
Do not use Python2.7 even if available on the system. Default is %default.""",
|
|
300
300
|
)
|
|
301
301
|
|
|
302
|
-
parser.add_option(
|
|
303
|
-
"--no-python3.3",
|
|
304
|
-
action="store_true",
|
|
305
|
-
dest="no33",
|
|
306
|
-
default=False,
|
|
307
|
-
help="""\
|
|
308
|
-
Do not use Python3.3 even if available on the system. Default is %default.""",
|
|
309
|
-
)
|
|
310
|
-
|
|
311
302
|
parser.add_option(
|
|
312
303
|
"--no-python3.4",
|
|
313
304
|
action="store_true",
|
|
@@ -437,8 +428,6 @@ Enforce the use of MinGW64 on Windows. Defaults to off.""",
|
|
|
437
428
|
options.no26 = True
|
|
438
429
|
if sys.version_info[0:2] != (2, 7):
|
|
439
430
|
options.no27 = True
|
|
440
|
-
if sys.version_info[0:2] != (3, 3):
|
|
441
|
-
options.no33 = True
|
|
442
431
|
if sys.version_info[0:2] != (3, 4):
|
|
443
432
|
options.no34 = True
|
|
444
433
|
if sys.version_info[0:2] != (3, 5):
|
|
@@ -586,8 +575,6 @@ def main():
|
|
|
586
575
|
return False
|
|
587
576
|
if command == "python2.7" and options.no27:
|
|
588
577
|
return False
|
|
589
|
-
if command == "python3.3" and options.no33:
|
|
590
|
-
return False
|
|
591
578
|
if command == "python3.4" and options.no34:
|
|
592
579
|
return False
|
|
593
580
|
if command == "python3.5" and options.no35:
|
|
@@ -613,8 +600,6 @@ def main():
|
|
|
613
600
|
return True
|
|
614
601
|
if command == "python2.7" and sys.version_info[0:2] == (2, 7):
|
|
615
602
|
return True
|
|
616
|
-
if command == "python3.3" and sys.version_info[0:2] == (3, 3):
|
|
617
|
-
return True
|
|
618
603
|
if command == "python3.4" and sys.version_info[0:2] == (3, 4):
|
|
619
604
|
return True
|
|
620
605
|
if command == "python3.5" and sys.version_info[0:2] == (3, 5):
|
|
@@ -975,11 +960,6 @@ def main():
|
|
|
975
960
|
else:
|
|
976
961
|
my_print("Cannot execute tests with Python 2.7, disabled or not installed.")
|
|
977
962
|
|
|
978
|
-
if checkExecutableCommand("python3.3"):
|
|
979
|
-
execute_tests("python3.3-nodebug", "python3.3", "")
|
|
980
|
-
else:
|
|
981
|
-
my_print("Cannot execute tests with Python 3.3, disabled or not installed.")
|
|
982
|
-
|
|
983
963
|
if checkExecutableCommand("python3.4"):
|
|
984
964
|
execute_tests("python3.4-nodebug", "python3.4", "")
|
|
985
965
|
else:
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
""" Stage changes in Nuitka-Watch automatically
|
|
5
|
+
|
|
6
|
+
This aims at recognizing unimportant changes automatically and is used
|
|
7
|
+
for larger report format migrations in the future potentially.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from optparse import OptionParser
|
|
11
|
+
|
|
12
|
+
from nuitka.tools.quality.Git import (
|
|
13
|
+
getCheckoutFileChangeDesc,
|
|
14
|
+
getFileHashContent,
|
|
15
|
+
putFileHashContent,
|
|
16
|
+
updateGitFile,
|
|
17
|
+
)
|
|
18
|
+
from nuitka.TreeXML import fromString, toString
|
|
19
|
+
from nuitka.utils.FileOperations import getFileContents, withTemporaryFile
|
|
20
|
+
|
|
21
|
+
options = None
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def findMatchingNode(root, search_node):
|
|
25
|
+
"""Find a node matching the given one in a XML root."""
|
|
26
|
+
nodes = []
|
|
27
|
+
|
|
28
|
+
node = search_node
|
|
29
|
+
while node is not None:
|
|
30
|
+
nodes.insert(0, node)
|
|
31
|
+
|
|
32
|
+
node = node.getparent()
|
|
33
|
+
|
|
34
|
+
# Root is easy and hard coded.
|
|
35
|
+
current = root
|
|
36
|
+
del nodes[0]
|
|
37
|
+
|
|
38
|
+
for node in nodes:
|
|
39
|
+
node_tag = node.tag
|
|
40
|
+
|
|
41
|
+
if node_tag == "module":
|
|
42
|
+
attrib_name = "name"
|
|
43
|
+
elif node_tag == "optimization-time":
|
|
44
|
+
attrib_name = "pass"
|
|
45
|
+
else:
|
|
46
|
+
assert False, (node, current)
|
|
47
|
+
|
|
48
|
+
attrib_value = node.attrib[attrib_name]
|
|
49
|
+
|
|
50
|
+
for candidate in current.findall(node_tag):
|
|
51
|
+
try:
|
|
52
|
+
candidate_value = candidate.attrib[attrib_name]
|
|
53
|
+
except KeyError:
|
|
54
|
+
assert False, current
|
|
55
|
+
|
|
56
|
+
if candidate_value == attrib_value:
|
|
57
|
+
current = candidate
|
|
58
|
+
break
|
|
59
|
+
else:
|
|
60
|
+
return None
|
|
61
|
+
|
|
62
|
+
return current
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def onCompilationReportChange(filename, git_stage):
|
|
66
|
+
print("Working on", filename)
|
|
67
|
+
|
|
68
|
+
new_report = fromString(getFileContents(filename, mode="rb"), use_lxml=True)
|
|
69
|
+
old_git_contents = getFileHashContent(git_stage["src_hash"])
|
|
70
|
+
|
|
71
|
+
old_report = fromString(old_git_contents, use_lxml=True)
|
|
72
|
+
|
|
73
|
+
new_nuitka_version = new_report.attrib["nuitka_version"]
|
|
74
|
+
changed = False
|
|
75
|
+
if old_report.attrib["nuitka_version"] != new_nuitka_version:
|
|
76
|
+
old_report.attrib["nuitka_version"] = new_nuitka_version
|
|
77
|
+
|
|
78
|
+
changed = True
|
|
79
|
+
|
|
80
|
+
if options.accept_optimization_time:
|
|
81
|
+
for new_node in new_report.xpath("//module/optimization-time"):
|
|
82
|
+
old_node = findMatchingNode(old_report, new_node)
|
|
83
|
+
|
|
84
|
+
if old_node is not None:
|
|
85
|
+
old_node.getparent().replace(old_node, new_node)
|
|
86
|
+
|
|
87
|
+
if changed:
|
|
88
|
+
new_git_contents = toString(old_report)
|
|
89
|
+
with withTemporaryFile(mode="w", delete=False) as output_file:
|
|
90
|
+
tmp_filename = output_file.name
|
|
91
|
+
output_file.write(new_git_contents)
|
|
92
|
+
output_file.close()
|
|
93
|
+
|
|
94
|
+
new_hash_value = putFileHashContent(tmp_filename)
|
|
95
|
+
|
|
96
|
+
if git_stage["src_hash"] != new_hash_value:
|
|
97
|
+
updateGitFile(filename, git_stage["src_hash"], new_hash_value, staged=False)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def onFileChange(git_stage):
|
|
101
|
+
filename = git_stage["src_path"]
|
|
102
|
+
|
|
103
|
+
if filename.endswith("compilation-report.xml"):
|
|
104
|
+
onCompilationReportChange(filename=filename, git_stage=git_stage)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def main():
|
|
108
|
+
# Cheating in this singleton and not passing options,
|
|
109
|
+
# pylint: disable=global-statement
|
|
110
|
+
global options
|
|
111
|
+
|
|
112
|
+
parser = OptionParser()
|
|
113
|
+
|
|
114
|
+
parser.add_option(
|
|
115
|
+
"--accept-optimization-time",
|
|
116
|
+
action="store_true",
|
|
117
|
+
dest="accept_optimization_time",
|
|
118
|
+
default=False,
|
|
119
|
+
help="""Accept module optimization-time changes.""",
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
options, _positional_args = parser.parse_args()
|
|
123
|
+
|
|
124
|
+
for git_stage in getCheckoutFileChangeDesc(staged=False):
|
|
125
|
+
onFileChange(git_stage=git_stage)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
if __name__ == "__main__":
|
|
129
|
+
main()
|
|
130
|
+
|
|
131
|
+
# Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
132
|
+
# integrates with CPython, but also works on its own.
|
|
133
|
+
#
|
|
134
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
135
|
+
# you may not use this file except in compliance with the License.
|
|
136
|
+
# You may obtain a copy of the License at
|
|
137
|
+
#
|
|
138
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
139
|
+
#
|
|
140
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
141
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
142
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
143
|
+
# See the License for the specific language governing permissions and
|
|
144
|
+
# limitations under the License.
|
nuitka/tools/watch/__main__.py
CHANGED
|
@@ -8,6 +8,7 @@ of Nuitka changes on PyPI packages.
|
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
import os
|
|
11
|
+
import subprocess
|
|
11
12
|
import sys
|
|
12
13
|
from optparse import OptionParser
|
|
13
14
|
|
|
@@ -25,10 +26,12 @@ from nuitka.utils.Execution import (
|
|
|
25
26
|
)
|
|
26
27
|
from nuitka.utils.FileOperations import (
|
|
27
28
|
changeTextFileContents,
|
|
29
|
+
deleteFile,
|
|
28
30
|
getFileContents,
|
|
29
31
|
getFileList,
|
|
30
32
|
listDir,
|
|
31
33
|
makePath,
|
|
34
|
+
putTextFileContents,
|
|
32
35
|
relpath,
|
|
33
36
|
withDirectoryChange,
|
|
34
37
|
)
|
|
@@ -219,6 +222,28 @@ def _updatePacmanFile(installed_python, case_data, dry_run, result_path):
|
|
|
219
222
|
return changed_pipenv_file, pipenv_filename
|
|
220
223
|
|
|
221
224
|
|
|
225
|
+
def _execPipenvCommand(installed_python, command, retry=False):
|
|
226
|
+
try:
|
|
227
|
+
check_call(
|
|
228
|
+
[
|
|
229
|
+
installed_python.getPythonExe(),
|
|
230
|
+
"-m",
|
|
231
|
+
"pipenv",
|
|
232
|
+
command,
|
|
233
|
+
"--python",
|
|
234
|
+
installed_python.getPythonExe(),
|
|
235
|
+
],
|
|
236
|
+
logger=watch_logger,
|
|
237
|
+
)
|
|
238
|
+
except subprocess.CalledProcessError:
|
|
239
|
+
if command in ("install", "update") and not retry:
|
|
240
|
+
_execPipenvCommand(installed_python, "--rm")
|
|
241
|
+
_execPipenvCommand(installed_python, command)
|
|
242
|
+
|
|
243
|
+
else:
|
|
244
|
+
raise
|
|
245
|
+
|
|
246
|
+
|
|
222
247
|
def _updatePipenvLockFile(
|
|
223
248
|
installed_python, dry_run, pipenv_filename_full, no_pipenv_update
|
|
224
249
|
):
|
|
@@ -229,16 +254,7 @@ def _updatePipenvLockFile(
|
|
|
229
254
|
% pipenv_filename_full
|
|
230
255
|
)
|
|
231
256
|
|
|
232
|
-
|
|
233
|
-
[
|
|
234
|
-
installed_python.getPythonExe(),
|
|
235
|
-
"-m",
|
|
236
|
-
"pipenv",
|
|
237
|
-
"install",
|
|
238
|
-
"--python",
|
|
239
|
-
installed_python.getPythonExe(),
|
|
240
|
-
]
|
|
241
|
-
)
|
|
257
|
+
_execPipenvCommand(installed_python, "install")
|
|
242
258
|
|
|
243
259
|
elif not dry_run:
|
|
244
260
|
watch_logger.info(
|
|
@@ -246,16 +262,7 @@ def _updatePipenvLockFile(
|
|
|
246
262
|
% pipenv_filename_full
|
|
247
263
|
)
|
|
248
264
|
|
|
249
|
-
|
|
250
|
-
[
|
|
251
|
-
installed_python.getPythonExe(),
|
|
252
|
-
"-m",
|
|
253
|
-
"pipenv",
|
|
254
|
-
"update",
|
|
255
|
-
"--python",
|
|
256
|
-
installed_python.getPythonExe(),
|
|
257
|
-
]
|
|
258
|
-
)
|
|
265
|
+
_execPipenvCommand(installed_python, "update")
|
|
259
266
|
else:
|
|
260
267
|
watch_logger.info(
|
|
261
268
|
"Working with pipenv file '%s' to install virtualenv, may take a while."
|
|
@@ -293,9 +300,11 @@ def _updatePacmanLockFile():
|
|
|
293
300
|
return pacman_lock_filename
|
|
294
301
|
|
|
295
302
|
|
|
296
|
-
def _compileCase(case_data, case_dir, installed_python, lock_filename):
|
|
303
|
+
def _compileCase(case_data, case_dir, installed_python, lock_filename, jobs):
|
|
297
304
|
preferred_package_type = installed_python.getPreferredPackageType()
|
|
298
305
|
|
|
306
|
+
extra_options = []
|
|
307
|
+
|
|
299
308
|
if preferred_package_type == "pip":
|
|
300
309
|
run_command = [
|
|
301
310
|
installed_python.getPythonExe(),
|
|
@@ -306,15 +315,16 @@ def _compileCase(case_data, case_dir, installed_python, lock_filename):
|
|
|
306
315
|
installed_python.getPythonExe(),
|
|
307
316
|
"python",
|
|
308
317
|
]
|
|
309
|
-
extra_options = []
|
|
310
318
|
elif preferred_package_type == "pacman":
|
|
311
319
|
run_command = ["python"]
|
|
312
320
|
|
|
313
|
-
|
|
314
|
-
extra_options = ["--disable-ccache"]
|
|
321
|
+
extra_options.append("--disable-ccache")
|
|
315
322
|
else:
|
|
316
323
|
assert False
|
|
317
324
|
|
|
325
|
+
if jobs is not None:
|
|
326
|
+
extra_options.append("--jobs=%s" % jobs)
|
|
327
|
+
|
|
318
328
|
check_call(
|
|
319
329
|
run_command
|
|
320
330
|
+ [
|
|
@@ -347,6 +357,14 @@ def _compileCase(case_data, case_dir, installed_python, lock_filename):
|
|
|
347
357
|
with open("compiled-stderr.txt", "wb") as output:
|
|
348
358
|
output.write(stderr)
|
|
349
359
|
|
|
360
|
+
if exit_nuitka == 0:
|
|
361
|
+
deleteFile("compiled-exit.txt", must_exist=False)
|
|
362
|
+
else:
|
|
363
|
+
putTextFileContents(
|
|
364
|
+
filename="compiled-exit.txt",
|
|
365
|
+
contents=str(exit_nuitka),
|
|
366
|
+
)
|
|
367
|
+
|
|
350
368
|
if exit_nuitka != 0:
|
|
351
369
|
sys.exit(
|
|
352
370
|
"Error, failed to execute %s with code %d." % (binaries[0], exit_nuitka)
|
|
@@ -361,6 +379,7 @@ def _updateCase(
|
|
|
361
379
|
nuitka_update_mode,
|
|
362
380
|
installed_python,
|
|
363
381
|
result_path,
|
|
382
|
+
jobs,
|
|
364
383
|
):
|
|
365
384
|
# Many details and cases due to package method being handled here.
|
|
366
385
|
# pylint: disable=too-many-branches,too-many-locals
|
|
@@ -404,6 +423,8 @@ def _updateCase(
|
|
|
404
423
|
with withDirectoryChange(result_path):
|
|
405
424
|
# Update or create lockfile of pipenv.
|
|
406
425
|
lock_filename = _updatePacmanLockFile()
|
|
426
|
+
else:
|
|
427
|
+
assert False, preferred_package_type
|
|
407
428
|
|
|
408
429
|
# Check if compilation is required.
|
|
409
430
|
with withDirectoryChange(result_path):
|
|
@@ -433,12 +454,15 @@ def _updateCase(
|
|
|
433
454
|
|
|
434
455
|
need_compile = True
|
|
435
456
|
elif old_nuitka_version == nuitka_version:
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
457
|
+
if old_report_root.attrib["completion"] != "yes":
|
|
458
|
+
need_compile = True
|
|
459
|
+
else:
|
|
460
|
+
watch_logger.info(
|
|
461
|
+
"Skipping compilation with identical Nuitka for '%s'."
|
|
462
|
+
% pipenv_filename_full
|
|
463
|
+
)
|
|
440
464
|
|
|
441
|
-
|
|
465
|
+
need_compile = False
|
|
442
466
|
else:
|
|
443
467
|
watch_logger.info(
|
|
444
468
|
"Skipping compilation of old Nuitka %s result with Nuitka %s for '%s'."
|
|
@@ -455,16 +479,26 @@ def _updateCase(
|
|
|
455
479
|
else:
|
|
456
480
|
need_compile = True
|
|
457
481
|
|
|
482
|
+
if not need_compile:
|
|
483
|
+
if os.path.exists("compiled-exit.txt"):
|
|
484
|
+
watch_logger.info(
|
|
485
|
+
"Enforcing compilation of compiled program that failed to run."
|
|
486
|
+
)
|
|
487
|
+
need_compile = True
|
|
488
|
+
|
|
458
489
|
if need_compile:
|
|
459
490
|
_compileCase(
|
|
460
491
|
case_data=case_data,
|
|
461
492
|
case_dir=case_dir,
|
|
462
493
|
installed_python=installed_python,
|
|
463
494
|
lock_filename=lock_filename,
|
|
495
|
+
jobs=jobs,
|
|
464
496
|
)
|
|
465
497
|
|
|
466
498
|
|
|
467
|
-
def updateCase(
|
|
499
|
+
def updateCase(
|
|
500
|
+
case_dir, case_data, dry_run, no_pipenv_update, nuitka_update_mode, jobs
|
|
501
|
+
):
|
|
468
502
|
case_name = case_data["case"]
|
|
469
503
|
|
|
470
504
|
watch_logger.info("Consider '%s' ... " % case_name)
|
|
@@ -520,10 +554,11 @@ def updateCase(case_dir, case_data, dry_run, no_pipenv_update, nuitka_update_mod
|
|
|
520
554
|
nuitka_update_mode=nuitka_update_mode,
|
|
521
555
|
installed_python=installed_python,
|
|
522
556
|
result_path=result_path,
|
|
557
|
+
jobs=jobs,
|
|
523
558
|
)
|
|
524
559
|
|
|
525
560
|
|
|
526
|
-
def updateCases(case_dir, dry_run, no_pipenv_update, nuitka_update_mode):
|
|
561
|
+
def updateCases(case_dir, dry_run, no_pipenv_update, nuitka_update_mode, jobs):
|
|
527
562
|
for case_data in parseYaml(getFileContents("case.yml", mode="rb")):
|
|
528
563
|
updateCase(
|
|
529
564
|
case_dir=case_dir,
|
|
@@ -531,6 +566,7 @@ def updateCases(case_dir, dry_run, no_pipenv_update, nuitka_update_mode):
|
|
|
531
566
|
dry_run=dry_run,
|
|
532
567
|
no_pipenv_update=no_pipenv_update,
|
|
533
568
|
nuitka_update_mode=nuitka_update_mode,
|
|
569
|
+
jobs=jobs,
|
|
534
570
|
)
|
|
535
571
|
|
|
536
572
|
|
|
@@ -603,6 +639,16 @@ Recompile even if the versions seems not changed. Default %default.""",
|
|
|
603
639
|
PR to create. Default not making a PR.""",
|
|
604
640
|
)
|
|
605
641
|
|
|
642
|
+
parser.add_option(
|
|
643
|
+
"--jobs",
|
|
644
|
+
action="store",
|
|
645
|
+
dest="jobs",
|
|
646
|
+
default=None,
|
|
647
|
+
help="""\
|
|
648
|
+
Argument for jobs, in order to be nice use negative values
|
|
649
|
+
to reserve cores.""",
|
|
650
|
+
)
|
|
651
|
+
|
|
606
652
|
options, positional_args = parser.parse_args()
|
|
607
653
|
|
|
608
654
|
assert len(positional_args) <= 1, positional_args
|
|
@@ -650,10 +696,11 @@ PR to create. Default not making a PR.""",
|
|
|
650
696
|
|
|
651
697
|
with withDirectoryChange(os.path.dirname(case_filename)):
|
|
652
698
|
updateCases(
|
|
653
|
-
os.path.dirname(case_filename),
|
|
699
|
+
case_dir=os.path.dirname(case_filename),
|
|
654
700
|
dry_run=options.dry_run,
|
|
655
701
|
no_pipenv_update=options.no_pipenv_update,
|
|
656
702
|
nuitka_update_mode=options.nuitka_update_mode,
|
|
703
|
+
jobs=options.jobs,
|
|
657
704
|
)
|
|
658
705
|
|
|
659
706
|
if pr_category is not None:
|