prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Add front-end extension capability
  This is similar in concept to https://github.com/getredash/redash/pull/2354/files
  
  </issue>
  <code>
  [start of redash/extensions.py]
  1 from pkg_resources import iter_entry_points
  2 
  3 
  4 def init_extensions(app):
  5     """
  6     Load the Redash extensions for the given Redash Flask app.
  7     """
  8     if not hasattr(app, 'redash_extensions'):
  9         app.redash_extensions = {}
  10 
  11     for entry_point in iter_entry_points('redash.extensions'):
  12         app.logger.info('Loading Redash extension %s.', entry_point.name)
  13         extension = entry_point.load()
  14         app.redash_extensions[entry_point.name] = extension(app)
  15
  [end of redash/extensions.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/redash/extensions.py b/redash/extensions.py
  --- a/redash/extensions.py
  +++ b/redash/extensions.py
  @@ -1,4 +1,5 @@
  -from pkg_resources import iter_entry_points
  +import os
  +from pkg_resources import iter_entry_points, resource_isdir, resource_listdir
   
   
   def init_extensions(app):
  @@ -10,5 +11,20 @@
   
       for entry_point in iter_entry_points('redash.extensions'):
           app.logger.info('Loading Redash extension %s.', entry_point.name)
  -        extension = entry_point.load()
  -        app.redash_extensions[entry_point.name] = extension(app)
  +        try:
  +            extension = entry_point.load()
  +            app.redash_extensions[entry_point.name] = {
  +                "entry_function": extension(app),
  +                "resources_list": []
  +            }
  +        except ImportError:
  +            app.logger.info('%s does not have a callable and will not be loaded.', entry_point.name)
  +            (root_module, _) = os.path.splitext(entry_point.module_name)
  +            content_folder_relative = os.path.join(entry_point.name, 'bundle')
  +
  +            # If it's a frontend extension only, store a list of files in the bundle directory.
  +            if resource_isdir(root_module, content_folder_relative):
  +                app.redash_extensions[entry_point.name] = {
  +                    "entry_function": None,
  +                    "resources_list": resource_listdir(root_module, content_folder_relative)
  +                }
  
verification_info: {"golden_diff": "diff --git a/redash/extensions.py b/redash/extensions.py\n--- a/redash/extensions.py\n+++ b/redash/extensions.py\n@@ -1,4 +1,5 @@\n-from pkg_resources import iter_entry_points\n+import os\n+from pkg_resources import iter_entry_points, resource_isdir, resource_listdir\n \n \n def init_extensions(app):\n@@ -10,5 +11,20 @@\n \n     for entry_point in iter_entry_points('redash.extensions'):\n         app.logger.info('Loading Redash extension %s.', entry_point.name)\n-        extension = entry_point.load()\n-        app.redash_extensions[entry_point.name] = extension(app)\n+        try:\n+            extension = entry_point.load()\n+            app.redash_extensions[entry_point.name] = {\n+                \"entry_function\": extension(app),\n+                \"resources_list\": []\n+            }\n+        except ImportError:\n+            app.logger.info('%s does not have a callable and will not be loaded.', entry_point.name)\n+            (root_module, _) = os.path.splitext(entry_point.module_name)\n+            content_folder_relative = os.path.join(entry_point.name, 'bundle')\n+\n+            # If it's a frontend extension only, store a list of files in the bundle directory.\n+            if resource_isdir(root_module, content_folder_relative):\n+                app.redash_extensions[entry_point.name] = {\n+                    \"entry_function\": None,\n+                    \"resources_list\": resource_listdir(root_module, content_folder_relative)\n+                }\n", "issue": "Add front-end extension capability\nThis is similar in concept to https://github.com/getredash/redash/pull/2354/files\n", "before_files": [{"content": "from pkg_resources import iter_entry_points\n\n\ndef init_extensions(app):\n    \"\"\"\n    Load the Redash extensions for the given Redash Flask app.\n    \"\"\"\n    if not hasattr(app, 'redash_extensions'):\n        app.redash_extensions = {}\n\n    for entry_point in iter_entry_points('redash.extensions'):\n        app.logger.info('Loading Redash extension %s.', entry_point.name)\n        extension = entry_point.load()\n        app.redash_extensions[entry_point.name] = extension(app)\n", "path": "redash/extensions.py"}]}