prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  soundfile hook has osx/windows specific behaviour
  hook-soundfile.py was added in 3.5 but it blows up on linux as follows
  
      9727 INFO: Loading module hook "hook-soundfile.py"...
      Unable to find "/home/matt/.virtualenvs/beqdesigner-entpycF3/lib/python3.7/site-packages/_soundfile_data" when adding binary and data files.
  
  on OSX, it also fails but with a different error
  
      ValueError: Unknown Mach-O header: 0x20202020 in <_io.BufferedReader 
      name='/Users/travis/build/3ll3d00d/beqdesigner/.venv/lib/python3.7/site-packages/_soundfile_data/COPYING'>
  
  It completes successfully on Windows
  
  The problem is that pysoundfile packages libsndfile on Windows and OSX (as per https://pysoundfile.readthedocs.io/en/0.9.0/#installation) but relies on a system package on Linux so the mentioned directory (`_soundfile_data`) will not exist on Linux. On OSX only a certain file is required (`_soundfile_data/libsndfile.dylib`)
  
  Minimal test case can be found at https://github.com/3ll3d00d/pyinstaller-pysoundfile-bug
  
  
  </issue>
  <code>
  [start of PyInstaller/hooks/hook-soundfile.py]
  1 #-----------------------------------------------------------------------------
  2 # Copyright (c) 2016-2019, 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 pysoundfile:
  12 https://github.com/bastibe/SoundFile
  13 """
  14 
  15 import os
  16 from PyInstaller.utils.hooks import get_package_paths
  17 
  18 # get path of soundfile
  19 sfp = get_package_paths('soundfile')
  20 
  21 # add the binaries
  22 bins = os.path.join(sfp[0], "_soundfile_data")
  23 binaries = [(bins, "_soundfile_data")]
  24
  [end of PyInstaller/hooks/hook-soundfile.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/PyInstaller/hooks/hook-soundfile.py b/PyInstaller/hooks/hook-soundfile.py
  --- a/PyInstaller/hooks/hook-soundfile.py
  +++ b/PyInstaller/hooks/hook-soundfile.py
  @@ -13,11 +13,20 @@
   """
   
   import os
  +
  +from PyInstaller.compat import is_win, is_darwin
   from PyInstaller.utils.hooks import get_package_paths
   
   # get path of soundfile
   sfp = get_package_paths('soundfile')
   
  -# add the binaries
  -bins = os.path.join(sfp[0], "_soundfile_data")
  -binaries = [(bins, "_soundfile_data")]
  +# add binaries packaged by soundfile on OSX and Windows
  +# an external dependency (libsndfile) is used on GNU/Linux
  +path = None
  +if is_win:
  +    path = os.path.join(sfp[0], '_soundfile_data')
  +elif is_darwin:
  +    path = os.path.join(sfp[0], '_soundfile_data', 'libsndfile.dylib')
  +
  +if path is not None and os.path.exists(path):
  +    binaries = [(path, "_soundfile_data")]
  
verification_info: {"golden_diff": "diff --git a/PyInstaller/hooks/hook-soundfile.py b/PyInstaller/hooks/hook-soundfile.py\n--- a/PyInstaller/hooks/hook-soundfile.py\n+++ b/PyInstaller/hooks/hook-soundfile.py\n@@ -13,11 +13,20 @@\n \"\"\"\n \n import os\n+\n+from PyInstaller.compat import is_win, is_darwin\n from PyInstaller.utils.hooks import get_package_paths\n \n # get path of soundfile\n sfp = get_package_paths('soundfile')\n \n-# add the binaries\n-bins = os.path.join(sfp[0], \"_soundfile_data\")\n-binaries = [(bins, \"_soundfile_data\")]\n+# add binaries packaged by soundfile on OSX and Windows\n+# an external dependency (libsndfile) is used on GNU/Linux\n+path = None\n+if is_win:\n+    path = os.path.join(sfp[0], '_soundfile_data')\n+elif is_darwin:\n+    path = os.path.join(sfp[0], '_soundfile_data', 'libsndfile.dylib')\n+\n+if path is not None and os.path.exists(path):\n+    binaries = [(path, \"_soundfile_data\")]\n", "issue": "soundfile hook has osx/windows specific behaviour\nhook-soundfile.py was added in 3.5 but it blows up on linux as follows\r\n\r\n    9727 INFO: Loading module hook \"hook-soundfile.py\"...\r\n    Unable to find \"/home/matt/.virtualenvs/beqdesigner-entpycF3/lib/python3.7/site-packages/_soundfile_data\" when adding binary and data files.\r\n\r\non OSX, it also fails but with a different error\r\n\r\n    ValueError: Unknown Mach-O header: 0x20202020 in <_io.BufferedReader \r\n    name='/Users/travis/build/3ll3d00d/beqdesigner/.venv/lib/python3.7/site-packages/_soundfile_data/COPYING'>\r\n\r\nIt completes successfully on Windows\r\n\r\nThe problem is that pysoundfile packages libsndfile on Windows and OSX (as per https://pysoundfile.readthedocs.io/en/0.9.0/#installation) but relies on a system package on Linux so the mentioned directory (`_soundfile_data`) will not exist on Linux. On OSX only a certain file is required (`_soundfile_data/libsndfile.dylib`)\r\n\r\nMinimal test case can be found at https://github.com/3ll3d00d/pyinstaller-pysoundfile-bug\r\n\n", "before_files": [{"content": "#-----------------------------------------------------------------------------\n# Copyright (c) 2016-2019, 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\"\"\"\npysoundfile:\nhttps://github.com/bastibe/SoundFile\n\"\"\"\n\nimport os\nfrom PyInstaller.utils.hooks import get_package_paths\n\n# get path of soundfile\nsfp = get_package_paths('soundfile')\n\n# add the binaries\nbins = os.path.join(sfp[0], \"_soundfile_data\")\nbinaries = [(bins, \"_soundfile_data\")]\n", "path": "PyInstaller/hooks/hook-soundfile.py"}]}