Nuitka-winsvc 2.2.3__cp311-cp311-win_amd64.whl → 2.3.2__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.

Files changed (201) hide show
  1. {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.2.dist-info}/METADATA +2 -1
  2. {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.2.dist-info}/RECORD +201 -200
  3. nuitka/Bytecodes.py +4 -2
  4. nuitka/HardImportRegistry.py +1 -0
  5. nuitka/MainControl.py +16 -10
  6. nuitka/ModuleRegistry.py +15 -0
  7. nuitka/OptionParsing.py +30 -8
  8. nuitka/Options.py +106 -45
  9. nuitka/PostProcessing.py +9 -8
  10. nuitka/PythonVersions.py +2 -1
  11. nuitka/Serialization.py +47 -30
  12. nuitka/Version.py +1 -1
  13. nuitka/build/Backend.scons +46 -19
  14. nuitka/build/CCompilerVersion.scons +3 -3
  15. nuitka/build/Onefile.scons +4 -4
  16. nuitka/build/SconsCaching.py +3 -2
  17. nuitka/build/SconsCompilerSettings.py +18 -6
  18. nuitka/build/SconsInterface.py +28 -8
  19. nuitka/build/SconsUtils.py +9 -1
  20. nuitka/build/include/nuitka/allocator.h +58 -2
  21. nuitka/build/include/nuitka/compiled_frame.h +48 -13
  22. nuitka/build/include/nuitka/compiled_function.h +4 -0
  23. nuitka/build/include/nuitka/constants.h +6 -0
  24. nuitka/build/include/nuitka/exception_groups.h +6 -6
  25. nuitka/build/include/nuitka/exceptions.h +3 -3
  26. nuitka/build/include/nuitka/freelists.h +11 -0
  27. nuitka/build/include/nuitka/helper/dictionaries.h +5 -4
  28. nuitka/build/include/nuitka/helper/lists.h +5 -5
  29. nuitka/build/include/nuitka/helper/lists_generated.h +12 -12
  30. nuitka/build/include/nuitka/helper/sequences.h +6 -0
  31. nuitka/build/include/nuitka/helper/slices.h +14 -8
  32. nuitka/build/include/nuitka/helper/subscripts.h +1 -184
  33. nuitka/build/include/nuitka/helper/tuples.h +42 -33
  34. nuitka/build/include/nuitka/importing.h +5 -0
  35. nuitka/build/include/nuitka/prelude.h +49 -5
  36. nuitka/build/include/nuitka/safe_string_ops.h +1 -0
  37. nuitka/build/include/nuitka/threading.h +13 -10
  38. nuitka/build/static_src/CompiledAsyncgenType.c +19 -8
  39. nuitka/build/static_src/CompiledCellType.c +1 -1
  40. nuitka/build/static_src/CompiledCodeHelpers.c +18 -16
  41. nuitka/build/static_src/CompiledCoroutineType.c +23 -19
  42. nuitka/build/static_src/CompiledFrameType.c +46 -34
  43. nuitka/build/static_src/CompiledFunctionType.c +55 -34
  44. nuitka/build/static_src/CompiledGeneratorType.c +21 -19
  45. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +127 -130
  46. nuitka/build/static_src/CompiledMethodType.c +15 -17
  47. nuitka/build/static_src/HelpersAllocator.c +71 -0
  48. nuitka/build/static_src/HelpersAttributes.c +1 -1
  49. nuitka/build/static_src/HelpersBuiltin.c +5 -5
  50. nuitka/build/static_src/HelpersBytes.c +2 -2
  51. nuitka/build/static_src/HelpersCalling.c +3 -0
  52. nuitka/build/static_src/HelpersCallingGenerated.c +952 -133
  53. nuitka/build/static_src/HelpersComparisonEq.c +329 -329
  54. nuitka/build/static_src/HelpersComparisonEqUtils.c +3 -1
  55. nuitka/build/static_src/HelpersComparisonGe.c +322 -322
  56. nuitka/build/static_src/HelpersComparisonGt.c +321 -321
  57. nuitka/build/static_src/HelpersComparisonLe.c +322 -322
  58. nuitka/build/static_src/HelpersComparisonLt.c +321 -321
  59. nuitka/build/static_src/HelpersComparisonNe.c +329 -329
  60. nuitka/build/static_src/HelpersConsole.c +96 -0
  61. nuitka/build/static_src/HelpersConstantsBlob.c +10 -6
  62. nuitka/build/static_src/HelpersDeepcopy.c +10 -8
  63. nuitka/build/static_src/HelpersDictionaries.c +17 -11
  64. nuitka/build/static_src/HelpersDictionariesGenerated.c +65 -29
  65. nuitka/build/static_src/HelpersExceptions.c +107 -9
  66. nuitka/build/static_src/HelpersFilesystemPaths.c +64 -4
  67. nuitka/build/static_src/HelpersFloats.c +20 -14
  68. nuitka/build/static_src/HelpersImport.c +1 -1
  69. nuitka/build/static_src/HelpersJitSources.c +1 -1
  70. nuitka/build/static_src/HelpersLists.c +29 -19
  71. nuitka/build/static_src/HelpersListsGenerated.c +24 -24
  72. nuitka/build/static_src/HelpersMatching.c +32 -5
  73. nuitka/build/static_src/HelpersOperationBinaryAdd.c +90 -63
  74. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +4 -4
  75. nuitka/build/static_src/HelpersOperationBinaryBitand.c +33 -33
  76. nuitka/build/static_src/HelpersOperationBinaryBitor.c +33 -33
  77. nuitka/build/static_src/HelpersOperationBinaryBitxor.c +33 -33
  78. nuitka/build/static_src/HelpersOperationBinaryDivmod.c +24 -24
  79. nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +24 -24
  80. nuitka/build/static_src/HelpersOperationBinaryLshift.c +30 -30
  81. nuitka/build/static_src/HelpersOperationBinaryMatmult.c +7 -7
  82. nuitka/build/static_src/HelpersOperationBinaryMod.c +90 -90
  83. nuitka/build/static_src/HelpersOperationBinaryMult.c +64 -58
  84. nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +24 -24
  85. nuitka/build/static_src/HelpersOperationBinaryPow.c +27 -27
  86. nuitka/build/static_src/HelpersOperationBinaryRshift.c +30 -30
  87. nuitka/build/static_src/HelpersOperationBinarySub.c +24 -24
  88. nuitka/build/static_src/HelpersOperationBinaryTruediv.c +24 -24
  89. nuitka/build/static_src/HelpersOperationInplaceAdd.c +67 -49
  90. nuitka/build/static_src/HelpersOperationInplaceBitand.c +25 -25
  91. nuitka/build/static_src/HelpersOperationInplaceBitor.c +25 -25
  92. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +25 -25
  93. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +28 -28
  94. nuitka/build/static_src/HelpersOperationInplaceLshift.c +18 -18
  95. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +10 -10
  96. nuitka/build/static_src/HelpersOperationInplaceMod.c +70 -70
  97. nuitka/build/static_src/HelpersOperationInplaceMult.c +33 -33
  98. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +28 -28
  99. nuitka/build/static_src/HelpersOperationInplacePow.c +28 -28
  100. nuitka/build/static_src/HelpersOperationInplaceRshift.c +18 -18
  101. nuitka/build/static_src/HelpersOperationInplaceSub.c +28 -28
  102. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +28 -28
  103. nuitka/build/static_src/HelpersRaising.c +10 -3
  104. nuitka/build/static_src/HelpersSafeStrings.c +14 -4
  105. nuitka/build/static_src/HelpersSlices.c +12 -5
  106. nuitka/build/static_src/HelpersStrings.c +1 -1
  107. nuitka/build/static_src/HelpersTuples.c +20 -15
  108. nuitka/build/static_src/InspectPatcher.c +74 -6
  109. nuitka/build/static_src/MainProgram.c +90 -25
  110. nuitka/build/static_src/MetaPathBasedLoader.c +81 -45
  111. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +2 -2
  112. nuitka/build/static_src/OnefileBootstrap.c +16 -17
  113. nuitka/code_generation/CodeGeneration.py +5 -2
  114. nuitka/code_generation/ConstantCodes.py +2 -2
  115. nuitka/code_generation/DictCodes.py +2 -2
  116. nuitka/code_generation/GlobalConstants.py +5 -0
  117. nuitka/code_generation/GlobalsLocalsCodes.py +2 -2
  118. nuitka/code_generation/ListCodes.py +2 -2
  119. nuitka/code_generation/LocalsDictCodes.py +1 -1
  120. nuitka/code_generation/ModuleCodes.py +19 -0
  121. nuitka/code_generation/PackageResourceCodes.py +14 -0
  122. nuitka/code_generation/SliceCodes.py +3 -3
  123. nuitka/code_generation/SubscriptCodes.py +5 -13
  124. nuitka/code_generation/TupleCodes.py +1 -1
  125. nuitka/code_generation/c_types/CTypePyObjectPointers.py +7 -7
  126. nuitka/code_generation/templates/CodeTemplatesConstants.py +7 -5
  127. nuitka/code_generation/templates/CodeTemplatesLoader.py +2 -0
  128. nuitka/code_generation/templates/CodeTemplatesModules.py +80 -54
  129. nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +1 -1
  130. nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +59 -8
  131. nuitka/code_generation/templates_c/CodeTemplateCallsPositionalMethodDescr.c.j2 +5 -5
  132. nuitka/code_generation/templates_c/CodeTemplateMakeListHinted.c.j2 +2 -2
  133. nuitka/code_generation/templates_c/CodeTemplateMakeListSmall.c.j2 +2 -2
  134. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +57 -21
  135. nuitka/code_generation/templates_c/HelperImportHard.c.j2 +1 -1
  136. nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +5 -5
  137. nuitka/code_generation/templates_c/HelperOperationComparison.c.j2 +18 -18
  138. nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +11 -11
  139. nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +3 -3
  140. nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +3 -3
  141. nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +7 -7
  142. nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +3 -3
  143. nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +11 -11
  144. nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +7 -7
  145. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +10 -10
  146. nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +1 -1
  147. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +3 -3
  148. nuitka/code_generation/templates_c/HelperSlotsList.c.j2 +4 -1
  149. nuitka/code_generation/templates_c/HelperSlotsTuple.c.j2 +4 -1
  150. nuitka/finalizations/FinalizeMarkups.py +0 -18
  151. nuitka/freezer/DependsExe.py +9 -4
  152. nuitka/freezer/DllDependenciesMacOS.py +1 -1
  153. nuitka/freezer/DllDependenciesWin32.py +1 -1
  154. nuitka/freezer/ImportDetection.py +1 -0
  155. nuitka/freezer/IncludedDataFiles.py +13 -4
  156. nuitka/freezer/IncludedEntryPoints.py +16 -0
  157. nuitka/freezer/Onefile.py +0 -1
  158. nuitka/freezer/Standalone.py +38 -21
  159. nuitka/importing/ImportCache.py +3 -2
  160. nuitka/importing/Importing.py +16 -3
  161. nuitka/importing/StandardLibrary.py +4 -0
  162. nuitka/nodes/ChildrenHavingMixins.py +2 -0
  163. nuitka/nodes/ExpressionBasesGenerated.py +4 -0
  164. nuitka/nodes/HardImportNodesGenerated.py +83 -0
  165. nuitka/nodes/ModuleNodes.py +10 -2
  166. nuitka/nodes/OsSysNodes.py +16 -0
  167. nuitka/nodes/SubscriptNodes.py +3 -3
  168. nuitka/plugins/PluginBase.py +2 -0
  169. nuitka/plugins/standard/DataFilesPlugin.py +22 -1
  170. nuitka/plugins/standard/DillPlugin/DillPlugin.c +3 -3
  171. nuitka/plugins/standard/ImplicitImports.py +3 -0
  172. nuitka/plugins/standard/OptionsNannyPlugin.py +9 -41
  173. nuitka/plugins/standard/PkgResourcesPlugin.py +8 -2
  174. nuitka/plugins/standard/PySidePyQtPlugin.py +3 -0
  175. nuitka/plugins/standard/standard.nuitka-package.config.yml +28 -13
  176. nuitka/plugins/standard/stdlib2.nuitka-package.config.yml +2 -2
  177. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +7 -2
  178. nuitka/specs/HardImportSpecs.py +3 -0
  179. nuitka/specs/ParameterSpecs.py +26 -15
  180. nuitka/tools/general/find_module/FindModuleCode.py +3 -2
  181. nuitka/tools/specialize/CTypeDescriptions.py +11 -9
  182. nuitka/tools/testing/Common.py +12 -5
  183. nuitka/tools/testing/SearchModes.py +5 -1
  184. nuitka/tools/testing/run_nuitka_tests/__main__.py +37 -0
  185. nuitka/tools/watch/GitHub.py +1 -7
  186. nuitka/tree/Building.py +9 -6
  187. nuitka/tree/ReformulationMatchStatements.py +51 -14
  188. nuitka/tree/TreeHelpers.py +8 -0
  189. nuitka/utils/CStrings.py +7 -0
  190. nuitka/utils/Execution.py +10 -1
  191. nuitka/utils/FileOperations.py +21 -13
  192. nuitka/utils/Importing.py +24 -0
  193. nuitka/utils/ReExecute.py +12 -3
  194. nuitka/utils/SharedLibraries.py +26 -1
  195. nuitka/utils/Yaml.py +9 -1
  196. {Nuitka_winsvc-2.2.3.data → Nuitka_winsvc-2.3.2.data}/scripts/nuitka-run.bat +0 -0
  197. {Nuitka_winsvc-2.2.3.data → Nuitka_winsvc-2.3.2.data}/scripts/nuitka.bat +0 -0
  198. {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.2.dist-info}/LICENSE.txt +0 -0
  199. {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.2.dist-info}/WHEEL +0 -0
  200. {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.2.dist-info}/entry_points.txt +0 -0
  201. {Nuitka_winsvc-2.2.3.dist-info → Nuitka_winsvc-2.3.2.dist-info}/top_level.txt +0 -0
