Nuitka-winsvc 1.8.6__cp312-cp312-win_amd64.whl → 1.9.3__cp312-cp312-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/METADATA +1 -1
  2. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/RECORD +212 -203
  3. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/WHEEL +1 -1
  4. nuitka/BytecodeCaching.py +4 -1
  5. nuitka/HardImportRegistry.py +348 -0
  6. nuitka/MainControl.py +45 -25
  7. nuitka/OptionParsing.py +31 -20
  8. nuitka/Options.py +47 -16
  9. nuitka/Progress.py +32 -2
  10. nuitka/PythonFlavors.py +1 -1
  11. nuitka/PythonVersions.py +61 -0
  12. nuitka/Tracing.py +25 -12
  13. nuitka/TreeXML.py +5 -5
  14. nuitka/Variables.py +15 -24
  15. nuitka/Version.py +16 -6
  16. nuitka/__main__.py +15 -0
  17. nuitka/__past__.py +15 -17
  18. nuitka/build/Backend.scons +44 -35
  19. nuitka/build/CCompilerVersion.scons +10 -9
  20. nuitka/build/Onefile.scons +11 -26
  21. nuitka/build/SconsCaching.py +2 -0
  22. nuitka/build/SconsCompilerSettings.py +72 -22
  23. nuitka/build/SconsHacks.py +1 -0
  24. nuitka/build/SconsInterface.py +5 -0
  25. nuitka/build/SconsSpawn.py +16 -3
  26. nuitka/build/SconsUtils.py +11 -12
  27. nuitka/build/include/nuitka/checksum_tools.h +0 -4
  28. nuitka/build/include/nuitka/compiled_asyncgen.h +1 -1
  29. nuitka/build/include/nuitka/compiled_coroutine.h +1 -1
  30. nuitka/build/include/nuitka/compiled_frame.h +7 -4
  31. nuitka/build/include/nuitka/compiled_function.h +13 -3
  32. nuitka/build/include/nuitka/compiled_generator.h +1 -1
  33. nuitka/build/include/nuitka/constants.h +2 -0
  34. nuitka/build/include/nuitka/environment_variables.h +45 -0
  35. nuitka/build/include/nuitka/exceptions.h +32 -4
  36. nuitka/build/include/nuitka/filesystem_paths.h +6 -1
  37. nuitka/build/include/nuitka/freelists.h +11 -1
  38. nuitka/build/include/nuitka/helper/dictionaries.h +1 -1
  39. nuitka/build/include/nuitka/helper/import_hard.h +3 -0
  40. nuitka/build/include/nuitka/helpers.h +2 -0
  41. nuitka/build/include/nuitka/importing.h +3 -0
  42. nuitka/build/include/nuitka/prelude.h +17 -6
  43. nuitka/build/include/nuitka/unfreezing.h +1 -1
  44. nuitka/build/inline_copy/bin/scons.py +14 -0
  45. nuitka/build/inline_copy/tqdm/tqdm/__init__.py +2 -2
  46. nuitka/build/inline_copy/tqdm/tqdm/utils.py +14 -8
  47. nuitka/build/inline_copy/zlib/LICENSE +22 -0
  48. nuitka/build/inline_copy/zlib/crc32.c +1049 -0
  49. nuitka/build/inline_copy/zlib/crc32.h +9446 -0
  50. nuitka/build/inline_copy/zlib/zconf.h +551 -0
  51. nuitka/build/inline_copy/zlib/zlib.h +1938 -0
  52. nuitka/build/inline_copy/zlib/zutil.h +275 -0
  53. nuitka/build/static_src/CompiledAsyncgenType.c +41 -41
  54. nuitka/build/static_src/CompiledCodeHelpers.c +14 -7
  55. nuitka/build/static_src/CompiledCoroutineType.c +60 -51
  56. nuitka/build/static_src/CompiledFrameType.c +12 -12
  57. nuitka/build/static_src/CompiledFunctionType.c +149 -28
  58. nuitka/build/static_src/CompiledGeneratorType.c +64 -65
  59. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +1 -1
  60. nuitka/build/static_src/CompiledMethodType.c +5 -3
  61. nuitka/build/static_src/HelperEnvironmentVariables.c +120 -0
  62. nuitka/build/static_src/HelpersAttributes.c +1 -1
  63. nuitka/build/static_src/HelpersBuiltin.c +1 -1
  64. nuitka/build/static_src/HelpersChecksumTools.c +19 -4
  65. nuitka/build/static_src/HelpersComparisonEq.c +4 -4
  66. nuitka/build/static_src/HelpersComparisonNe.c +4 -4
  67. nuitka/build/static_src/HelpersConstantsBlob.c +40 -23
  68. nuitka/build/static_src/HelpersDictionaries.c +3 -1
  69. nuitka/build/static_src/HelpersDictionariesGenerated.c +9 -9
  70. nuitka/build/static_src/HelpersFilesystemPaths.c +12 -2
  71. nuitka/build/static_src/HelpersImport.c +29 -1
  72. nuitka/build/static_src/HelpersImportHard.c +19 -0
  73. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +5 -4
  74. nuitka/build/static_src/HelpersPythonPgo.c +5 -5
  75. nuitka/build/static_src/HelpersSafeStrings.c +2 -1
  76. nuitka/build/static_src/HelpersStrings.c +12 -10
  77. nuitka/build/static_src/HelpersTypes.c +1 -1
  78. nuitka/build/static_src/InspectPatcher.c +3 -2
  79. nuitka/build/static_src/MainProgram.c +182 -214
  80. nuitka/build/static_src/MetaPathBasedLoader.c +36 -23
  81. nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +4 -2
  82. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +38 -2
  83. nuitka/build/static_src/OnefileBootstrap.c +124 -93
  84. nuitka/code_generation/CodeGeneration.py +4 -2
  85. nuitka/code_generation/CodeObjectCodes.py +5 -1
  86. nuitka/code_generation/ConstantCodes.py +4 -0
  87. nuitka/code_generation/Contexts.py +111 -3
  88. nuitka/code_generation/DictCodes.py +5 -5
  89. nuitka/code_generation/FunctionCodes.py +4 -2
  90. nuitka/code_generation/GlobalConstants.py +10 -0
  91. nuitka/code_generation/ImportCodes.py +69 -33
  92. nuitka/code_generation/ModuleCodes.py +4 -1
  93. nuitka/code_generation/Namify.py +6 -5
  94. nuitka/code_generation/YieldCodes.py +3 -3
  95. nuitka/code_generation/templates/CodeTemplatesModules.py +61 -95
  96. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +3 -3
  97. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +2 -2
  98. nuitka/distutils/DistutilCommands.py +3 -0
  99. nuitka/finalizations/FinalizeMarkups.py +1 -1
  100. nuitka/freezer/DependsExe.py +2 -1
  101. nuitka/freezer/DllDependenciesPosix.py +11 -1
  102. nuitka/freezer/IncludedEntryPoints.py +54 -16
  103. nuitka/freezer/Onefile.py +7 -3
  104. nuitka/freezer/Standalone.py +39 -17
  105. nuitka/importing/Importing.py +195 -62
  106. nuitka/importing/PreloadedPackages.py +2 -1
  107. nuitka/importing/Recursion.py +98 -27
  108. nuitka/importing/StandardLibrary.py +7 -4
  109. nuitka/nodes/BuiltinOpenNodes.py +28 -1
  110. nuitka/nodes/BuiltinRangeNodes.py +2 -2
  111. nuitka/nodes/BuiltinSumNodes.py +1 -1
  112. nuitka/nodes/ChildrenHavingMixins.py +326 -2
  113. nuitka/nodes/HardImportNodesGenerated.py +141 -38
  114. nuitka/nodes/ImportHardNodes.py +0 -8
  115. nuitka/nodes/ImportNodes.py +267 -361
  116. nuitka/nodes/IterationHandles.py +36 -17
  117. nuitka/nodes/LocalsScopes.py +3 -1
  118. nuitka/nodes/NodeBases.py +8 -14
  119. nuitka/nodes/OperatorNodes.py +9 -9
  120. nuitka/nodes/OutlineNodes.py +3 -3
  121. nuitka/nodes/PackageMetadataNodes.py +19 -9
  122. nuitka/nodes/SliceNodes.py +1 -1
  123. nuitka/nodes/VariableAssignNodes.py +25 -15
  124. nuitka/nodes/VariableRefNodes.py +7 -7
  125. nuitka/nodes/YieldNodes.py +2 -2
  126. nuitka/nodes/shapes/BuiltinTypeShapes.py +81 -6
  127. nuitka/nodes/shapes/ShapeMixins.py +21 -0
  128. nuitka/nodes/shapes/StandardShapes.py +9 -3
  129. nuitka/optimizations/OptimizeBuiltinCalls.py +1 -1
  130. nuitka/optimizations/TraceCollections.py +75 -0
  131. nuitka/pgo/PGO.py +14 -6
  132. nuitka/plugins/PluginBase.py +83 -11
  133. nuitka/plugins/Plugins.py +78 -35
  134. nuitka/plugins/standard/AntiBloatPlugin.py +46 -1
  135. nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +1 -1
  136. nuitka/plugins/standard/DelvewheelPlugin.py +2 -1
  137. nuitka/plugins/standard/DillPlugin.py +3 -99
  138. nuitka/plugins/standard/DllFilesPlugin.py +45 -0
  139. nuitka/plugins/standard/GiPlugin.py +23 -10
  140. nuitka/plugins/standard/GlfwPlugin.py +1 -0
  141. nuitka/plugins/standard/ImplicitImports.py +267 -15
  142. nuitka/plugins/standard/KivyPlugin.py +1 -0
  143. nuitka/plugins/standard/MatplotlibPlugin.py +43 -25
  144. nuitka/plugins/standard/OptionsNannyPlugin.py +5 -6
  145. nuitka/plugins/standard/PkgResourcesPlugin.py +1 -1
  146. nuitka/plugins/standard/PmwPlugin.py +1 -1
  147. nuitka/plugins/standard/PySidePyQtPlugin.py +37 -20
  148. nuitka/plugins/standard/TkinterPlugin.py +44 -30
  149. nuitka/plugins/standard/TransformersPlugin.py +3 -1
  150. nuitka/plugins/standard/standard.nuitka-package.config.yml +522 -86
  151. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +8 -1
  152. nuitka/reports/CompilationReportReader.py +53 -0
  153. nuitka/reports/LicenseReport.rst.j2 +4 -4
  154. nuitka/reports/Reports.py +129 -47
  155. nuitka/specs/HardImportSpecs.py +6 -0
  156. nuitka/tools/data_composer/DataComposer.py +29 -17
  157. nuitka/tools/onefile_compressor/OnefileCompressor.py +173 -110
  158. nuitka/tools/podman/__main__.py +17 -2
  159. nuitka/tools/scanning/DisplayPackageDLLs.py +11 -2
  160. nuitka/tools/scanning/DisplayPackageData.py +1 -1
  161. nuitka/tools/specialize/CTypeDescriptions.py +36 -27
  162. nuitka/tools/specialize/SpecializeC.py +1 -1
  163. nuitka/tools/specialize/SpecializePython.py +16 -0
  164. nuitka/tools/testing/Common.py +3 -4
  165. nuitka/tools/testing/OutputComparison.py +23 -0
  166. nuitka/tools/testing/SearchModes.py +2 -2
  167. nuitka/tools/testing/compare_with_cpython/__main__.py +13 -4
  168. nuitka/tools/testing/measure_construct_performance/__main__.py +2 -5
  169. nuitka/tools/watch/__main__.py +194 -56
  170. nuitka/tree/Building.py +8 -2
  171. nuitka/tree/ComplexCallHelperFunctions.py +45 -15
  172. nuitka/tree/ReformulationAssignmentStatements.py +18 -12
  173. nuitka/tree/ReformulationCallExpressions.py +1 -1
  174. nuitka/tree/ReformulationClasses.py +11 -5
  175. nuitka/tree/ReformulationClasses3.py +30 -12
  176. nuitka/tree/ReformulationComparisonExpressions.py +4 -2
  177. nuitka/tree/ReformulationContractionExpressions.py +19 -11
  178. nuitka/tree/ReformulationDictionaryCreation.py +9 -3
  179. nuitka/tree/ReformulationExecStatements.py +6 -6
  180. nuitka/tree/ReformulationForLoopStatements.py +5 -5
  181. nuitka/tree/ReformulationFunctionStatements.py +6 -2
  182. nuitka/tree/ReformulationImportStatements.py +7 -2
  183. nuitka/tree/ReformulationLambdaExpressions.py +1 -1
  184. nuitka/tree/ReformulationMatchStatements.py +3 -1
  185. nuitka/tree/ReformulationNamespacePackages.py +7 -3
  186. nuitka/tree/ReformulationPrintStatements.py +1 -1
  187. nuitka/tree/ReformulationSequenceCreation.py +18 -6
  188. nuitka/tree/ReformulationWithStatements.py +8 -8
  189. nuitka/tree/ReformulationYieldExpressions.py +2 -2
  190. nuitka/tree/SourceHandling.py +27 -5
  191. nuitka/tree/VariableClosure.py +11 -1
  192. nuitka/utils/AppDirs.py +2 -2
  193. nuitka/utils/CStrings.py +39 -3
  194. nuitka/utils/CommandLineOptions.py +42 -1
  195. nuitka/utils/Distributions.py +305 -38
  196. nuitka/utils/Download.py +27 -8
  197. nuitka/utils/FileOperations.py +103 -20
  198. nuitka/utils/Hashing.py +2 -3
  199. nuitka/utils/Importing.py +60 -3
  200. nuitka/utils/InstalledPythons.py +31 -36
  201. nuitka/utils/Jinja2.py +11 -5
  202. nuitka/utils/ModuleNames.py +11 -3
  203. nuitka/utils/ReExecute.py +7 -0
  204. nuitka/utils/SharedLibraries.py +38 -14
  205. nuitka/utils/SlotMetaClasses.py +55 -0
  206. nuitka/utils/Utils.py +10 -0
  207. nuitka/utils/Yaml.py +9 -1
  208. nuitka/build/inline_copy/tqdm/tqdm/_tqdm_gui.py +0 -9
  209. nuitka/build/inline_copy/tqdm/tqdm/gui.py +0 -191
  210. {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka-run.bat +0 -0
  211. {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka.bat +0 -0
  212. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/LICENSE.txt +0 -0
  213. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/entry_points.txt +0 -0
  214. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/top_level.txt +0 -0
@@ -20,7 +20,6 @@
20
20
  import ast
21
21
  import atexit
22
22
  import gc
23
- import hashlib
24
23
  import os
25
24
  import re
26
25
  import shutil
@@ -32,7 +31,7 @@ import time
32
31
  from contextlib import contextmanager
33
32
  from optparse import OptionParser
34
33
 
35
- from nuitka.__past__ import subprocess
34
+ from nuitka.__past__ import md5, subprocess
36
35
  from nuitka.PythonVersions import getTestExecutionPythonVersions, isDebugPython
37
36
  from nuitka.Tracing import OurLogger, my_print
38
37
  from nuitka.tree.SourceHandling import readSourceCodeFromFilename
@@ -1273,9 +1272,9 @@ def setupCacheHashSalt(test_code_path):
1273
1272
  stdout_git, stderr_git = process.communicate()
1274
1273
  assert process.returncode == 0, stderr_git
1275
1274
 
1276
- salt_value = hashlib.md5(stdout_git)
1275
+ salt_value = md5(stdout_git)
1277
1276
  else:
1278
- salt_value = hashlib.md5()
1277
+ salt_value = md5()
1279
1278
 
1280
1279
  for filename in getFileList(test_code_path):
1281
1280
  if filename.endswith(".py"):
@@ -144,7 +144,30 @@ def makeDiffable(output, ignore_warnings, syntax_errors):
144
144
  line = thread_re.sub(r"Thread 0xXXXXXXXX", line)
145
145
  line = compiled_types_re.sub(r"\1", line)
146
146
  line = global_name_error_re.sub(r"\1\2\3", line)
147
+
147
148
  line = module_repr_re.sub(r"\1xxxxx\2", line)
149
+
150
+ # Frozen modules of 3.11, _imp._frozen_module_names
151
+ for module_name in (
152
+ "zipimport",
153
+ "abc",
154
+ "codecs",
155
+ "io",
156
+ "_collections_abc",
157
+ "_sitebuiltins",
158
+ "genericpath",
159
+ "ntpath",
160
+ "posixpath",
161
+ "os.path",
162
+ "os",
163
+ "site",
164
+ "stat",
165
+ ):
166
+ line = line.replace(
167
+ "<module '%s' (frozen)>" % module_name,
168
+ "<module '%s' from 'xxxxx'>" % module_name,
169
+ )
170
+
148
171
  line = non_ascii_error_rt.sub(r"\1 xxxx", line)
149
172
  line = timing_re.sub(r"in x.xx seconds", line)
150
173
 
@@ -21,10 +21,10 @@ The test runner can handle found errors, skip tests, etc. with search
21
21
  modes, which are implemented here.
22
22
  """
23
23
 
24
- import hashlib
25
24
  import os
26
25
  import sys
27
26
 
27
+ from nuitka.__past__ import md5
28
28
  from nuitka.utils.FileOperations import (
29
29
  areSamePaths,
30
30
  getFileContents,
@@ -133,7 +133,7 @@ class SearchModeResume(SearchModeBase):
133
133
  tests_path = tests_path.encode("utf8")
134
134
  version = version.encode("utf8")
135
135
 
136
- case_hash = hashlib.md5(tests_path)
136
+ case_hash = md5(tests_path)
137
137
  case_hash.update(version)
138
138
 
139
139
  from .Common import getTestingCacheDir
@@ -21,15 +21,14 @@
21
21
 
22
22
  """
23
23
 
24
- import hashlib
25
24
  import os
26
25
  import pickle
27
26
  import re
28
27
  import sys
29
28
  import time
30
29
 
30
+ from nuitka.__past__ import md5
31
31
  from nuitka.OptionParsing import getNuitkaProjectOptions
32
- from nuitka.PythonVersions import python_version
33
32
  from nuitka.tools.testing.Common import (
34
33
  addToPythonPath,
35
34
  executeAfterTimePassed,
@@ -137,7 +136,7 @@ def getCPythonResults(cpython_cmd, cpython_cached, force_update, send_kill):
137
136
  if str is not bytes:
138
137
  hash_input = hash_input.encode("utf8")
139
138
 
140
- command_hash = hashlib.md5(hash_input)
139
+ command_hash = md5(hash_input)
141
140
 
142
141
  for element in cpython_cmd:
143
142
  if os.path.exists(element):
@@ -150,7 +149,7 @@ def getCPythonResults(cpython_cmd, cpython_cached, force_update, send_kill):
150
149
  hash_salt = hash_salt.encode("utf8")
151
150
  command_hash.update(hash_salt)
152
151
 
153
- if os.name == "nt" and python_version < 0x300:
152
+ if os.name == "nt" and str is bytes:
154
153
  curdir = os.getcwdu() # spell-checker: ignore getcwdu
155
154
  else:
156
155
  curdir = os.getcwd()
@@ -264,6 +263,10 @@ def main():
264
263
  include_packages = hasArgValues("--include-package")
265
264
  include_modules = hasArgValues("--include-module")
266
265
  python_flag_m = hasArg("--python-flag=-m")
266
+ python_version = hasArgValue("--python-version")
267
+
268
+ if python_version:
269
+ python_version = tuple(int(d) for d in python_version.split("."))
267
270
 
268
271
  plugins_enabled = []
269
272
  for count, arg in reversed(tuple(enumerate(args))):
@@ -386,6 +389,9 @@ Taking coverage of '{filename}' using '{python}' with flags {args} ...""".format
386
389
  % (repr(os.path.dirname(filename)), mini_script),
387
390
  ]
388
391
 
392
+ if python_version and python_version >= (3, 11):
393
+ cpython_cmd += ["-X", "frozen_modules=off"]
394
+
389
395
  if no_warnings:
390
396
  cpython_cmd[1:1] = [
391
397
  "-W",
@@ -400,6 +406,9 @@ Taking coverage of '{filename}' using '{python}' with flags {args} ...""".format
400
406
  "ignore",
401
407
  ]
402
408
 
409
+ if python_version and python_version >= (3, 11):
410
+ cpython_cmd += ["-X", "frozen_modules=off"]
411
+
403
412
  if python_flag_m:
404
413
  cpython_cmd += ["-m", os.path.basename(filename)]
405
414
  os.chdir(os.path.dirname(filename))
@@ -25,11 +25,11 @@ in comparisons.
25
25
 
26
26
  """
27
27
 
28
- import hashlib
29
28
  import os
30
29
  import sys
31
30
  from optparse import OptionParser
32
31
 
32
+ from nuitka.__past__ import md5
33
33
  from nuitka.tools.testing.Common import (
34
34
  check_output,
35
35
  convertUsing2to3,
@@ -111,10 +111,7 @@ def main():
111
111
 
112
112
  my_print("PYTHON='%s'" % getPythonVersionString())
113
113
  my_print("PYTHON_BINARY='%s'" % os.environ["PYTHON"])
114
- my_print(
115
- "TEST_CASE_HASH='%s'"
116
- % hashlib.md5(getFileContents(test_case, "rb")).hexdigest()
117
- )
114
+ my_print("TEST_CASE_HASH='%s'" % md5(getFileContents(test_case, "rb")).hexdigest())
118
115
 
119
116
  needs_2to3 = decideNeeds2to3(test_case)
120
117
 
@@ -26,11 +26,17 @@ import sys
26
26
  from optparse import OptionParser
27
27
 
28
28
  from nuitka.containers.OrderedDicts import OrderedDict
29
+ from nuitka.PythonFlavors import isAnacondaPython, isMSYS2MingwPython
29
30
  from nuitka.PythonVersions import getTestExecutionPythonVersions
30
31
  from nuitka.tools.testing.Common import extractNuitkaVersionFromFilePath
31
32
  from nuitka.Tracing import OurLogger
32
33
  from nuitka.TreeXML import fromFile
33
- from nuitka.utils.Execution import check_call, executeProcess
34
+ from nuitka.utils.Execution import (
35
+ check_call,
36
+ executeProcess,
37
+ executeToolChecked,
38
+ withEnvironmentVarOverridden,
39
+ )
34
40
  from nuitka.utils.FileOperations import (
35
41
  changeTextFileContents,
36
42
  getFileContents,
@@ -44,18 +50,17 @@ from nuitka.utils.Hashing import getFileContentsHash
44
50
  from nuitka.utils.InstalledPythons import findPythons
45
51
  from nuitka.utils.Utils import isLinux, isMacOS, isWin32Windows
46
52
  from nuitka.utils.Yaml import parseYaml
47
-
48
- # TODO: Command line interface
49
- nuitka_update_mode = "newer"
53
+ from nuitka.Version import parseNuitkaVersionToTuple
50
54
 
51
55
  watch_logger = OurLogger("", base_style="blue")
52
56
 
53
57
 
54
- def _compareNuitkaVersions(version_a, version_b):
55
- def _numberize(version):
56
- return tuple(int(d) for d in version.split("rc")[0].split("."))
58
+ def _compareNuitkaVersions(version_a, version_b, consider_rc):
59
+ if not consider_rc:
60
+ version_a = version_a.split("rc")[0]
61
+ version_b = version_b.split("rc")[0]
57
62
 
58
- return _numberize(version_a) < _numberize(version_b)
63
+ return parseNuitkaVersionToTuple(version_a) < parseNuitkaVersionToTuple(version_b)
59
64
 
60
65
 
61
66
  def scanCases(path):
@@ -70,10 +75,13 @@ def scanCases(path):
70
75
  yield case
71
76
 
72
77
 
73
- def selectPythons(python_version_req, anaconda):
78
+ def selectPythons(python_version_req, anaconda, msys2_mingw64):
74
79
  for _python_version_str, installed_python_for_version in installed_pythons.items():
75
80
  for installed_python in installed_python_for_version:
76
- if not anaconda and installed_python.isAnacondaPython():
81
+ if anaconda and not installed_python.isAnacondaPython():
82
+ continue
83
+
84
+ if msys2_mingw64 and not installed_python.isMSYS2MingwPython():
77
85
  continue
78
86
 
79
87
  if python_version_req is not None:
@@ -90,14 +98,27 @@ def selectPythons(python_version_req, anaconda):
90
98
 
91
99
 
92
100
  def selectOS(os_values):
101
+ # return driven, pylint: disable=too-many-return-statements
102
+
93
103
  for value in os_values:
94
- if value not in ("Linux", "Win32", "macOS"):
104
+ if value not in ("Linux", "Win32", "macOS", "Win32-MSYS2", "Win32-Anaconda"):
95
105
  watch_logger.sysexit("Illegal value for OS: %s" % value)
96
106
 
97
107
  if isLinux() and "Linux" in os_values:
98
108
  return "Linux"
99
- if isWin32Windows() and "Win32" in os_values:
100
- return "Win32"
109
+ if isWin32Windows():
110
+ if isMSYS2MingwPython():
111
+ if "Win32-MSYS2" in os_values:
112
+ return "Win32-MSYS2"
113
+
114
+ return None
115
+ if isAnacondaPython():
116
+ if "Win32-Anaconda" in os_values:
117
+ return "Win32-Anaconda"
118
+
119
+ return None
120
+ if "Win32" in os_values:
121
+ return "Win32"
101
122
  if isMacOS() and "macOS" in os_values:
102
123
  return "macOS"
103
124
 
@@ -181,6 +202,35 @@ python_version = "%(python_version)s"
181
202
  return changed_pipenv_file, pipenv_filename
182
203
 
183
204
 
205
+ def _updatePacmanFile(installed_python, case_data, dry_run, result_path):
206
+ pipenv_filename = os.path.join(result_path, "Pacman.txt")
207
+ pipenv_package_requirements = []
208
+
209
+ for requirement in getPlatformRequirements(
210
+ installed_python=installed_python, case_data=case_data
211
+ ):
212
+ # Ignore spaces in requirements.
213
+ requirement = requirement.replace(" ", "")
214
+
215
+ # TODO: Other indexes, e.g. nvidia might be needed too
216
+ changed_pipenv_file = changeTextFileContents(
217
+ pipenv_filename,
218
+ """\
219
+ [python]
220
+ %(python_version)s
221
+ [packages]
222
+ %(pipenv_package_requirements)s
223
+ """
224
+ % {
225
+ "pipenv_package_requirements": "\n".join(pipenv_package_requirements),
226
+ "python_version": installed_python.getPythonVersion(),
227
+ },
228
+ compare_only=dry_run,
229
+ )
230
+
231
+ return changed_pipenv_file, pipenv_filename
232
+
233
+
184
234
  def _updatePipenvLockFile(
185
235
  installed_python, dry_run, pipenv_filename_full, no_pipenv_update
186
236
  ):
@@ -191,6 +241,17 @@ def _updatePipenvLockFile(
191
241
  % pipenv_filename_full
192
242
  )
193
243
 
244
+ check_call(
245
+ [
246
+ installed_python.getPythonExe(),
247
+ "-m",
248
+ "pipenv",
249
+ "install",
250
+ "--python",
251
+ installed_python.getPythonExe(),
252
+ ]
253
+ )
254
+
194
255
  elif not dry_run:
195
256
  watch_logger.info(
196
257
  "Working with pipenv file '%s' to update virtualenv, may take a while."
@@ -224,10 +285,31 @@ def _updatePipenvLockFile(
224
285
  ]
225
286
  )
226
287
 
288
+ return "Pipfile.lock"
289
+
290
+
291
+ def _updatePacmanLockFile():
292
+ pacman_lock_filename = "Pacman.lock"
293
+
294
+ pacman_output = executeToolChecked(
295
+ logger=watch_logger,
296
+ command=["pacman", "-Q"],
297
+ absence_message="needs pacman to query package status on MSYS2",
298
+ )
299
+
300
+ if str is not bytes:
301
+ pacman_output = pacman_output.decode("utf8")
302
+
303
+ changeTextFileContents(filename=pacman_lock_filename, contents=pacman_output)
304
+
305
+ return pacman_lock_filename
227
306
 
228
- def _compileCase(case_data, case_dir, installed_python):
229
- check_call(
230
- [
307
+
308
+ def _compileCase(case_data, case_dir, installed_python, lock_filename):
309
+ preferred_package_type = installed_python.getPreferredPackageType()
310
+
311
+ if preferred_package_type == "pip":
312
+ run_command = [
231
313
  installed_python.getPythonExe(),
232
314
  "-m",
233
315
  "pipenv",
@@ -235,14 +317,29 @@ def _compileCase(case_data, case_dir, installed_python):
235
317
  "--python",
236
318
  installed_python.getPythonExe(),
237
319
  "python",
238
- nuitka_binary,
239
- os.path.join(case_dir, case_data["filename"]),
240
- "--report=compilation-report.xml",
241
- "--report-diffable",
242
- "--report-user-provided=pipenv_hash=%s"
243
- % getFileContentsHash("Pipfile.lock"),
244
320
  ]
245
- )
321
+ extra_options = []
322
+ elif preferred_package_type == "pacman":
323
+ run_command = ["python"]
324
+
325
+ # TODO: Bug in MSYS2 ccache, avoid using that.
326
+ extra_options = ["--disable-ccache"]
327
+ else:
328
+ assert False
329
+
330
+ with withEnvironmentVarOverridden("NUITKA_LAUNCH_TOKEN", "1"):
331
+ check_call(
332
+ run_command
333
+ + [
334
+ nuitka_binary,
335
+ os.path.join(case_dir, case_data["filename"]),
336
+ "--report=compilation-report.xml",
337
+ "--report-diffable",
338
+ "--report-user-provided=pipenv_hash=%s"
339
+ % getFileContentsHash(lock_filename),
340
+ ]
341
+ + extra_options
342
+ )
246
343
 
247
344
  if case_data["interactive"] == "no":
248
345
  binaries = getFileList(
@@ -254,7 +351,7 @@ def _compileCase(case_data, case_dir, installed_python):
254
351
  if len(binaries) != 1:
255
352
  sys.exit("Error, failed to identify created binary.")
256
353
 
257
- stdout, stderr, exit_nuitka = executeProcess([binaries[0]])
354
+ stdout, stderr, exit_nuitka = executeProcess([binaries[0]], timeout=5 * 60)
258
355
 
259
356
  if exit_nuitka != 0:
260
357
  sys.exit(
@@ -268,40 +365,63 @@ def _compileCase(case_data, case_dir, installed_python):
268
365
 
269
366
 
270
367
  def _updateCase(
271
- case_dir, case_data, dry_run, no_pipenv_update, installed_python, result_path
368
+ case_dir,
369
+ case_data,
370
+ dry_run,
371
+ no_pipenv_update,
372
+ nuitka_update_mode,
373
+ installed_python,
374
+ result_path,
272
375
  ):
376
+ # Many details and cases due to package method being handled here.
377
+ # pylint: disable=too-many-branches,too-many-locals
378
+
273
379
  # Not good for dry run, but tough life.
274
380
  makePath(result_path)
275
381
 
276
382
  # Update the pipenv file in any case, ought to be stable but we follow
277
383
  # global changes this way.
278
- changed_pipenv_file, pipenv_filename = _updatePipenvFile(
279
- installed_python=installed_python,
280
- case_data=case_data,
281
- dry_run=dry_run,
282
- result_path=result_path,
283
- )
384
+ preferred_package_type = installed_python.getPreferredPackageType()
385
+ if preferred_package_type == "pip":
386
+ changed_pipenv_file, pipenv_filename = _updatePipenvFile(
387
+ installed_python=installed_python,
388
+ case_data=case_data,
389
+ dry_run=dry_run,
390
+ result_path=result_path,
391
+ )
284
392
 
285
- pipenv_filename_full = os.path.join(case_dir, pipenv_filename)
393
+ pipenv_filename_full = os.path.join(case_dir, pipenv_filename)
286
394
 
287
- if dry_run and changed_pipenv_file:
288
- watch_logger.info("Would create pipenv file '%s'." % pipenv_filename_full)
289
- return
395
+ if dry_run and changed_pipenv_file:
396
+ watch_logger.info("Would create pipenv file '%s'." % pipenv_filename_full)
397
+ return
290
398
 
291
- with withDirectoryChange(result_path):
292
- # Update or create lockfile of pipenv.
293
- _updatePipenvLockFile(
399
+ with withDirectoryChange(result_path):
400
+ # Update or create lockfile of pipenv.
401
+ lock_filename = _updatePipenvLockFile(
402
+ installed_python=installed_python,
403
+ dry_run=dry_run,
404
+ pipenv_filename_full=pipenv_filename_full,
405
+ no_pipenv_update=no_pipenv_update,
406
+ )
407
+ elif preferred_package_type == "pacman":
408
+ changed_pipenv_file, pipenv_filename = _updatePacmanFile(
294
409
  installed_python=installed_python,
410
+ case_data=case_data,
295
411
  dry_run=dry_run,
296
- pipenv_filename_full=pipenv_filename_full,
297
- no_pipenv_update=no_pipenv_update,
412
+ result_path=result_path,
298
413
  )
299
414
 
300
- # Check if compilation is required.
415
+ with withDirectoryChange(result_path):
416
+ # Update or create lockfile of pipenv.
417
+ lock_filename = _updatePacmanLockFile()
418
+
419
+ # Check if compilation is required.
420
+ with withDirectoryChange(result_path):
301
421
  if os.path.exists("compilation-report.xml"):
302
422
  old_report_root = fromFile("compilation-report.xml")
303
423
 
304
- existing_hash = getFileContentsHash("Pipfile.lock")
424
+ existing_hash = getFileContentsHash(lock_filename)
305
425
  old_report_root_hash = (
306
426
  old_report_root.find("user-data").find("pipenv_hash").text
307
427
  )
@@ -311,7 +431,9 @@ def _updateCase(
311
431
  if nuitka_update_mode == "force":
312
432
  need_compile = True
313
433
  elif nuitka_update_mode == "newer":
314
- if _compareNuitkaVersions(old_nuitka_version, nuitka_version):
434
+ if _compareNuitkaVersions(
435
+ old_nuitka_version, nuitka_version, consider_rc=True
436
+ ):
315
437
  need_compile = True
316
438
  else:
317
439
  if existing_hash != old_report_root_hash:
@@ -349,10 +471,11 @@ def _updateCase(
349
471
  case_data=case_data,
350
472
  case_dir=case_dir,
351
473
  installed_python=installed_python,
474
+ lock_filename=lock_filename,
352
475
  )
353
476
 
354
477
 
355
- def updateCase(case_dir, case_data, dry_run, no_pipenv_update):
478
+ def updateCase(case_dir, case_data, dry_run, no_pipenv_update, nuitka_update_mode):
356
479
  case_name = case_data["case"]
357
480
 
358
481
  # Wrong OS maybe.
@@ -364,13 +487,15 @@ def updateCase(case_dir, case_data, dry_run, no_pipenv_update):
364
487
 
365
488
  # Too old Nuitka version maybe.
366
489
  if nuitka_min_version is not None and _compareNuitkaVersions(
367
- nuitka_version, nuitka_min_version
490
+ nuitka_version, nuitka_min_version, consider_rc=False
368
491
  ):
369
492
  return
370
493
 
371
494
  # For all relevant Pythons applicable to this case.
372
495
  for installed_python in selectPythons(
373
- anaconda=case_data["anaconda"] == "yes",
496
+ # TODO: Enable Anaconda support through options/detection.
497
+ anaconda="Anaconda" in os_name,
498
+ msys2_mingw64="MSYS2" in os_name,
374
499
  python_version_req=case_data.get("python_version_req"),
375
500
  ):
376
501
  watch_logger.info("Consider with Python %s." % installed_python)
@@ -386,18 +511,20 @@ def updateCase(case_dir, case_data, dry_run, no_pipenv_update):
386
511
  case_data=case_data,
387
512
  dry_run=dry_run,
388
513
  no_pipenv_update=no_pipenv_update,
514
+ nuitka_update_mode=nuitka_update_mode,
389
515
  installed_python=installed_python,
390
516
  result_path=result_path,
391
517
  )
392
518
 
393
519
 
394
- def updateCases(case_dir, dry_run, no_pipenv_update):
520
+ def updateCases(case_dir, dry_run, no_pipenv_update, nuitka_update_mode):
395
521
  for case_data in parseYaml(getFileContents("case.yml", mode="rb")):
396
522
  updateCase(
397
523
  case_dir=case_dir,
398
524
  case_data=case_data,
399
525
  dry_run=dry_run,
400
526
  no_pipenv_update=no_pipenv_update,
527
+ nuitka_update_mode=nuitka_update_mode,
401
528
  )
402
529
 
403
530
 
@@ -415,15 +542,6 @@ def main():
415
542
 
416
543
  parser = OptionParser()
417
544
 
418
- parser.add_option(
419
- "--dry-run",
420
- action="store_false",
421
- dest="dry_run",
422
- default=False,
423
- help="""\
424
- Do not change anything, just report what would be done. Default %default.""",
425
- )
426
-
427
545
  parser.add_option(
428
546
  "--python-version",
429
547
  action="append",
@@ -451,6 +569,25 @@ Nuitka binary to compile with. Defaults to one near the nuitka-watch usage.""",
451
569
  Do not update the pipenv environment. Best to see only effect of Nuitka update. Default %default.""",
452
570
  )
453
571
 
572
+ parser.add_option(
573
+ "--dry-run",
574
+ action="store_false",
575
+ dest="dry_run",
576
+ default=False,
577
+ help="""\
578
+ Do not change anything, just report what would be done. Not yet perfectly true. Default %default.""",
579
+ )
580
+
581
+ parser.add_option(
582
+ "--nuitka-update-mode",
583
+ action="store",
584
+ choices=("newer", "force", "never"),
585
+ dest="nuitka_update_mode",
586
+ default="newer",
587
+ help="""\
588
+ Recompile even if the versions seems not changed. Default %default.""",
589
+ )
590
+
454
591
  options, positional_args = parser.parse_args()
455
592
 
456
593
  assert len(positional_args) <= 1, positional_args
@@ -490,6 +627,7 @@ Do not update the pipenv environment. Best to see only effect of Nuitka update.
490
627
  os.path.dirname(case_filename),
491
628
  dry_run=options.dry_run,
492
629
  no_pipenv_update=options.no_pipenv_update,
630
+ nuitka_update_mode=options.nuitka_update_mode,
493
631
  )
494
632
 
495
633
 
nuitka/tree/Building.py CHANGED
@@ -824,7 +824,10 @@ def buildParseTree(provider, ast_tree, source_ref, is_module, is_main):
824
824
  statements.append(
825
825
  StatementExpressionOnly(
826
826
  expression=makeExpressionImportModuleFixed(
827
- module_name="site", source_ref=source_ref
827
+ using_module_name=provider.getParentModule().getFullName(),
828
+ module_name="site",
829
+ value_name="site",
830
+ source_ref=source_ref,
828
831
  ),
829
832
  source_ref=source_ref,
830
833
  )
@@ -837,7 +840,10 @@ def buildParseTree(provider, ast_tree, source_ref, is_module, is_main):
837
840
  statements.append(
838
841
  StatementExpressionOnly(
839
842
  expression=makeExpressionImportModuleFixed(
840
- module_name=path_imported_name, source_ref=source_ref
843
+ using_module_name=provider.getParentModule().getFullName(),
844
+ module_name=path_imported_name,
845
+ value_name=path_imported_name.getTopLevelPackageName(),
846
+ source_ref=source_ref,
841
847
  ),
842
848
  source_ref=source_ref,
843
849
  )