prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  PyInstaller should not check for modules specific for other than the current platform
  **Python extensions for Windows**
  
  We should not be checking for these modules in os x and linux. 
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `PyInstaller/hooks/pre_safe_import_module/hook-win32com.py`
  Content:
  ```
  1 #-----------------------------------------------------------------------------
  2 # Copyright (c) 2005-2017, PyInstaller Development Team.
  3 #
  4 # Distributed under the terms of the GNU General Public License with exception
  5 # for distributing bootloader.
  6 #
  7 # The full license is in the file COPYING.txt, distributed with this software.
  8 #-----------------------------------------------------------------------------
  9 
  10 """
  11 PyWin32 package 'win32com' extends it's __path__ attribute with win32comext
  12 directory and thus PyInstaller is not able to find modules in it. For example
  13 module 'win32com.shell' is in reality 'win32comext.shell'.
  14 
  15 >>> win32com.__path__
  16 ['win32com', 'C:\\Python27\\Lib\\site-packages\\win32comext']
  17 
  18 """
  19 
  20 
  21 import os
  22 
  23 from PyInstaller.utils.hooks import logger, get_module_file_attribute
  24 
  25 
  26 def pre_safe_import_module(api):
  27     win32com_dir = os.path.dirname(get_module_file_attribute('win32com'))
  28     comext_dir = os.path.join(os.path.dirname(win32com_dir), 'win32comext')
  29     logger.debug('win32com: extending __path__ with dir %r' % comext_dir)
  30     # Append the __path__ where PyInstaller will look for 'win32com' modules.'
  31     api.append_package_path(comext_dir)
  32
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/PyInstaller/hooks/pre_safe_import_module/hook-win32com.py b/PyInstaller/hooks/pre_safe_import_module/hook-win32com.py
  --- a/PyInstaller/hooks/pre_safe_import_module/hook-win32com.py
  +++ b/PyInstaller/hooks/pre_safe_import_module/hook-win32com.py
  @@ -21,11 +21,13 @@
   import os
   
   from PyInstaller.utils.hooks import logger, get_module_file_attribute
  +from PyInstaller.compat import is_win
   
   
   def pre_safe_import_module(api):
  -    win32com_dir = os.path.dirname(get_module_file_attribute('win32com'))
  -    comext_dir = os.path.join(os.path.dirname(win32com_dir), 'win32comext')
  -    logger.debug('win32com: extending __path__ with dir %r' % comext_dir)
  -    # Append the __path__ where PyInstaller will look for 'win32com' modules.'
  -    api.append_package_path(comext_dir)
  +    if is_win:
  +        win32com_dir = os.path.dirname(get_module_file_attribute('win32com'))
  +        comext_dir = os.path.join(os.path.dirname(win32com_dir), 'win32comext')
  +        logger.debug('win32com: extending __path__ with dir %r' % comext_dir)
  +        # Append the __path__ where PyInstaller will look for 'win32com' modules.'
  +        api.append_package_path(comext_dir)
  
verification_info: {"golden_diff": "diff --git a/PyInstaller/hooks/pre_safe_import_module/hook-win32com.py b/PyInstaller/hooks/pre_safe_import_module/hook-win32com.py\n--- a/PyInstaller/hooks/pre_safe_import_module/hook-win32com.py\n+++ b/PyInstaller/hooks/pre_safe_import_module/hook-win32com.py\n@@ -21,11 +21,13 @@\n import os\n \n from PyInstaller.utils.hooks import logger, get_module_file_attribute\n+from PyInstaller.compat import is_win\n \n \n def pre_safe_import_module(api):\n-    win32com_dir = os.path.dirname(get_module_file_attribute('win32com'))\n-    comext_dir = os.path.join(os.path.dirname(win32com_dir), 'win32comext')\n-    logger.debug('win32com: extending __path__ with dir %r' % comext_dir)\n-    # Append the __path__ where PyInstaller will look for 'win32com' modules.'\n-    api.append_package_path(comext_dir)\n+    if is_win:\n+        win32com_dir = os.path.dirname(get_module_file_attribute('win32com'))\n+        comext_dir = os.path.join(os.path.dirname(win32com_dir), 'win32comext')\n+        logger.debug('win32com: extending __path__ with dir %r' % comext_dir)\n+        # Append the __path__ where PyInstaller will look for 'win32com' modules.'\n+        api.append_package_path(comext_dir)\n", "issue": "PyInstaller should not check for modules specific for other than the current platform\n**Python extensions for Windows**\r\n\r\nWe should not be checking for these modules in os x and linux. \n", "before_files": [{"content": "#-----------------------------------------------------------------------------\n# Copyright (c) 2005-2017, PyInstaller Development Team.\n#\n# Distributed under the terms of the GNU General Public License with exception\n# for distributing bootloader.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#-----------------------------------------------------------------------------\n\n\"\"\"\nPyWin32 package 'win32com' extends it's __path__ attribute with win32comext\ndirectory and thus PyInstaller is not able to find modules in it. For example\nmodule 'win32com.shell' is in reality 'win32comext.shell'.\n\n>>> win32com.__path__\n['win32com', 'C:\\\\Python27\\\\Lib\\\\site-packages\\\\win32comext']\n\n\"\"\"\n\n\nimport os\n\nfrom PyInstaller.utils.hooks import logger, get_module_file_attribute\n\n\ndef pre_safe_import_module(api):\n    win32com_dir = os.path.dirname(get_module_file_attribute('win32com'))\n    comext_dir = os.path.join(os.path.dirname(win32com_dir), 'win32comext')\n    logger.debug('win32com: extending __path__ with dir %r' % comext_dir)\n    # Append the __path__ where PyInstaller will look for 'win32com' modules.'\n    api.append_package_path(comext_dir)\n", "path": "PyInstaller/hooks/pre_safe_import_module/hook-win32com.py"}], "after_files": [{"content": "#-----------------------------------------------------------------------------\n# Copyright (c) 2005-2017, PyInstaller Development Team.\n#\n# Distributed under the terms of the GNU General Public License with exception\n# for distributing bootloader.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#-----------------------------------------------------------------------------\n\n\"\"\"\nPyWin32 package 'win32com' extends it's __path__ attribute with win32comext\ndirectory and thus PyInstaller is not able to find modules in it. For example\nmodule 'win32com.shell' is in reality 'win32comext.shell'.\n\n>>> win32com.__path__\n['win32com', 'C:\\\\Python27\\\\Lib\\\\site-packages\\\\win32comext']\n\n\"\"\"\n\n\nimport os\n\nfrom PyInstaller.utils.hooks import logger, get_module_file_attribute\nfrom PyInstaller.compat import is_win\n\n\ndef pre_safe_import_module(api):\n    if is_win:\n        win32com_dir = os.path.dirname(get_module_file_attribute('win32com'))\n        comext_dir = os.path.join(os.path.dirname(win32com_dir), 'win32comext')\n        logger.debug('win32com: extending __path__ with dir %r' % comext_dir)\n        # Append the __path__ where PyInstaller will look for 'win32com' modules.'\n        api.append_package_path(comext_dir)\n", "path": "PyInstaller/hooks/pre_safe_import_module/hook-win32com.py"}]}