@@ -41,7 +41,7 @@ from nuitka.utils.FileOperations import (
41
41
  )
42
42
  from nuitka.utils.InstalledPythons import findInstalledPython
43
43
  from nuitka.utils.Jinja2 import getTemplate
44
- from nuitka.utils.Utils import getOS, isMacOS, isWin32Windows
44
+ from nuitka.utils.Utils import isFreeBSD, isLinux, isMacOS, isWin32Windows
45
45
 
46
46
  from .SearchModes import (
47
47
  SearchModeByPattern,
@@ -205,7 +205,7 @@ def getTempDir():
205
205
  os.path.dirname(os.path.abspath(sys.modules["__main__"].__file__))
206
206
  )
207
207
  + "-",
208
- dir=tempfile.gettempdir() if not os.path.exists("/var/tmp") else "/var/tmp",
208
+ dir=None if not (isLinux() and os.path.exists("/var/tmp")) else "/var/tmp",
209
209
  )
210
210
 
211
211
  def removeTempDir():
@@ -520,7 +520,7 @@ def displayRuntimeTraces(logger, path):
520
520
 
521
521
  if os.name == "posix":
522
522
  # Run with traces to help debugging, specifically in CI environment.
523
- if getOS() in ("Darwin", "FreeBSD"):
523
+ if isMacOS() or isFreeBSD():
524
524
  test_logger.info("dtruss:")
