splash.py 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. # -----------------------------------------------------------------------------
  2. # Copyright (c) 2005-2023, PyInstaller Development Team.
  3. #
  4. # Distributed under the terms of the GNU General Public License (version 2
  5. # or later) with exception for distributing the bootloader.
  6. #
  7. # The full license is in the file COPYING.txt, distributed with this software.
  8. #
  9. # SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
  10. # -----------------------------------------------------------------------------
  11. import io
  12. import os
  13. import re
  14. import struct
  15. import pathlib
  16. from PyInstaller import log as logging
  17. from PyInstaller.archive.writers import SplashWriter
  18. from PyInstaller.building import splash_templates
  19. from PyInstaller.building.datastruct import Target
  20. from PyInstaller.building.utils import _check_guts_eq, _check_guts_toc, misc
  21. from PyInstaller.compat import is_aix, is_darwin
  22. from PyInstaller.depend import bindepend
  23. logger = logging.getLogger(__name__)
  24. class Splash(Target):
  25. """
  26. Bundles the required resources for the splash screen into a file, which will be included in the CArchive.
  27. A Splash has two outputs, one is itself and one is stored in splash.binaries. Both need to be passed to other
  28. build targets in order to enable the splash screen.
  29. """
  30. def __init__(self, image_file, binaries, datas, **kwargs):
  31. """
  32. :param str image_file:
  33. A path-like object to the image to be used. Only the PNG file format is supported.
  34. .. note:: If a different file format is supplied and PIL (Pillow) is installed, the file will be converted
  35. automatically.
  36. .. note:: *Windows*: The color ``'magenta'`` / ``'#ff00ff'`` must not be used in the image or text, as it is
  37. used by splash screen to indicate transparent areas. Use a similar color (e.g., ``'#ff00fe'``) instead.
  38. .. note:: If PIL (Pillow) is installed and the image is bigger than max_img_size, the image will be resized
  39. to fit into the specified area.
  40. :param list binaries:
  41. The TOC list of binaries the Analysis build target found. This TOC includes all extension modules and their
  42. binary dependencies. This is required to determine whether the user's program uses `tkinter`.
  43. :param list datas:
  44. The TOC list of data the Analysis build target found. This TOC includes all data-file dependencies of the
  45. modules. This is required to check if all splash screen requirements can be bundled.
  46. :keyword text_pos:
  47. An optional two-integer tuple that represents the origin of the text on the splash screen image. The
  48. origin of the text is its lower left corner. A unit in the respective coordinate system is a pixel of the
  49. image, its origin lies in the top left corner of the image. This parameter also acts like a switch for
  50. the text feature. If omitted, no text will be displayed on the splash screen. This text will be used to
  51. show textual progress in onefile mode.
  52. :type text_pos: Tuple[int, int]
  53. :keyword text_size:
  54. The desired size of the font. If the size argument is a positive number, it is interpreted as a size in
  55. points. If size is a negative number, its absolute value is interpreted as a size in pixels. Default: ``12``
  56. :type text_size: int
  57. :keyword text_font:
  58. An optional name of a font for the text. This font must be installed on the user system, otherwise the
  59. system default font is used. If this parameter is omitted, the default font is also used.
  60. :keyword text_color:
  61. An optional color for the text. HTML color codes (``'#40e0d0'``) and color names (``'turquoise'``) are
  62. supported. Default: ``'black'``
  63. (Windows: the color ``'magenta'`` / ``'#ff00ff'`` is used to indicate transparency, and should not be used)
  64. :type text_color: str
  65. :keyword text_default:
  66. The default text which will be displayed before the extraction starts. Default: ``"Initializing"``
  67. :type text_default: str
  68. :keyword full_tk:
  69. By default Splash bundles only the necessary files for the splash screen (some tk components). This
  70. options enables adding full tk and making it a requirement, meaning all tk files will be unpacked before
  71. the splash screen can be started. This is useful during development of the splash screen script.
  72. Default: ``False``
  73. :type full_tk: bool
  74. :keyword minify_script:
  75. The splash screen is created by executing an Tcl/Tk script. This option enables minimizing the script,
  76. meaning removing all non essential parts from the script. Default: ``True``
  77. :keyword name:
  78. An optional alternative filename for the .res file. If not specified, a name is generated.
  79. :type name: str
  80. :keyword script_name:
  81. An optional alternative filename for the Tcl script, that will be generated. If not specified, a name is
  82. generated.
  83. :type script_name: str
  84. :keyword max_img_size:
  85. Maximum size of the splash screen image as a tuple. If the supplied image exceeds this limit, it will be
  86. resized to fit the maximum width (to keep the original aspect ratio). This option can be disabled by
  87. setting it to None. Default: ``(760, 480)``
  88. :type max_img_size: Tuple[int, int]
  89. :keyword always_on_top:
  90. Force the splashscreen to be always on top of other windows. If disabled, other windows (e.g., from other
  91. applications) can cover the splash screen by user bringing them to front. This might be useful for
  92. frozen applications with long startup times. Default: ``True``
  93. :type always_on_top: bool
  94. :keyword center:
  95. Splash screen centering mode: ``'default'``, ``'primary'``, ``'virtual'``, or ``'active'``. In the default
  96. mode, the splash screen script computes the position using screen dimensions obtained via Tk's ``winfo``
  97. command, which has platform-specific behavior in multi-monitor setups; on Windows, it seems to return the
  98. size of the primary monitor, while on other platforms, it seems to return the size of the whole virtual
  99. screen. In other modes, the bootloader attempts to query the target screen size (and position) using
  100. platform-specific low-level API, and supply the information to splash screen script; in ``primary`` mode,
  101. the size of primary screen is queried, and in ``virtual`` mode, the size of whole virtual screen is queried.
  102. The ``active`` mode is supported only on Windows; the bootloader attempts to obtain position of mouse cursor
  103. at the time when application is launched, and queries the size (and position) of the corresponding screen.
  104. If the required information cannot be obtained and exposed by the bootloader, the splash screen script
  105. falls back to the information provided by the ``winfo`` command. Default: ``'default'``
  106. :type center: str
  107. """
  108. from PyInstaller.config import CONF
  109. from PyInstaller.utils.hooks.tcl_tk import tcltk_info
  110. Target.__init__(self)
  111. # Splash screen is not supported on macOS. It operates in a secondary thread and macOS disallows UI operations
  112. # in any thread other than main.
  113. if is_darwin:
  114. raise SystemExit("ERROR: Splash screen is not supported on macOS.")
  115. # Ensure tkinter (and thus Tcl/Tk) is available.
  116. if not tcltk_info.available:
  117. raise SystemExit(
  118. "ERROR: Your platform does not support the splash screen feature, since tkinter is not installed. "
  119. "Please install tkinter and try again."
  120. )
  121. # Check if the Tcl/Tk version is supported.
  122. logger.info("Verifying Tcl/Tk compatibility with splash screen requirements")
  123. self._check_tcl_tk_compatibility(tcltk_info)
  124. # Make image path relative to .spec file
  125. if not os.path.isabs(image_file):
  126. image_file = os.path.join(CONF['specpath'], image_file)
  127. image_file = os.path.normpath(image_file)
  128. if not os.path.exists(image_file):
  129. raise ValueError("Image file '%s' not found" % image_file)
  130. # Copy all arguments
  131. self.image_file = image_file
  132. self.full_tk = kwargs.get("full_tk", False)
  133. self.name = kwargs.get("name", None)
  134. self.script_name = kwargs.get("script_name", None)
  135. self.minify_script = kwargs.get("minify_script", True)
  136. self.max_img_size = kwargs.get("max_img_size", (760, 480))
  137. self.center = kwargs.get("center", "default").lower()
  138. if self.center not in self._CENTER_MODES:
  139. valid_modes = list(self._CENTER_MODES.keys())
  140. raise ValueError(f"Invalid center mode {self.center!r}! Must be one of: {valid_modes!r}")
  141. # text options
  142. self.text_pos = kwargs.get("text_pos", None)
  143. self.text_size = kwargs.get("text_size", 12)
  144. self.text_font = kwargs.get("text_font", "TkDefaultFont")
  145. self.text_color = kwargs.get("text_color", "black")
  146. self.text_default = kwargs.get("text_default", "Initializing")
  147. # always-on-top behavior
  148. self.always_on_top = kwargs.get("always_on_top", True)
  149. # Save the generated file separately so that it is not necessary to generate the data again and again
  150. root = os.path.splitext(self.tocfilename)[0]
  151. if self.name is None:
  152. self.name = root + '.res'
  153. if self.script_name is None:
  154. self.script_name = root + '_script.tcl'
  155. # Internal variables
  156. # Store path to _tkinter extension module, so that guts check can detect if the path changed for some reason.
  157. self._tkinter_file = tcltk_info.tkinter_extension_file
  158. # Calculated / analysed values
  159. self.uses_tkinter = self._uses_tkinter(self._tkinter_file, binaries)
  160. logger.debug("Program uses tkinter: %r", self.uses_tkinter)
  161. self.script = self.generate_script()
  162. self.tcl_lib = tcltk_info.tcl_shared_library # full path to shared library
  163. self.tk_lib = tcltk_info.tk_shared_library
  164. assert self.tcl_lib is not None
  165. assert self.tk_lib is not None
  166. logger.debug("Using Tcl shared library: %r", self.tcl_lib)
  167. logger.debug("Using Tk shared library: %r", self.tk_lib)
  168. self.splash_requirements = set([
  169. # NOTE: the implicit assumption here is that Tcl and Tk shared library are collected into top-level
  170. # application directory, which, at tme moment, is true in practically all cases.
  171. os.path.basename(self.tcl_lib),
  172. os.path.basename(self.tk_lib),
  173. # The list of requirements below is based on the current implementation of splash screen script. If you want
  174. # to extend the splash screen functionality and run into Tcl/Tk errors, chances are that additional Tk
  175. # components need to be added here.
  176. #
  177. # NOTE: these paths use the *destination* layout for Tcl/Tk scripts, which uses unversioned tcl and tk
  178. # directories (see `PyInstaller.utils.hooks.tcl_tk.collect_tcl_tk_files`).
  179. os.path.join(tcltk_info.TCL_ROOTNAME, "init.tcl"),
  180. # Core Tk
  181. os.path.join(tcltk_info.TK_ROOTNAME, "license.terms"),
  182. os.path.join(tcltk_info.TK_ROOTNAME, "text.tcl"),
  183. os.path.join(tcltk_info.TK_ROOTNAME, "tk.tcl"),
  184. # Used for customizable font
  185. os.path.join(tcltk_info.TK_ROOTNAME, "ttk", "ttk.tcl"),
  186. os.path.join(tcltk_info.TK_ROOTNAME, "ttk", "fonts.tcl"),
  187. os.path.join(tcltk_info.TK_ROOTNAME, "ttk", "cursors.tcl"),
  188. os.path.join(tcltk_info.TK_ROOTNAME, "ttk", "utils.tcl"),
  189. ])
  190. if tcltk_info.tk_version >= (9, 0):
  191. self.splash_requirements.update([
  192. os.path.join(tcltk_info.TK_ROOTNAME, "scaling.tcl"),
  193. os.path.join(tcltk_info.TK_ROOTNAME, "tclIndex"), # required for auto-load of scaling.tcl
  194. ])
  195. logger.info("Collect Tcl/Tk data files for the splash screen")
  196. tcltk_tree = tcltk_info.data_files # 3-element tuple TOC
  197. if self.full_tk:
  198. # The user wants a full copy of Tk, so make all Tk files a requirement.
  199. self.splash_requirements.update(entry[0] for entry in tcltk_tree)
  200. # Scan for binary dependencies of the Tcl/Tk shared libraries, and add them to `binaries` TOC list (which
  201. # should really be called `dependencies` as it is not limited to binaries. But it is too late now, and
  202. # existing spec files depend on this naming). We specify these binary dependencies (which include the
  203. # Tcl and Tk shared libraries themselves) even if the user's program uses tkinter and they would be collected
  204. # anyway; let the collection mechanism deal with potential duplicates.
  205. tcltk_libs = [(os.path.basename(src_name), src_name, 'BINARY') for src_name in (self.tcl_lib, self.tk_lib)]
  206. self.binaries = bindepend.binary_dependency_analysis(tcltk_libs)
  207. # Put all shared library dependencies in `splash_requirements`, so they are made available in onefile mode.
  208. self.splash_requirements.update(entry[0] for entry in self.binaries)
  209. # If the user's program does not use tkinter, add resources from Tcl/Tk tree to the dependencies list.
  210. # Do so only for the resources that are part of splash requirements.
  211. if not self.uses_tkinter:
  212. self.binaries.extend(entry for entry in tcltk_tree if entry[0] in self.splash_requirements)
  213. # Check if all requirements were found.
  214. collected_files = set(entry[0] for entry in (binaries + datas + self.binaries))
  215. def _filter_requirement(filename):
  216. if filename not in collected_files:
  217. # Item is not bundled, so warn the user about it. This actually may happen on some tkinter installations
  218. # that are missing the license.terms file - as this file has no effect on operation of splash screen,
  219. # suppress the warning for it.
  220. if os.path.basename(filename) == 'license.terms':
  221. return False
  222. logger.warning(
  223. "The local Tcl/Tk installation is missing the file %s. The behavior of the splash screen is "
  224. "therefore undefined and may be unsupported.", filename
  225. )
  226. return False
  227. return True
  228. # Remove all files which were not found.
  229. self.splash_requirements = set(filter(_filter_requirement, self.splash_requirements))
  230. logger.debug("Splash Requirements: %s", self.splash_requirements)
  231. # On AIX, the Tcl and Tk shared libraries might in fact be ar archives with shared object inside it, and need to
  232. # be `dlopen`'ed with full name (for example, `libtcl.a(libtcl.so.8.6)` and `libtk.a(libtk.so.8.6)`. So if the
  233. # library's suffix is .a, adjust the name accordingly, assuming fixed format for the shared object name.
  234. # Adjust the names at the end of this method, because preceding steps use `self.tcl_lib` and `self.tk_lib` for
  235. # filesystem-based operations and need the original filenames.
  236. if is_aix:
  237. _, ext = os.path.splitext(self.tcl_lib)
  238. if ext == '.a':
  239. tcl_major, tcl_minor = tcltk_info.tcl_version
  240. self.tcl_lib += f"(libtcl.so.{tcl_major}.{tcl_minor})"
  241. _, ext = os.path.splitext(self.tk_lib)
  242. if ext == '.a':
  243. tk_major, tk_minor = tcltk_info.tk_version
  244. self.tk_lib += f"(libtk.so.{tk_major}.{tk_minor})"
  245. self.__postinit__()
  246. _CENTER_MODES = {
  247. 'default': SplashWriter._SPLASH_CENTER_DEFAULT,
  248. 'primary': SplashWriter._SPLASH_CENTER_PRIMARY_SCREEN,
  249. 'virtual': SplashWriter._SPLASH_CENTER_VIRTUAL_SCREEN,
  250. 'active': SplashWriter._SPLASH_CENTER_ACTIVE_SCREEN,
  251. }
  252. _GUTS = (
  253. # input parameters
  254. ('image_file', _check_guts_eq),
  255. ('name', _check_guts_eq),
  256. ('script_name', _check_guts_eq),
  257. ('text_pos', _check_guts_eq),
  258. ('text_size', _check_guts_eq),
  259. ('text_font', _check_guts_eq),
  260. ('text_color', _check_guts_eq),
  261. ('text_default', _check_guts_eq),
  262. ('always_on_top', _check_guts_eq),
  263. ('full_tk', _check_guts_eq),
  264. ('minify_script', _check_guts_eq),
  265. ('max_img_size', _check_guts_eq),
  266. ('center', _check_guts_eq),
  267. # calculated/analysed values
  268. ('uses_tkinter', _check_guts_eq),
  269. ('script', _check_guts_eq),
  270. ('tcl_lib', _check_guts_eq),
  271. ('tk_lib', _check_guts_eq),
  272. ('splash_requirements', _check_guts_eq),
  273. ('binaries', _check_guts_toc),
  274. # internal value
  275. # Check if the tkinter installation changed. This is theoretically possible if someone uses two different python
  276. # installations of the same version.
  277. ('_tkinter_file', _check_guts_eq),
  278. )
  279. def _check_guts(self, data, last_build):
  280. if Target._check_guts(self, data, last_build):
  281. return True
  282. # Check if the image has been modified.
  283. if misc.mtime(self.image_file) > last_build:
  284. logger.info("Building %s because file %s changed", self.tocbasename, self.image_file)
  285. return True
  286. return False
  287. def assemble(self):
  288. logger.info("Building Splash %s", self.name)
  289. # Check if PIL/pillow is available.
  290. try:
  291. from PIL import Image as PILImage
  292. except ImportError:
  293. PILImage = None
  294. # Required to pass tcltk_info.TK_ROOTNAME to SplashWriter
  295. from PyInstaller.utils.hooks.tcl_tk import tcltk_info
  296. # Function to resize a given image to fit into the area defined by max_img_size.
  297. def _resize_image(_image, _orig_size):
  298. if PILImage:
  299. _w, _h = _orig_size
  300. _ratio_w = self.max_img_size[0] / _w
  301. if _ratio_w < 1:
  302. # Image width exceeds limit
  303. _h = int(_h * _ratio_w)
  304. _w = self.max_img_size[0]
  305. _ratio_h = self.max_img_size[1] / _h
  306. if _ratio_h < 1:
  307. # Image height exceeds limit
  308. _w = int(_w * _ratio_h)
  309. _h = self.max_img_size[1]
  310. # If a file is given it will be open
  311. if isinstance(_image, PILImage.Image):
  312. _img = _image
  313. else:
  314. _img = PILImage.open(_image)
  315. _img_resized = _img.resize((_w, _h))
  316. # Save image into a stream
  317. _image_stream = io.BytesIO()
  318. _img_resized.save(_image_stream, format='PNG')
  319. _img.close()
  320. _img_resized.close()
  321. _image_data = _image_stream.getvalue()
  322. logger.info("Resized image %s from dimensions %r to (%d, %d)", self.image_file, _orig_size, _w, _h)
  323. return _image_data
  324. else:
  325. raise ValueError(
  326. "The splash image dimensions (w: %d, h: %d) exceed max_img_size (w: %d, h:%d), but the image "
  327. "cannot be resized due to missing PIL.Image! Either install the Pillow package, adjust the "
  328. "max_img_size, or use an image of compatible dimensions." %
  329. (_orig_size[0], _orig_size[1], self.max_img_size[0], self.max_img_size[1])
  330. )
  331. # Open image file
  332. image_file = open(self.image_file, 'rb')
  333. # Check header of the file to identify it
  334. if image_file.read(8) == b'\x89PNG\r\n\x1a\n':
  335. # self.image_file is a PNG file
  336. image_file.seek(16)
  337. img_size = (struct.unpack("!I", image_file.read(4))[0], struct.unpack("!I", image_file.read(4))[0])
  338. if img_size > self.max_img_size:
  339. # The image exceeds the maximum image size, so resize it
  340. image = _resize_image(self.image_file, img_size)
  341. else:
  342. image = os.path.abspath(self.image_file)
  343. elif PILImage:
  344. # Pillow is installed, meaning the image can be converted automatically
  345. img = PILImage.open(self.image_file, mode='r')
  346. if img.size > self.max_img_size:
  347. image = _resize_image(img, img.size)
  348. else:
  349. image_data = io.BytesIO()
  350. img.save(image_data, format='PNG')
  351. img.close()
  352. image = image_data.getvalue()
  353. logger.info("Converted image %s to PNG format", self.image_file)
  354. else:
  355. raise ValueError(
  356. "The image %s needs to be converted to a PNG file, but PIL.Image is not available! Either install the "
  357. "Pillow package, or use a PNG image for you splash screen." % (self.image_file,)
  358. )
  359. image_file.close()
  360. SplashWriter(
  361. self.name,
  362. self.splash_requirements,
  363. os.path.basename(self.tcl_lib), # tcl86t.dll
  364. os.path.basename(self.tk_lib), # tk86t.dll
  365. tcltk_info.TCL_ROOTNAME,
  366. tcltk_info.TK_ROOTNAME,
  367. image,
  368. self.script,
  369. self._CENTER_MODES[self.center],
  370. )
  371. @staticmethod
  372. def _check_tcl_tk_compatibility(tcltk_info):
  373. tcl_version = tcltk_info.tcl_version # (major, minor) tuple
  374. tk_version = tcltk_info.tk_version
  375. if is_darwin and tcltk_info.is_macos_system_framework:
  376. # Outdated Tcl/Tk 8.5 system framework is not supported.
  377. raise SystemExit(
  378. "ERROR: The splash screen feature does not support macOS system framework version of Tcl/Tk."
  379. )
  380. # Test if tcl/tk version is supported
  381. if tcl_version < (8, 6) or tk_version < (8, 6):
  382. logger.warning(
  383. "The installed Tcl/Tk (%d.%d / %d.%d) version might not work with the splash screen feature of the "
  384. "bootloader, which was tested against Tcl/Tk 8.6", *tcl_version, *tk_version
  385. )
  386. # This should be impossible, since tcl/tk is released together with the same version number, but just in case
  387. if tcl_version != tk_version:
  388. logger.warning(
  389. "The installed version of Tcl (%d.%d) and Tk (%d.%d) do not match. PyInstaller is tested against "
  390. "matching versions", *tcl_version, *tk_version
  391. )
  392. # Ensure that Tcl is built with multi-threading support.
  393. if not tcltk_info.tcl_threaded:
  394. # This is a feature breaking problem, so exit.
  395. raise SystemExit(
  396. "ERROR: The installed Tcl version is not threaded. PyInstaller only supports the splash screen "
  397. "using threaded Tcl."
  398. )
  399. # Ensure that Tcl and Tk shared libraries are available
  400. if tcltk_info.tcl_shared_library is None or tcltk_info.tk_shared_library is None:
  401. message = \
  402. "ERROR: Could not determine the path to Tcl and/or Tk shared library, " \
  403. "which are required for splash screen."
  404. if not tcltk_info.tkinter_extension_file:
  405. message += (
  406. " The _tkinter module appears to be a built-in, which likely means that python was built with "
  407. "statically-linked Tcl/Tk libraries and is incompatible with splash screen."
  408. )
  409. raise SystemExit(message)
  410. def generate_script(self):
  411. """
  412. Generate the script for the splash screen.
  413. If minify_script is True, all unnecessary parts will be removed.
  414. """
  415. d = {}
  416. if self.text_pos is not None:
  417. logger.debug("Add text support to splash screen")
  418. d.update({
  419. 'pad_x': self.text_pos[0],
  420. 'pad_y': self.text_pos[1],
  421. 'color': self.text_color,
  422. 'font': self.text_font,
  423. 'font_size': self.text_size,
  424. 'default_text': self.text_default,
  425. })
  426. script = splash_templates.build_script(text_options=d, always_on_top=self.always_on_top)
  427. if self.minify_script:
  428. # Remove any documentation, empty lines and unnecessary spaces
  429. script = '\n'.join(
  430. line for line in map(lambda line: line.strip(), script.splitlines())
  431. if not line.startswith('#') # documentation
  432. and line # empty lines
  433. )
  434. # Remove unnecessary spaces
  435. script = re.sub(' +', ' ', script)
  436. # Write script to disk, so that it is transparent to the user what script is executed.
  437. with open(self.script_name, "w", encoding="utf-8") as script_file:
  438. script_file.write(script)
  439. return script
  440. @staticmethod
  441. def _uses_tkinter(tkinter_file, binaries):
  442. # Test for _tkinter extension instead of tkinter module, because user might use a different wrapping library for
  443. # Tk. Use `pathlib.PurePath` in comparisons to account for case normalization and separator normalization.
  444. tkinter_file = pathlib.PurePath(tkinter_file)
  445. for dest_name, src_name, typecode in binaries:
  446. if pathlib.PurePath(src_name) == tkinter_file:
  447. return True
  448. return False