prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Update removed `platform.linux_distribution` funtion call in Python 3.8
  ## Description
  
  We are using [platform.linux_distribution](https://github.com/freedomofpress/securedrop/blob/4c73102ca9151a86a08396de40163b48a5a21768/securedrop/source_app/api.py#L20) function in our metadata endpoint. But, this function was deprecated from Python3.5 and totally removed from Python 3.8. 
  
  ## Solution
  
  We can directly read the `/etc/lsb-release` and `/etc/os-release` file as required.
  
  
  </issue>
  <code>
  [start of securedrop/source_app/api.py]
  1 import json
  2 import platform
  3 
  4 from flask import Blueprint, current_app, make_response
  5 
  6 from source_app.utils import get_sourcev2_url, get_sourcev3_url
  7 
  8 import version
  9 
  10 
  11 def make_blueprint(config):
  12     view = Blueprint('api', __name__)
  13 
  14     @view.route('/metadata')
  15     def metadata():
  16         meta = {
  17             'allow_document_uploads': current_app.instance_config.allow_document_uploads,
  18             'gpg_fpr': config.JOURNALIST_KEY,
  19             'sd_version': version.__version__,
  20             'server_os': platform.linux_distribution()[1],
  21             'supported_languages': config.SUPPORTED_LOCALES,
  22             'v2_source_url': get_sourcev2_url(),
  23             'v3_source_url': get_sourcev3_url()
  24         }
  25         resp = make_response(json.dumps(meta))
  26         resp.headers['Content-Type'] = 'application/json'
  27         return resp
  28 
  29     return view
  30
  [end of securedrop/source_app/api.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/securedrop/source_app/api.py b/securedrop/source_app/api.py
  --- a/securedrop/source_app/api.py
  +++ b/securedrop/source_app/api.py
  @@ -1,5 +1,4 @@
   import json
  -import platform
   
   from flask import Blueprint, current_app, make_response
   
  @@ -8,6 +7,10 @@
   import version
   
   
  +with open("/etc/lsb-release", "r") as f:
  +    server_os = f.readlines()[1].split("=")[1].strip("\n")
  +
  +
   def make_blueprint(config):
       view = Blueprint('api', __name__)
   
  @@ -17,7 +20,7 @@
               'allow_document_uploads': current_app.instance_config.allow_document_uploads,
               'gpg_fpr': config.JOURNALIST_KEY,
               'sd_version': version.__version__,
  -            'server_os': platform.linux_distribution()[1],
  +            'server_os': server_os,
               'supported_languages': config.SUPPORTED_LOCALES,
               'v2_source_url': get_sourcev2_url(),
               'v3_source_url': get_sourcev3_url()
  
verification_info: {"golden_diff": "diff --git a/securedrop/source_app/api.py b/securedrop/source_app/api.py\n--- a/securedrop/source_app/api.py\n+++ b/securedrop/source_app/api.py\n@@ -1,5 +1,4 @@\n import json\n-import platform\n \n from flask import Blueprint, current_app, make_response\n \n@@ -8,6 +7,10 @@\n import version\n \n \n+with open(\"/etc/lsb-release\", \"r\") as f:\n+    server_os = f.readlines()[1].split(\"=\")[1].strip(\"\\n\")\n+\n+\n def make_blueprint(config):\n     view = Blueprint('api', __name__)\n \n@@ -17,7 +20,7 @@\n             'allow_document_uploads': current_app.instance_config.allow_document_uploads,\n             'gpg_fpr': config.JOURNALIST_KEY,\n             'sd_version': version.__version__,\n-            'server_os': platform.linux_distribution()[1],\n+            'server_os': server_os,\n             'supported_languages': config.SUPPORTED_LOCALES,\n             'v2_source_url': get_sourcev2_url(),\n             'v3_source_url': get_sourcev3_url()\n", "issue": "Update removed `platform.linux_distribution` funtion call in Python 3.8\n## Description\r\n\r\nWe are using [platform.linux_distribution](https://github.com/freedomofpress/securedrop/blob/4c73102ca9151a86a08396de40163b48a5a21768/securedrop/source_app/api.py#L20) function in our metadata endpoint. But, this function was deprecated from Python3.5 and totally removed from Python 3.8. \r\n\r\n## Solution\r\n\r\nWe can directly read the `/etc/lsb-release` and `/etc/os-release` file as required.\r\n\n", "before_files": [{"content": "import json\nimport platform\n\nfrom flask import Blueprint, current_app, make_response\n\nfrom source_app.utils import get_sourcev2_url, get_sourcev3_url\n\nimport version\n\n\ndef make_blueprint(config):\n    view = Blueprint('api', __name__)\n\n    @view.route('/metadata')\n    def metadata():\n        meta = {\n            'allow_document_uploads': current_app.instance_config.allow_document_uploads,\n            'gpg_fpr': config.JOURNALIST_KEY,\n            'sd_version': version.__version__,\n            'server_os': platform.linux_distribution()[1],\n            'supported_languages': config.SUPPORTED_LOCALES,\n            'v2_source_url': get_sourcev2_url(),\n            'v3_source_url': get_sourcev3_url()\n        }\n        resp = make_response(json.dumps(meta))\n        resp.headers['Content-Type'] = 'application/json'\n        return resp\n\n    return view\n", "path": "securedrop/source_app/api.py"}]}