525
525
  os.system("sudo dtruss %s" % path)
526
526
  else:
@@ -731,6 +731,7 @@ def checkReferenceCount(checked_function, max_rounds=20, explain=False):
731
731
 
732
732
  def createSearchMode():
733
733
  # Dealing with many options, pylint: disable=too-many-branches
734
+ # Return driven, pylint: disable=too-many-return-statements
734
735
 
735
736
  parser = OptionParser()
736
737
 
@@ -804,7 +805,9 @@ Defaults to off.""",
804
805
  else:
805
806
  return SearchModeImmediate()
806
807
  elif mode == "resume":
807
- return SearchModeResume(sys.modules["__main__"].__file__)
808
+ return SearchModeResume(sys.modules["__main__"].__file__, skip=False)
809
+ elif mode == "skip":
810
+ return SearchModeResume(sys.modules["__main__"].__file__, skip=True)
808
811
  elif mode == "only":
809
812
  if options.pattern:
810
813
  pattern = options.pattern.replace("/", os.path.sep)
@@ -1882,7 +1885,11 @@ def getLocalWebServerDir(base_dir):
1882
1885
  web_dir = os.path.join(getTempDir(), "local-web-server", base_dir)
1883
1886
 
1884
1887
  if _web_server_process is None:
1885
- web_server_directory_supporting_pythons = ("3.11", "3.10", "3.9", "3.8", "3.7")
1888
+ web_server_directory_supporting_pythons = tuple(
1889
+ python_version
1890
+ for python_version in getTestExecutionPythonVersions()
1891
+ if python_version not in ("3.6", "3.5", "3.4", "2.7", "2.6")
1892
+ )
1886
1893
 
1887
1894
  web_server_python = findInstalledPython(
1888
1895
  python_versions=web_server_directory_supporting_pythons,
@@ -109,7 +109,7 @@ class SearchModeByPattern(SearchModeBase):
109
109
 
110
110
 
111
111
  class SearchModeResume(SearchModeBase):
112
- def __init__(self, tests_path):
112
+ def __init__(self, tests_path, skip):
113
113
  SearchModeBase.__init__(self)
114
114
 
115
115
  tests_path = os.path.normcase(os.path.abspath(tests_path))
@@ -134,6 +134,7 @@ class SearchModeResume(SearchModeBase):
134
134
  self.resume_from = None
135
135
 
136
136
  self.active = not self.resume_from
137
+ self.skip = skip
137
138
 
138
139
  def consider(self, dirname, filename):
139
140
  parts = [dirname, filename]
@@ -152,6 +153,9 @@ class SearchModeResume(SearchModeBase):
152
153
  if areSamePaths(path, self.resume_from):
153
154
  self.active = True
154
155
 
156
+ if self.skip:
157
+ return False
158
+
155
159
  return self.active
156
160
 
157
161
  def finish(self):
@@ -241,6 +241,16 @@ The standard CPython3.11 test suite. Execute this for all corner cases to be
241
241
  covered. With Python 2.x these are not run. Default is %default.""",
