Nuitka-winsvc 1.9.2__cp312-cp312-win_amd64.whl → 1.9.5__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 (38) hide show
  1. {Nuitka_winsvc-1.9.2.dist-info → Nuitka_winsvc-1.9.5.dist-info}/METADATA +1 -1
  2. {Nuitka_winsvc-1.9.2.dist-info → Nuitka_winsvc-1.9.5.dist-info}/RECORD +38 -38
  3. nuitka/MainControl.py +4 -4
  4. nuitka/PythonFlavors.py +13 -0
  5. nuitka/PythonVersions.py +0 -1
  6. nuitka/Version.py +1 -1
  7. nuitka/build/Backend.scons +9 -2
  8. nuitka/build/Onefile.scons +0 -8
  9. nuitka/build/SconsCompilerSettings.py +3 -0
  10. nuitka/build/SconsUtils.py +21 -11
  11. nuitka/build/static_src/HelpersDictionariesGenerated.c +1 -1
  12. nuitka/build/static_src/MainProgram.c +24 -1
  13. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +11 -0
  14. nuitka/code_generation/ImportCodes.py +4 -2
  15. nuitka/code_generation/templates/CodeTemplatesModules.py +15 -1
  16. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +1 -1
  17. nuitka/distutils/DistutilCommands.py +3 -1
  18. nuitka/freezer/DllDependenciesPosix.py +8 -1
  19. nuitka/nodes/PackageMetadataNodes.py +20 -9
  20. nuitka/plugins/PluginBase.py +4 -9
  21. nuitka/plugins/standard/AntiBloatPlugin.py +7 -6
  22. nuitka/plugins/standard/DillPlugin.py +1 -22
  23. nuitka/plugins/standard/DllFilesPlugin.py +2 -0
  24. nuitka/plugins/standard/ImplicitImports.py +20 -16
  25. nuitka/plugins/standard/OptionsNannyPlugin.py +1 -1
  26. nuitka/plugins/standard/standard.nuitka-package.config.yml +118 -9
  27. nuitka/reports/Reports.py +15 -0
  28. nuitka/utils/Distributions.py +26 -17
  29. nuitka/utils/FileOperations.py +19 -0
  30. nuitka/utils/ModuleNames.py +7 -0
  31. nuitka/utils/Utils.py +8 -0
  32. nuitka/utils/WindowsResources.py +6 -1
  33. {Nuitka_winsvc-1.9.2.data → Nuitka_winsvc-1.9.5.data}/scripts/nuitka-run.bat +0 -0
  34. {Nuitka_winsvc-1.9.2.data → Nuitka_winsvc-1.9.5.data}/scripts/nuitka.bat +0 -0
  35. {Nuitka_winsvc-1.9.2.dist-info → Nuitka_winsvc-1.9.5.dist-info}/LICENSE.txt +0 -0
  36. {Nuitka_winsvc-1.9.2.dist-info → Nuitka_winsvc-1.9.5.dist-info}/WHEEL +0 -0
  37. {Nuitka_winsvc-1.9.2.dist-info → Nuitka_winsvc-1.9.5.dist-info}/entry_points.txt +0 -0
  38. {Nuitka_winsvc-1.9.2.dist-info → Nuitka_winsvc-1.9.5.dist-info}/top_level.txt +0 -0
@@ -75,11 +75,20 @@ class ExpressionPkgResourcesRequireCall(ExpressionPkgResourcesRequireCallBase):
75
75
  kind = "EXPRESSION_PKG_RESOURCES_REQUIRE_CALL"
76
76
 
77
77
  def replaceWithCompileTimeValue(self, trace_collection):