242
242
  )
243
243
 
244
+ parser.add_option(
245
+ "--skip-cpython312-tests",
246
+ action="store_false",
247
+ dest="cpython312",
248
+ default=True,
249
+ help="""\
250
+ The standard CPython3.12 test suite. Execute this for all corner cases to be
251
+ covered. With Python 2.x these are not run. Default is %default.""",
252
+ )
253
+
244
254
  parser.add_option(
245
255
  "--skip-other-cpython-tests",
246
256
  action="store_true",
@@ -370,6 +380,15 @@ Do not use Python3.10 even if available on the system. Default is %default.""",
370
380
  Do not use Python3.11 even if available on the system. Default is %default.""",
371
381
  )
372
382
 
383
+ parser.add_option(
384
+ "--no-python3.12",
385
+ action="store_true",
386
+ dest="no312",
387
+ default=False,
388
+ help="""\
389
+ Do not use Python3.12 even if available on the system. Default is %default.""",
390
+ )
391
+
373
392
  parser.add_option(
374
393
  "--coverage",
375
394
  action="store_true",
@@ -436,6 +455,8 @@ Enforce the use of MinGW64 on Windows. Defaults to off.""",
436
455
  options.no310 = True
437
456
  if sys.version_info[0:2] != (3, 11):
438
457
  options.no311 = True
458
+ if sys.version_info[0:2] != (3, 12):
459
+ options.no312 = True
439
460
 
440
461
  if options.cpython_no_other:
441
462
  if sys.version_info[0:2] != (2, 6):
@@ -460,6 +481,8 @@ Enforce the use of MinGW64 on Windows. Defaults to off.""",
460
481
  options.cpython310 = False
461
482
  if sys.version_info[0:2] != (3, 11):
462
483
  options.cpython311 = False
484
+ if sys.version_info[0:2] != (3, 12):
485
+ options.cpython312 = False
463
486
 
464
487
  if options.cpython_none:
465
488
  options.cpython26 = False
@@ -473,6 +496,7 @@ Enforce the use of MinGW64 on Windows. Defaults to off.""",
473
496
  options.cpython39 = False
474
497
  options.cpython310 = False
475
498
  options.cpython311 = False
499
+ options.cpython312 = False
476
500
 
477
501
  if options.coverage and os.path.exists(".coverage"):
478
502
  os.unlink(".coverage")
@@ -580,6 +604,8 @@ def main():
580
604
  return False
581
605
  if command == "python3.11" and options.no311:
582
606
  return False
607
+ if command == "python3.12" and options.no312:
608
+ return False
583
609
 
584
610
  # Shortcuts for python versions, also needed for Windows as it won't have
585
611
  # the version number in the Python binaries at all.
@@ -911,6 +937,17 @@ def main():
911
937
  else:
912
938
  my_print("The CPython3.11 tests are not present, not run.")
913
939
 
940
+ # Running the Python 3.12 test suite only with CPython3.x.
941
+ if not use_python.startswith("python2"):
942
+ if options.cpython312:
943
+ if os.path.exists("./tests/CPython312/run_all.py"):
944
+ with withExtendedExtraOptions(
945
+ *getExtraFlags(where, "312tests", flags)
946
+ ):
947
+ executeSubTest("./tests/CPython312/run_all.py search")
948
+ else:
949
+ my_print("The CPython3.12 tests are not present, not run.")
950
+
914
951
  if not any(
915
952
  checkExecutableCommand("python%s" % python_version)
916
953
  for python_version in getTestExecutionPythonVersions()
@@ -6,11 +6,7 @@
6
6
  import os
7
7
  import sys
8
8
 
9
- from nuitka.tools.quality.Git import (
10
- getCurrentBranchName,
11
- getModifiedPaths,
12
- getRemoteURL,
13
- )
9
+ from nuitka.tools.quality.Git import getModifiedPaths, getRemoteURL
14
10
  from nuitka.Tracing import tools_logger
15
11
  from nuitka.utils.Execution import callProcess, check_call
16
12
 
@@ -21,8 +17,6 @@ def checkInNuitkaWatch():
21
17
  "git@github.com:Nuitka/Nuitka-Watch.git",
22
18
  "https://github.com/Nuitka/Nuitka-Watch",
23
19
  ), remote_url
24
- branch_name = getCurrentBranchName()
25
- assert branch_name == "main", branch_name
26
20
  assert os.path.exists(".git")
27
21
 
28
22
 
nuitka/tree/Building.py CHANGED
@@ -131,6 +131,7 @@ from nuitka.Tracing import (
131
131
  )
132
132
  from nuitka.utils import MemoryUsage
133
133
  from nuitka.utils.ModuleNames import ModuleName
134
+ from nuitka.utils.Utils import withNoSyntaxWarning
134
135
 
135
136
  from . import SyntaxErrors
136
137
  from .ReformulationAssertStatements import buildAssertNode
@@ -1074,6 +1075,7 @@ def _createModule(
1074
1075
  if module_kind == "extension":
1075
1076
  result = PythonExtensionModule(
1076
1077
  module_name=module_name,
1078
+ module_filename=module_filename,
1077
1079
  reason=reason,
1078
1080
  technical=is_stdlib and module_name in detectEarlyImports(),
1079
1081
  source_ref=source_ref,
@@ -1366,12 +1368,13 @@ def buildModule(
1366
1368
  )
1367
1369
 
1368
1370
  try:
1369
- ast_tree = parseSourceCodeToAst(
1370
- source_code=source_code,
1371
- module_name=module_name,
1372
- filename=source_filename,
1373
- line_offset=0,
1374
- )
1371
+ with withNoSyntaxWarning():
1372
+ ast_tree = parseSourceCodeToAst(
1373
+ source_code=source_code,
1374
+ module_name=module_name,
1375
+ filename=source_filename,
1376
+ line_offset=0,
1377
+ )
1375
1378
  except (SyntaxError, IndentationError) as e:
1376
1379
  # Do not hide SyntaxError if asked not to.
1377
1380
  if not hide_syntax_error:
@@ -14,16 +14,18 @@ from nuitka.nodes.AttributeNodes import (
14
14
  ExpressionAttributeCheck,
15
15
  makeExpressionAttributeLookup,
16
16
  )
17
+ from nuitka.nodes.BuiltinDictNodes import ExpressionBuiltinDict
17
18
  from nuitka.nodes.BuiltinLenNodes import ExpressionBuiltinLen
18
19
  from nuitka.nodes.BuiltinTypeNodes import ExpressionBuiltinList
19
20
  from nuitka.nodes.ComparisonNodes import makeComparisonExpression
20
21
  from nuitka.nodes.ConditionalNodes import makeStatementConditional
21
22
  from nuitka.nodes.ConstantRefNodes import makeConstantRefNode
23
+ from nuitka.nodes.DictionaryNodes import StatementDictOperationRemove
22
24
  from nuitka.nodes.MatchNodes import ExpressionMatchArgs
23
25
  from nuitka.nodes.OutlineNodes import ExpressionOutlineBody
24
26
  from nuitka.nodes.ReturnNodes import makeStatementReturnConstant
25
27
  from nuitka.nodes.SubscriptNodes import (
26
- ExpressionSubscriptCheck,
28
+ ExpressionMatchSubscriptCheck,
27
29
  ExpressionSubscriptLookup,
28
30
  )
29
31
  from nuitka.nodes.TypeMatchNodes import (
@@ -32,7 +34,10 @@ from nuitka.nodes.TypeMatchNodes import (
32
34
  )
33
35
  from nuitka.nodes.TypeNodes import ExpressionBuiltinIsinstance
34
36
  from nuitka.nodes.VariableAssignNodes import makeStatementAssignmentVariable
35
- from nuitka.nodes.VariableNameNodes import StatementAssignmentVariableName
37
+ from nuitka.nodes.VariableNameNodes import (
38
+ ExpressionVariableNameRef,
39
+ StatementAssignmentVariableName,
40
+ )
36
41
  from nuitka.nodes.VariableRefNodes import ExpressionTempVariableRef
37
42
  from nuitka.nodes.VariableReleaseNodes import makeStatementReleaseVariable
38
43
 
@@ -156,17 +161,18 @@ def _buildMatchSequence(provider, pattern, make_against, source_ref):
156
161
  # Could special case ">=1" or "==0" with truth checks potentially, but that
157
162
  # is for generic optimization to recognize, we don't know much about the
158
163
  # matched value at this point yet.
159
- conditions.append(
160
- makeComparisonExpression(
161
- left=ExpressionBuiltinLen(
162
- value=make_against(),
164
+ if min_length > 0 or exact:
165
+ conditions.append(
166
+ makeComparisonExpression(
167
+ left=ExpressionBuiltinLen(
168
+ value=make_against(),
169
+ source_ref=source_ref,
170
+ ),
171
+ right=makeConstantRefNode(constant=min_length, source_ref=source_ref),
172
+ comparator="Eq" if exact else "GtE",
163
173
  source_ref=source_ref,
164
- ),
165
- right=makeConstantRefNode(constant=min_length, source_ref=source_ref),
166
- comparator="Eq" if exact else "GtE",
167
- source_ref=source_ref,
174
+ )
168
175
  )
169
- )
170
176
 
171
177
  star_pos = None
172
178
 
@@ -190,8 +196,8 @@ def _buildMatchSequence(provider, pattern, make_against, source_ref):
190
196
  assert "!" not in variable_name, variable_name
191
197
 
192
198
  # Last one
193
- if star_pos == len(pattern.patterns):
194
- slice_value = slice(count)
199
+ if star_pos == len(pattern.patterns) - 1:
200
+ slice_value = slice(star_pos, None)
195
201
  else:
196
202
  slice_value = slice(count, -(len(pattern.patterns) - (count + 1)))
197
203
 
@@ -252,7 +258,7 @@ def _buildMatchMapping(provider, pattern, make_against, source_ref):
252
258
 
253
259
  for key, kwd_pattern in zip(pattern.keys, pattern.patterns):
254
260
  conditions.append(
255
- ExpressionSubscriptCheck(
261
+ ExpressionMatchSubscriptCheck(
256
262
  expression=make_against(),
257
263
  subscript=buildNode(provider, key, source_ref),
258
264
  source_ref=source_ref,
@@ -277,6 +283,37 @@ def _buildMatchMapping(provider, pattern, make_against, source_ref):
277
283
  if item_assignments:
278
284
  assignments.extend(item_assignments)
279
285
 
286
+ if pattern.rest:
287
+ assert type(pattern.rest) is str, pattern.rest
288
+
289
+ assignments.append(
290
+ StatementAssignmentVariableName(
291
+ provider=provider,
292
+ variable_name=pattern.rest,
293
+ source=ExpressionBuiltinDict(
294
+ pos_arg=make_against(),
295
+ pairs=(),
296
+ source_ref=source_ref,
297
+ ),
298
+ source_ref=source_ref,
299
+ )
300
+ )
301
+
302
+ for key in pattern.keys:
303
+ assert type(key) is ast.Constant, key
304
+
305
+ assignments.append(
306
+ StatementDictOperationRemove(
307
+ dict_arg=ExpressionVariableNameRef(
308
+ provider=provider,
309
+ variable_name=pattern.rest,
310
+ source_ref=source_ref,
311
+ ),
312
+ key=buildNode(provider, key, source_ref),
313
+ source_ref=source_ref,
314
+ )
315
+ )
316
+
280
317
  return conditions, assignments
281
318
 
282
319
 
@@ -62,6 +62,9 @@ def extractDocFromBody(node):
62
62
  if Options.hasPythonFlagNoDocStrings():
63
63
  doc = None
64
64
 
65
+ if doc is not None and python_version >= 0x3D0:
66
+ doc = doc.lstrip()
67
+
65
68
  return body, doc
66
69
 
67
70
 
@@ -291,6 +294,8 @@ def setBuildingDispatchers(path_args3, path_args2, path_args1):
291
294
 
292
295
 
293
296
  def buildNode(provider, node, source_ref, allow_none=False):
297
+ # too many exception handlers, pylint: disable=too-many-branches
298
+
294
299
  if node is None and allow_none:
295
300
  return None
296
301
 
@@ -330,6 +335,9 @@ def buildNode(provider, node, source_ref, allow_none=False):
330
335
  # we got interrupted.
331
336
  optimization_logger.info("Interrupted at '%s'." % source_ref)
332
337
  raise
338
+ except SystemExit:
339
+ optimization_logger.warning("Problem at '%s'." % source_ref.getAsString())
340
+ raise
333
341
  except:
334
342
  optimization_logger.warning(
335
343
  "Problem at '%s' with %s." % (source_ref.getAsString(), ast.dump(node))
nuitka/utils/CStrings.py CHANGED
@@ -63,16 +63,23 @@ def encodePythonUnicodeToC(value):
63
63
  assert type(value) is unicode, type(value)
64
64
 
65
65
  result = ""
66
+ last_was_hex = False
66
67
 
67
68
  for c in value:
68
69
  cv = ord(c)
69
70
 
70
71
  if c == "\\":
71
72
  result += "\\\\"
73
+ last_was_hex = False
72
74
  elif 34 < cv < 128:
75
+ if last_was_hex:
76
+ result += '" L"'
77
+
73
78
  result += c
79
+ last_was_hex = False
74
80
  else:
75
81
  result += r"\x%04x" % cv
82
+ last_was_hex = True
76
83
 
77
84
  return 'L"%s"' % result
78
85
 
nuitka/utils/Execution.py CHANGED
@@ -421,8 +421,17 @@ def createProcess(
421
421
 
422
422
 
423
423
  def executeProcess(
424
- command, env=None, stdin=False, shell=False, external_cwd=False, timeout=None
424
+ command,
425
+ env=None,
426
+ stdin=False,
427
+ shell=False,
428
+ external_cwd=False,
429
+ timeout=None,
430
+ logger=None,
425
431
  ):
432
+ if logger is not None:
433
+ logger.info("Executing command '%s'." % " ".join(command), keep_format=True)
434
+
426
435
  process = createProcess(
427
436
  command=command, env=env, stdin=stdin, shell=shell, external_cwd=external_cwd
428
437
  )
@@ -730,23 +730,31 @@ def removeDirectory(path, ignore_errors):
730
730
  """
731
731
 
732
732
  def onError(func, path, exc_info):
733
- # Try again immediately, ignore what happened, pylint: disable=unused-argument
734
- try:
735
- func(path)
736
- except OSError:
737
- time.sleep(0.1)
738
-
739
- func(path)
733
+ # Record what happened what happened, pylint: disable=unused-argument
734
+ last_error.append((func, path))
740
735
 
741
736
  with withFileLock("removing directory %s" % path):
742
737
  if os.path.exists(path):
743
- try:
738
+ previous_error = []
739
+
740
+ while True:
741
+ last_error = []
744
742
  shutil.rmtree(path, ignore_errors=False, onerror=onError)
745
- except OSError:
746
- if ignore_errors:
743
+
744
+ # onError as a side effect, modifies last_error
745
+ if previous_error == last_error:
746
+ break
747
+
748
+ previous_error = list(last_error)
749
+ time.sleep(0.1)
750
+
751
+ # if it still exists, try one more time, this time not ignoring errors.
752
+ if os.path.exists(path):
753
+ try:
747
754
  shutil.rmtree(path, ignore_errors=ignore_errors)
748
- else:
749
- raise
755
+ except OSError:
756
+ if not ignore_errors:
757
+ raise
750
758
 
751
759
 
752
760
  def resetDirectory(path, ignore_errors):
@@ -1438,7 +1446,7 @@ def syncFileOutput(file_handle):
1438
1446
 
1439
1447
  def isFilesystemEncodable(filename):
1440
1448
  """Decide if a filename is safe for use as a file system path with tools."""
1441
- if os.name == "nt":
1449
+ if os.name == "nt" and type(filename) is unicode:
1442
1450
  value = (
1443
1451
  unicodedata.normalize("NFKD", filename)
1444
1452
  .encode("ascii", "ignore")
nuitka/utils/Importing.py CHANGED
@@ -307,6 +307,30 @@ def getModuleNameAndKindFromFilenameSuffix(module_filename):
307
307
  return None, None
308
308
 
309
309
 
310
+ def hasPackageDirFilename(path):
311
+ path = os.path.basename(path)
312
+
313
+ for suffix in (".py",) + getSharedLibrarySuffixes():
314
+ candidate = "__init__" + suffix
315
+
316
+ if candidate == path:
317
+ return True
318
+
319
+ return False
320
+
321
+
322
+ def getPackageDirFilename(path):
323
+ assert os.path.isdir(path)
324
+
325
+ for suffix in (".py",) + getSharedLibrarySuffixes():
326
+ candidate = os.path.join(path, "__init__" + suffix)
327
+
328
+ if os.path.isfile(candidate):
329
+ return candidate
330
+
331
+ return None
332
+
333
+
310
334
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
311
335
  # integrates with CPython, but also works on its own.
312
336
  #
nuitka/utils/ReExecute.py CHANGED
@@ -12,8 +12,10 @@ spell-checker: ignore execl, Popen
12
12
  import os
13
13
  import sys
14
14
 
15
+ from nuitka.Options import shallExecuteImmediately
15
16
 
16
- def callExecProcess(args):
17
+
18
+ def callExecProcess(args, uac):
17
19
  """Do exec in a portable way preserving exit code.
18
20
 
19
21
  On Windows, unfortunately there is no real exec, so we have to spawn
@@ -33,7 +35,7 @@ def callExecProcess(args):
33
35
 
34
36
  try:
35
37
  # Context manager is not available on all Python versions, pylint: disable=consider-using-with
36
- process = subprocess.Popen(args=args)
38
+ process = subprocess.Popen(args=args, shell=uac)
37
39
  process.communicate()
38
40
  # No point in cleaning up, just exit the hard way.
39
41
  try:
@@ -46,6 +48,10 @@ def callExecProcess(args):
46
48
  # There was a more relevant stack trace already, so abort this
47
49
  # right here.
48
50
  os._exit(2)
51
+ except OSError as e:
52
+ print("Error, executing: %s" % e)
53
+ os._exit(2)
54
+
49
55
  else:
50
56
  # The star arguments is the API of execl
51
57
  os.execl(*args)
@@ -79,6 +85,9 @@ def reExecuteNuitka(pgo_filename):
79
85
  else:
80
86
  os.environ["NUITKA_SYS_PREFIX"] = sys.prefix
81
87
 
88
+ if shallExecuteImmediately():
89
+ args.append("--run")
90
+
82
91
  # Same arguments as before.
83
92
  args += sys.argv[1:]
84
93
 
@@ -120,7 +129,7 @@ def reExecuteNuitka(pgo_filename):
120
129
  os.environ["NUITKA_REEXECUTION"] = "1"
121
130
 
122
131
  # Does not return:
123
- callExecProcess(args)
132
+ callExecProcess(args, uac=False)
124
133
 
125
134
 
126
135
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
@@ -364,6 +364,23 @@ Error, needs 'patchelf' on your system, to modify 'RPATH' settings that \
364
364
  need to be updated."""
365
365
 
366
366
 
367
+ def checkPatchElfPresenceAndUsability(logger):
368
+ """Checks if patchelf is present and usable."""
369
+
370
+ output = executeToolChecked(
371
+ logger=logger,
372
+ command=("patchelf", "--version"),
373
+ absence_message="""\
374
+ Error, standalone mode on Linux requires 'patchelf' to be \
375
+ installed. Use 'apt/dnf/yum install patchelf' first.""",
376
+ )
377
+
378
+ if output.split() == b"0.18.0":
379
+ logger.sysexit(
380
+ "Error, patchelf version 0.18.0 is a known buggy release and cannot be used. Please upgrade or downgrade it."
381
+ )
382
+
383
+
367
384
  def _setSharedLibraryRPATHElf(filename, rpath):
368
385
  # patchelf --set-rpath "$ORIGIN/path/to/library" <executable>
369
386
  with withEnvironmentVarOverridden("LANG", "C"):
@@ -644,7 +661,15 @@ def copyDllFile(source_path, dist_dir, dest_path, executable):
644
661
  # Path must be normalized for this to be correct, but entry points enforced that.
645
662
  count = dest_path.count(os.path.sep)
646
663
 
647
- rpath = os.path.join("$ORIGIN", *([".."] * count))
664
+ # TODO: This ought to depend on actual presence of used DLLs with middle
665
+ # paths and not just do it, but maybe there is not much harm in it.
666
+ if count > 0:
667
+ rpath = ":".join(
668
+ os.path.join("$ORIGIN", *([".."] * c)) for c in range(count, 0, -1)
669
+ )
670
+ else:
671
+ rpath = "$ORIGIN"
672
+
648
673
  setSharedLibraryRPATH(target_filename, rpath)
649
674
 
650
675
  if isWin32Windows() and isUnstripped():
nuitka/utils/Yaml.py CHANGED
@@ -38,7 +38,15 @@ class PackageConfigYaml(object):
38
38
 
39
39
  assert type(file_data) is bytes
40
40
  data = parseYaml(file_data)
41
- assert type(data) is list
41
+
42
+ if not data:
43
+ general.sysexit(
44
+ """\
45
+ Error, empty (or malformed?) user package configuration '%s' used."""
46
+ % name
47
+ )
48
+
49
+ assert type(data) is list, type(data)
42
50
 
43
51
  self.data = OrderedDict()
44
52