78
- require = _getPkgResourcesModule().require
79
- ResolutionError = _getPkgResourcesModule().ResolutionError
80
- InvalidRequirement = (
81
- _getPkgResourcesModule().extern.packaging.requirements.InvalidRequirement
82
- )
78
+ resources_module = _getPkgResourcesModule()
79
+
80
+ require = resources_module.require
81
+ ResolutionError = resources_module.ResolutionError
82
+
83
+ try:
84
+ InvalidRequirement = (
85
+ resources_module.extern.packaging.requirements.InvalidRequirement
86
+ )
87
+ except AttributeError:
88
+ # Debian removes "extern.packaging" in some versions
89
+ import packaging
90
+
91
+ InvalidRequirement = packaging.requirements.InvalidRequirement
83
92
 
84
93
  args = tuple(
85
94
  element.getCompileTimeConstant() for element in self.subnode_requirements
@@ -135,8 +144,9 @@ class ExpressionPkgResourcesGetDistributionCall(
135
144
  kind = "EXPRESSION_PKG_RESOURCES_GET_DISTRIBUTION_CALL"
136
145
 
137
146
  def replaceWithCompileTimeValue(self, trace_collection):
138
- get_distribution = _getPkgResourcesModule().get_distribution
139
- DistributionNotFound = _getPkgResourcesModule().DistributionNotFound
147
+ pkg_resources_module = _getPkgResourcesModule()
148
+ get_distribution = pkg_resources_module.get_distribution
149
+ DistributionNotFound = pkg_resources_module.DistributionNotFound
140
150
 
141
151
  arg = self.subnode_dist.getCompileTimeConstant()
142
152
 
@@ -363,8 +373,9 @@ class ExpressionPkgResourcesIterEntryPointsCall(
363
373
  kind = "EXPRESSION_PKG_RESOURCES_ITER_ENTRY_POINTS_CALL"
364
374
 
365
375
  def replaceWithCompileTimeValue(self, trace_collection):
366
- iter_entry_points = _getPkgResourcesModule().iter_entry_points
367
- DistributionNotFound = _getPkgResourcesModule().DistributionNotFound
376
+ pkg_resources_module = _getPkgResourcesModule()
377
+ iter_entry_points = pkg_resources_module.iter_entry_points
378
+ DistributionNotFound = pkg_resources_module.DistributionNotFound
368
379
 
369
380
  group = self.subnode_group.getCompileTimeConstant()
370
381
  if self.subnode_name is not None:
@@ -1211,18 +1211,13 @@ except ImportError:
1211
1211
  "no_annotations": hasPythonFlagNoAnnotations(),
1212
1212
  # Querying package properties
1213
1213
  "has_builtin_module": isBuiltinModuleName,
1214
+ # Architectures
1215
+ "arch_x86": getArchitecture() == "x86",
1216
+ "arch_amd64": getArchitecture() == "x86_64",
1217
+ "arch_arm64": getArchitecture() == "arm64",
1214
1218
  }
1215
1219
  )
1216
1220
 
1217
- if isWin32Windows():
1218
- context.update(
1219
- {
1220
- "arch_x86": getArchitecture() == "x86",
1221
- "arch_amd64": getArchitecture() == "x86_64",
1222
- "arch_arm64": getArchitecture() == "arm64",
1223
- }
1224
- )
1225
-
1226
1221
  versions = getTestExecutionPythonVersions()
1227
1222
 
1228
1223
  for version in versions:
@@ -603,13 +603,14 @@ Error, cannot eval module '%s' function '%s' replacement code '%s' in '%s' due t
603
603
  return
604
604
 
605
605
  if module_name.hasNamespace(handled_module_name):
606
- override_mode = self._getModuleBloatModeOverrides(
607
- using_module_name=using_module_name,
608
- intended_module_name=intended_module_name,
609
- )
606
+ if using_module_name is not None:
607
+ override_mode = self._getModuleBloatModeOverrides(
608
+ using_module_name=using_module_name,
609
+ intended_module_name=intended_module_name,
610
+ )
610
611
 
611
- if override_mode is not None:
612
- mode = override_mode
612
+ if override_mode is not None:
613
+ mode = override_mode
613
614
 
614
615
  # Make sure the compilation aborts or warns if asked to
615
616
  if mode == "error":
@@ -48,25 +48,4 @@ Extending "dill" for compiled types to be pickle-able as well.""",
48
48
  return {"_NUITKA_PLUGIN_DILL_ENABLED": "1"}
49
49
 
50
50
  def getExtraCodeFiles(self):
51
- return {"DillPlugin.c": extra_code}
52
-
53
-
54
- extra_code = r"""
55
- #include "nuitka/prelude.h"
56
-
57
- void registerDillPluginTables(PyThreadState *tstate, char const *module_name, PyMethodDef *reduce_compiled_function, PyMethodDef *create_compiled_function) {
58
- PyObject *function_tables = PyObject_GetAttrString((PyObject *)builtin_module, "compiled_function_tables");
59
-
60
- if (function_tables == NULL) {
61
- CLEAR_ERROR_OCCURRED(tstate);
62
-
63
- function_tables = MAKE_DICT_EMPTY();
64
- PyObject_SetAttrString((PyObject *)builtin_module, "compiled_function_tables", function_tables);
65
- }
66
-
67
- PyObject *funcs = MAKE_TUPLE2_0(PyCFunction_New(reduce_compiled_function, NULL), PyCFunction_New(create_compiled_function, NULL));
68
-
69
- PyDict_SetItemString(function_tables, module_name, funcs);
70
- }
71
-
72
- """
51
+ return {"DillPlugin.c": self.getPluginDataFileContents("DillPlugin.c")}
@@ -87,6 +87,8 @@ class NuitkaPluginDllFiles(NuitkaPluginBase):
87
87
  exe = dll_config.get("executable", "no") == "yes"
88
88
 
89
89
  suffixes = dll_config.get("suffixes")
90
+ if suffixes is not None:
91
+ suffixes = tuple(suffix.lstrip(".") for suffix in suffixes)
90
92
 
91
93
  for prefix in dll_config.get("prefixes"):
92
94
  if exe:
@@ -395,22 +395,25 @@ __file__ = (__nuitka_binary_dir + '%ssite.py') if '__nuitka_binary_dir' in dict(
395
395
 
396
396
  # Inline the values, to avoid the data files.
397
397
  if result is not None:
398
- source_code = source_code.replace(
399
- attach_call,
400
- attach_call_replacement
401
- % {
402
- "module_name": module_name.asString(),
403
- "submodules": tuple(
404
- module_name.asString() for module_name in result[0]
405
- ),
406
- "attrs": dict(
407
- (module_name.asString(), module_attributes)
408
- for (module_name, module_attributes) in sorted(
409
- result[1].items()
410
- )
411
- ),
412
- },
413
- )
398
+ replacement = attach_call_replacement % {
399
+ "module_name": module_name.asString(),
400
+ "submodules": tuple(
401
+ sub_module_name.asString() for sub_module_name in result[0]
402
+ ),
403
+ "attrs": dict(
404
+ (
405
+ sub_module_name.getChildNameFromPackage(
406
+ module_name
407
+ ).asString(),
408
+ module_attributes,
409
+ )
410
+ for (sub_module_name, module_attributes) in sorted(
411
+ result[1].items()
412
+ )
413
+ ),
414
+ }
415
+
416
+ source_code = source_code.replace(attach_call, replacement)
414
417
 
415
418
  if module_name == "huggingface_hub":
416
419
  # Special handling for huggingface that uses the source code variant
@@ -594,6 +597,7 @@ __file__ = (__nuitka_binary_dir + '%ssite.py') if '__nuitka_binary_dir' in dict(
594
597
  "transformers.utils.dummy_pt_objects", # Not performance relevant.
595
598
  "transformers.utils.dummy_flax_objects", # Not performance relevant.
596
599
  "transformers.utils.dummy_tf_objects", # Not performance relevant.
600
+ "rich", # # Not performance relevant and memory leaking due to empty compiled cell leaks
597
601
  )
598
602
 
599
603
  def decideCompilation(self, module_name):
@@ -103,7 +103,7 @@ Otherwise a terminal window will open"""
103
103
 
104
104
  self.info(
105
105
  """\
106
- Note, when using '%s', consider using '--disable-console' option. %s. However\
106
+ Note, when using '%s', consider using '--disable-console' option. %s. However \
107
107
  for debugging, terminal output is the easiest way to see informative traceback \
108
108
  and error information, so delay this until your program working and remove \
109
109
  once you find it non-working, and use '--enable-console' to make it explicit \
@@ -326,6 +326,57 @@
326
326
  change_function:
327
327
  'test': 'un-callable'
328
328
 
329
+ - module-name: 'bitsandbytes.cextension'
330
+ dlls:
331
+ - from_filenames:
332
+ prefixes:
333
+ - 'libbitsandbytes_'
334
+ suffixes:
335
+ # Applies currently to all OSes in bitsandbytes wheels.
336
+ - 'so'
337
+
338
+ - module-name: 'bitsandbytes.triton.dequantize_rowwise'
339
+ anti-bloat:
340
+ - description: 'remove setuptools usage via triton'
341
+ replacements_plain:
342
+ 'is_triton_available()': 'False'
343
+ when: 'not use_setuptools'
344
+
345
+ - module-name: 'bitsandbytes.triton.int8_matmul_mixed_dequanitze'
346
+ anti-bloat:
347
+ - description: 'remove setuptools usage via triton'
348
+ replacements_plain:
349
+ 'is_triton_available()': 'False'
350
+ when: 'not use_setuptools'
351
+
352
+ - module-name: 'bitsandbytes.triton.int8_matmul_rowwise_dequantize'
353
+ anti-bloat:
354
+ - description: 'remove setuptools usage via triton'
355
+ replacements_plain:
356
+ 'is_triton_available()': 'False'
357
+ when: 'not use_setuptools'
358
+
359
+ - module-name: 'bitsandbytes.triton.quantize_columnwise_and_transpose'
360
+ anti-bloat:
361
+ - description: 'remove setuptools usage via triton'
362
+ replacements_plain:
363
+ 'is_triton_available()': 'False'
364
+ when: 'not use_setuptools'
365
+
366
+ - module-name: 'bitsandbytes.triton.quantize_global'
367
+ anti-bloat:
368
+ - description: 'remove setuptools usage via triton'
369
+ replacements_plain:
370
+ 'is_triton_available()': 'False'
371
+ when: 'not use_setuptools'
372
+
373
+ - module-name: 'bitsandbytes.triton.quantize_rowwise'
374
+ anti-bloat:
375
+ - description: 'remove setuptools usage via triton'
376
+ replacements_plain:
377
+ 'is_triton_available()': 'False'
378
+ when: 'not use_setuptools'
379
+
329
380
  - module-name: 'boto3'
330
381
  data-files:
331
382
  dirs:
@@ -508,6 +559,7 @@
508
559
  implicit-imports:
509
560
  - depends:
510
561
  - 'chromadb.telemetry.posthog'
562
+ - 'chromadb.telemetry.product.posthog'
511
563
  - 'chromadb.api.local'
512
564
  - 'chromadb.db.duckdb'
513
565
  - 'chromadb.db.impl.sqlite'
@@ -518,6 +570,7 @@
518
570
  - 'chromadb.migrations.embeddings_queue'
519
571
  - 'chromadb.migrations.sysdb'
520
572
  - 'chromadb.migrations.metadb'
573
+ - 'chromadb.ingest.impl.simple_policy'
521
574
 
522
575
  - module-name: 'chromadb.migrations.embeddings_queue'
523
576
  data-files:
@@ -769,7 +822,7 @@
769
822
  relative_path: 'OSX64'
770
823
  prefixes:
771
824
  - 'libDelphiFMX'
772
- when: 'macos and arch_x86'
825
+ when: 'macos and arch_amd64'
773
826
  - from_filenames:
774
827
  relative_path: 'OSXARM64'
775
828
  prefixes:
@@ -798,6 +851,13 @@
798
851
  replacements_plain:
799
852
  'from .testing import setup_test': ''
800
853
 
854
+ - module-name: 'distributed.client'
855
+ anti-bloat:
856
+ - description: 'remove IPython reference'
857
+ no-auto-follow:
858
+ 'IPython': 'ignore'
859
+ when: 'not use_ipython'
860
+
801
861
  - module-name: 'distributed.config'
802
862
  data-files:
803
863
  patterns:
@@ -810,6 +870,13 @@
810
870
  'from IPython.display import display': 'raise ImportError'
811
871
  when: 'not use_ipython'
812
872
 
873
+ - module-name: 'distributed.diagnostics.progressbar'
874
+ anti-bloat:
875
+ - description: 'remove IPython reference'
876
+ no-auto-follow:
877
+ 'IPython': 'ignore'
878
+ when: 'not use_ipython'
879
+
813
880
  - module-name: 'distributed.scheduler'
814
881
  anti-bloat:
815
882
  - description: 'remove cython support'
@@ -818,6 +885,13 @@
818
885
  'from cython import compiled': 'raise ImportError'
819
886
  'if compiled:': 'if False:'
820
887
 
888
+ - module-name: 'distributed.utils'
889
+ anti-bloat:
890
+ - description: 'remove IPython reference'
891
+ change_function:
892
+ 'is_kernel': "'(lambda : False)'"
893
+ when: 'not use_ipython'
894
+
821
895
  - module-name: 'dns.rdtypes'
822
896
  implicit-imports:
823
897
  - depends:
@@ -1433,6 +1507,8 @@
1433
1507
  - description: 'workaround for forking itself'
1434
1508
  replacements_plain:
1435
1509
  "getattr(sys, 'frozen', False)": 'False'
1510
+ 'getattr(sys, "frozen", False)': 'False'
1511
+ 'assert is_forking(sys.argv), "Not forking"': ''
1436
1512
  when: 'win32'
1437
1513
 
1438
1514
  - module-name: 'joblib.externals.loky.backend.resource_tracker'
@@ -1546,6 +1622,12 @@
1546
1622
  patterns:
1547
1623
  - 'intervals.msgpack'
1548
1624
 
1625
+ - module-name: 'libusb_package'
1626
+ dlls:
1627
+ - from_filenames:
1628
+ prefixes:
1629
+ - 'libusb'
1630
+
1549
1631
  - module-name: 'lightgbm.libpath'
1550
1632
  dlls:
1551
1633
  - from_filenames:
@@ -2787,6 +2869,14 @@
2787
2869
  - description: 'workaround __new__ decorator issue'
2788
2870
  append_plain: 'SharedRegistryObject.__new__ = staticmethod(SharedRegistryObject.__new__)'
2789
2871
 
2872
+ - module-name: 'pip._vendor.rich.jupyter'
2873
+ # See rich.jupyter
2874
+ anti-bloat:
2875
+ - description: 'remove IPython reference'
2876
+ change_function:
2877
+ 'display': 'un-callable'
2878
+ when: 'not use_ipython'
2879
+
2790
2880
  - module-name: 'pkg_resources'
2791
2881
  anti-bloat:
2792
2882
  - description: 'avoid using plistlib dependency on non-macOS'
@@ -3141,6 +3231,10 @@
3141
3231
  macos_bundle_as_onefile: 'yes'
3142
3232
  when: 'macos and use_pyqt5'
3143
3233
 
3234
+ import-hacks:
3235
+ - acceptable-missing-dlls:
3236
+ - 'libqpdf'
3237
+
3144
3238
  - module-name: 'PyQt6'
3145
3239
  options:
3146
3240
  checks:
@@ -3335,7 +3429,19 @@
3335
3429
  from PySide6 import QtCore
3336
3430
  orig_disconnect = QtCore.SignalInstance.disconnect
3337
3431
  QtCore.SignalInstance.disconnect = patched_disconnect
3338
- when: 'version("PySide6") < (6,6)'
3432
+
3433
+ def patched_connect(self, receiver, type=None):
3434
+ type = type or QtCore.Qt.ConnectionType.AutoConnection
3435
+ if hasattr(receiver, "im_func"):
3436
+ if hasattr(receiver.im_func, "__compiled__"):
3437
+ patched_connect._protected = getattr(patched_connect, "_protected", [])
3438
+ patched_connect._protected.append(receiver)
3439
+
3440
+ return orig_connect(self, receiver, type)
3441
+
3442
+ from PySide6 import QtCore
3443
+ orig_connect = QtCore.SignalInstance.connect
3444
+ QtCore.SignalInstance.connect = patched_connect
3339
3445
 
3340
3446
  options:
3341
3447
  checks:
@@ -4150,6 +4256,13 @@
4150
4256
  - 'skimage.restoration._unwrap_2d'
4151
4257
  - 'skimage.restoration._unwrap_3d'
4152
4258
 
4259
+ - module-name: 'skimage.restoration._cycle_spin'
4260
+ anti-bloat:
4261
+ - description: 'remove optional dask usage'
4262
+ replacements_plain:
4263
+ 'import dask': 'raise ImportError'
4264
+ when: 'not use_dask'
4265
+
4153
4266
  - module-name: 'skimage.segmentation'
4154
4267
  implicit-imports:
4155
4268
  - depends:
@@ -4858,15 +4971,11 @@
4858
4971
  dirs:
4859
4972
  - 'static'
4860
4973
 
4861
- - module-name: 'streamlit.delta_generator'
4974
+ - module-name: 'streamlit.runtime.caching.cache_utils'
4862
4975
  anti-bloat:
4863
- - description: 'remove IPython reference'
4976
+ - description: 'remove warning for compiled functions'
4864
4977
  replacements_plain:
4865
- 'from streamlit.elements.legacy_altair import LegacyAltairMixin': ''
4866
- 'LegacyAltairMixin,': ''
4867
- 'from streamlit.elements.arrow_altair import ArrowAltairMixin': ''
4868
- 'ArrowAltairMixin,': ''
4869
- when: 'not use_ipython'
4978
+ '_LOGGER.debug(': '('
4870
4979
 
4871
4980
  - module-name: 'sv_ttk'
4872
4981
  data-files:
nuitka/reports/Reports.py CHANGED
@@ -44,8 +44,10 @@ from nuitka.Options import (
44
44
  getCompilationReportFilename,
45
45
  getCompilationReportTemplates,
46
46
  getCompilationReportUserData,
47
+ isOnefileMode,
47
48
  shallCreateDiffableCompilationReport,
48
49
  )
50
+ from nuitka.OutputDirectories import getResultRunFilename
49
51
  from nuitka.plugins.Plugins import getActivePlugins
50
52
  from nuitka.PythonFlavors import getPythonFlavorName
51
53
  from nuitka.PythonVersions import getSystemPrefixPath, python_version_full_str
@@ -169,6 +171,9 @@ def _getReportInputData(aborted):
169
171
  if _decision is not False:
170
172
  continue
171
173
 
174
+ if _using_module_name is None:
175
+ continue
176
+
172
177
  module_exclusions[_using_module_name][_module_name] = _reason
173
178
 
174
179
  memory_infos = getMemoryInfos()
@@ -191,6 +196,8 @@ def _getReportInputData(aborted):
191
196
 
192
197
  data_composer = getDataComposerReportValues()
193
198
 
199
+ output_run_filename = os.path.abspath(getResultRunFilename(onefile=isOnefileMode()))
200
+
194
201
  return dict(
195
202
  (var_name, var_value)
196
203
  for var_name, var_value in locals().items()
@@ -566,6 +573,14 @@ def writeCompilationReport(report_filename, report_input_data, diffable):
566
573
 
567
574
  _addUserDataToReport(root=root, user_data=report_input_data["user_data"])
568
575
 
576
+ python_xml_node = TreeXML.appendTreeElement(
577
+ root,
578
+ "output",
579
+ run_filename=_getCompilationReportPath(
580
+ report_input_data["output_run_filename"]
581
+ ),
582
+ )
583
+
569
584
  try:
570
585
  putTextFileContents(
571
586
  filename=report_filename, contents=TreeXML.toString(root), encoding="utf8"
@@ -19,6 +19,7 @@
19
19
 
20
20
  import os
21
21
 
22
+ from nuitka.__past__ import unicode
22
23
  from nuitka.containers.OrderedSets import OrderedSet
23
24
  from nuitka.Options import isExperimental
24
25
  from nuitka.PythonFlavors import isAnacondaPython
@@ -27,7 +28,7 @@ from nuitka.PythonVersions import python_version
27
28
  from .FileOperations import searchPrefixPath
28
29
  from .Importing import getModuleNameAndKindFromFilenameSuffix
29
30
  from .ModuleNames import ModuleName, checkModuleName
30
- from .Utils import isLinux
31
+ from .Utils import isMacOS, isWin32Windows
31
32
 
32
33
  _package_to_distribution = None
33
34
 
@@ -81,6 +82,8 @@ def getDistributionTopLevelPackageNames(distribution):
81
82
  continue
82
83
  if first_path_element == "__pycache__":
83
84
  continue
85
+ if not checkModuleName(first_path_element) or first_path_element == ".":
86
+ continue
84
87
 
85
88
  if remainder:
86
89
  module_name = ModuleName(first_path_element)
@@ -215,6 +218,8 @@ def getDistributionFromModuleName(module_name):
215
218
 
216
219
  def getDistribution(distribution_name):
217
220
  """Get a distribution by name."""
221
+ assert isValidDistributionName(distribution_name), distribution_name
222
+
218
223
  try:
219
224
  if isExperimental("force-pkg-resources-metadata"):
220
225
  raise ImportError
@@ -254,21 +259,18 @@ def isDistributionPipPackage(distribution_name):
254
259
  return getDistributionInstallerName(distribution_name) == "pip"
255
260
 
256
261
 
257
- def isDistributionSystemPackage(distribution_name):
258
- result = not isDistributionPipPackage(
259
- distribution_name
260
- ) and not isDistributionCondaPackage(distribution_name)
261
-
262
- # This should only ever happen on Linux, lets know when it does happen
263
- # elsewhere, since that is most probably a bug in our installer detection on
264
- # non-Linux as well.
265
- if result:
266
- assert isLinux(), (
267
- distribution_name,
268
- getDistributionInstallerName(distribution_name),
269
- )
262
+ def isDistributionPoetryPackage(distribution_name):
263
+ return getDistributionInstallerName(distribution_name).startswith("poetry")
270
264
 
271
- return result
265
+
266
+ def isDistributionSystemPackage(distribution_name):
267
+ return (
268
+ not isMacOS()
269
+ and not isWin32Windows()
270
+ and not isDistributionPipPackage(distribution_name)
271
+ and not isDistributionPoetryPackage(distribution_name)
272
+ and not isDistributionCondaPackage(distribution_name)
273
+ )
272
274
 
273
275
 
274
276
  _pdm_dir_cache = {}
@@ -338,6 +340,10 @@ def getDistributionInstallerName(distribution_name):
338
340
  return _distribution_to_installer[distribution_name]
339
341
 
340
342
 
343
+ def isValidDistributionName(distribution_name):
344
+ return type(distribution_name) in (str, unicode)
345
+
346
+
341
347
  def getDistributionName(distribution):
342
348
  """Get the distribution name from a distribution object.
343
349
 
@@ -347,9 +353,12 @@ def getDistributionName(distribution):
347
353
  """
348
354
 
349
355
  if hasattr(distribution, "metadata"):
350
- return distribution.metadata["Name"]
356
+ result = distribution.metadata["Name"]
351
357
  else:
352
- return distribution.project_name
358
+ result = distribution.project_name
359
+
360
+ assert isValidDistributionName(result), distribution
361
+ return result
353
362
 
354
363
 
355
364
  def getDistributionVersion(distribution):
@@ -33,6 +33,7 @@ import stat
33
33
  import sys
34
34
  import tempfile
35
35
  import time
36
+ import unicodedata
36
37
  from contextlib import contextmanager
37
38
 
38
39
  from nuitka.__past__ import ( # pylint: disable=redefined-builtin
@@ -1053,6 +1054,10 @@ def isFilenameBelowPath(path, filename, consider_short=True):
1053
1054
  filename = getExternalUsePath(filename)
1054
1055
  path = getExternalUsePath(path)
1055
1056
 
1057
+ if isWin32Windows():
1058
+ if getWindowsDrive(path) != getWindowsDrive(filename):
1059
+ return False
1060
+
1056
1061
  result = os.path.relpath(filename, path).split(os.path.sep)[0] != ".."
1057
1062
 
1058
1063
  return result
@@ -1382,3 +1387,17 @@ def syncFileOutput(file_handle):
1382
1387
  except AttributeError:
1383
1388
  # Too old to have "syncfs" available.
1384
1389
  return
1390
+
1391
+
1392
+ def isFilesystemEncodable(filename):
1393
+ """Decide if a filename is safe for use as a file system path with tools."""
1394
+ if os.name == "nt":
1395
+ value = (
1396
+ unicodedata.normalize("NFKD", filename)
1397
+ .encode("ascii", "ignore")
1398
+ .decode("ascii")
1399
+ )
1400
+
1401
+ return value == filename
1402
+ else:
1403
+ return True
@@ -225,6 +225,13 @@ class ModuleName(str):
225
225
  else:
226
226
  return ModuleName(parent_new)
227
227
 
228
+ def getChildNameFromPackage(self, package_name):
229
+ """Get child a module name part for a name in the package."""
230
+ assert self.hasNamespace(package_name)
231
+
232
+ submodule_name_str = str(self)[len(str(package_name)) + 1 :]
233
+ return ModuleName(submodule_name_str)
234
+
228
235
  def matchesToShellPattern(self, pattern):
229
236
  """Match a module name to a list of patterns
230
237
 
nuitka/utils/Utils.py CHANGED
@@ -101,6 +101,8 @@ def getLinuxDistribution():
101
101
 
102
102
  if os.path.exists("/etc/os-release"):
103
103
  result, base, version = _parseOsReleaseFileContents("/etc/os-release")
104
+ elif os.path.exists("/usr/lib/os-release"):
105
+ result, base, version = _parseOsReleaseFileContents("/usr/lib/os-release")
104
106
  elif os.path.exists("/etc/SuSE-release"):
105
107
  result, base, version = _parseOsReleaseFileContents("/etc/SuSE-release")
106
108
  elif os.path.exists("/etc/issue"):
@@ -157,6 +159,12 @@ def isFedoraBasedLinux():
157
159
  return (base or dist_name) == "Fedora"
158
160
 
159
161
 
162
+ def isArchBasedLinux():
163
+ dist_name, base, _dist_version = getLinuxDistribution()
164
+
165
+ return (base or dist_name) == "Arch"
166
+
167
+
160
168
  def isAndroidBasedLinux():
161
169
  # spell-checker: ignore googlesource
162
170
  if not isLinux():
@@ -351,7 +351,7 @@ def getDefaultWindowsExecutableManifest():
351
351
  # Note: Supported OS are lied about by CPython.
352
352
  template = (
353
353
  """\
354
- <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
354
+ <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
355
355
  <assemblyIdentity type="win32" name="Mini" version="1.0.0.0"/>
356
356
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
357
357
  <application>
@@ -362,6 +362,11 @@ def getDefaultWindowsExecutableManifest():
362
362
  <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
363
363
  </application>
364
364
  </compatibility>
365
+ <asmv3:application>
366
+ <asmv3:windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
367
+ <ws2:longPathAware>true</ws2:longPathAware>
368
+ </asmv3:windowsSettings>
369
+ </asmv3:application>
365
370
  %s
366
371
  </assembly>
367
372
  """