prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Make Glymur an optional dependancy
  This is "make io imports optional"
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `setup.py`
  Content:
  ```
  1 """
  2 SunPy: Python for Solar Physics
  3 
  4 The SunPy project is an effort to create an open-source software library for
  5 solar physics using the Python programming language.
  6 """
  7 DOCLINES = __doc__.split("\n")
  8 
  9 CLASSIFIERS = [
  10     'Development Status :: 3 - Alpha',
  11     'Intended Audience :: Science/Research',
  12     'Intended Audience :: Developers',
  13     'License :: OSI Approved :: BSD License',
  14     'Programming Language :: Python',
  15     'Programming Language :: Python :: 3',
  16     'Topic :: Software Development',
  17     'Topic :: Scientific/Engineering',
  18     'Topic :: Scientific/Engineering :: Physics',
  19     'Operating System :: Microsoft :: Windows',
  20     'Operating System :: POSIX',
  21     'Operating System :: Unix',
  22     'Operating System :: MacOS'
  23 ]
  24 
  25 VERSION = '0.3.2'
  26 
  27 def git_description():
  28     import subprocess
  29     try:
  30         out = subprocess.Popen(['git', 'describe', '--tags'], stdout = subprocess.PIPE).communicate()[0]
  31         description = out.strip().decode('ascii')
  32     except OSError:
  33         description = 'Error: could not run git'
  34     return description
  35 
  36 def write_version_py():
  37     import os
  38     if os.path.exists('.git'):
  39         GIT_DESCRIPTION = git_description()
  40     else:
  41         GIT_DESCRIPTION = 'N/A'
  42 
  43     out = open('sunpy/version.py', 'w')
  44     template = """# This file is automatically generated by SunPy's setup.py
  45 version = '%(version)s'
  46 git_description = '%(git_description)s'
  47 """
  48     try:
  49         out.write(template % {'version': VERSION,
  50                               'git_description': GIT_DESCRIPTION})
  51     finally:
  52         out.close()
  53 
  54 
  55 def install(setup): #pylint: disable=W0621
  56     from setuptools import find_packages
  57     #Crotate Module
  58     from distutils.core import Extension
  59     from os.path import dirname, join
  60     cwd = dirname(__file__)
  61     try:
  62         import numpy as np
  63     except ImportError:
  64         print("SunPy WARNING: NumPy must be installed first to build the C extension")
  65 
  66     if 'np' in locals():
  67         module = 'sunpy.image.Crotate'   # import this
  68         sourcefiles = [join(cwd, 'sunpy', 'image', 'src', 'rot_extn.c'),
  69                        join(cwd, 'sunpy', 'image', 'src', 'transform', 'aff_tr.c')]
  70         libs = ['m']
  71         # -ON for compile optimise
  72         gcc_args = ['-std=c99', '-O3']
  73         # gcc_args = ['-std=c99']
  74 
  75         # need *module* name here
  76         crotate = Extension(module,
  77                             sources = sourcefiles,
  78                             libraries = libs,
  79                             extra_compile_args = gcc_args,
  80                             include_dirs =
  81                             [np.get_include(), join(cwd, 'sunpy', 'image', 'src')]
  82                             )
  83 
  84         module_ana = 'sunpy.io._pyana'
  85         sourcefiles_ana = [join(cwd, 'sunpy', 'io', 'src', 'ana', 'anacompress.c'),
  86                        join(cwd, 'sunpy', 'io', 'src', 'ana', 'anadecompress.c'),
  87                        join(cwd, 'sunpy', 'io', 'src', 'ana', 'anarw.c'),
  88                        join(cwd, 'sunpy', 'io', 'src', 'ana', 'testrw.c'),
  89                        join(cwd, 'sunpy', 'io', 'src', 'ana', '_pyana.c')]
  90 
  91         ana = Extension(module_ana,
  92                             sources = sourcefiles_ana,
  93                             libraries = libs,
  94                             extra_compile_args = gcc_args,
  95                             include_dirs =
  96                             [np.get_include(), join(cwd, 'sunpy', 'io', 'src')]
  97                             )
  98     ext_modules = []
  99     if 'crotate' in locals():
  100         ext_modules.append(crotate)
  101     if 'ana' in locals():
  102         ext_modules.append(ana)
  103 
  104     write_version_py()
  105 
  106     setup(
  107 	author="Steven Christe, Matt Earnshaw,  Russell Hewett, Keith Hughitt, Jack Ireland, Florian Mayer, Stuart Mumford,  Albert Shih, David Perez-Suarez et. al",
  108         author_email="sunpy@googlegroups.com",
  109         classifiers=CLASSIFIERS,
  110         description=DOCLINES[0],
  111         download_url="http://www.sunpy.org/download/",
  112         # 2011/11/21: disabling for now to prevent paver warnings
  113         #extra_requires={
  114         #    "Plotman": ['PyQt4']
  115         #},
  116         install_requires=[
  117             'numpy>1.6.0',
  118             'astropy>=0.3.0',
  119             'scipy',
  120  #           'suds',
  121             'pandas>=0.10.0',
  122             'matplotlib>=1.1',
  123             'glymur>=0.5.9',
  124  #           'beautifulsoup4',
  125             'sqlalchemy',
  126         ],
  127         license="BSD",
  128         long_description="\n".join(DOCLINES[2:]),
  129         maintainer="SunPy Developers",
  130         maintainer_email="sunpy@googlegroups.com",
  131         name="sunpy",
  132         packages=find_packages(),
  133         package_data={'': ['*.fits', '*.fit', 'sunpyrc']},
  134         platforms=["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"],
  135         provides=['sunpy'],
  136         url="http://www.sunpy.org/",
  137         use_2to3=True,
  138         version=VERSION,
  139         ext_modules = ext_modules
  140     )
  141 
  142 if __name__ == '__main__':
  143     from distribute_setup import use_setuptools
  144     use_setuptools()
  145     from setuptools import setup
  146     install(setup)
  147
  ```
  --- 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/setup.py b/setup.py
  --- a/setup.py
  +++ b/setup.py
  @@ -109,19 +109,12 @@
           classifiers=CLASSIFIERS,
           description=DOCLINES[0],
           download_url="http://www.sunpy.org/download/",
  -        # 2011/11/21: disabling for now to prevent paver warnings
  -        #extra_requires={
  -        #    "Plotman": ['PyQt4']
  -        #},
           install_requires=[
               'numpy>1.6.0',
               'astropy>=0.3.0',
               'scipy',
  - #           'suds',
               'pandas>=0.10.0',
               'matplotlib>=1.1',
  -            'glymur>=0.5.9',
  - #           'beautifulsoup4',
               'sqlalchemy',
           ],
           license="BSD",
  
verification_info: {"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -109,19 +109,12 @@\n         classifiers=CLASSIFIERS,\n         description=DOCLINES[0],\n         download_url=\"http://www.sunpy.org/download/\",\n-        # 2011/11/21: disabling for now to prevent paver warnings\n-        #extra_requires={\n-        #    \"Plotman\": ['PyQt4']\n-        #},\n         install_requires=[\n             'numpy>1.6.0',\n             'astropy>=0.3.0',\n             'scipy',\n- #           'suds',\n             'pandas>=0.10.0',\n             'matplotlib>=1.1',\n-            'glymur>=0.5.9',\n- #           'beautifulsoup4',\n             'sqlalchemy',\n         ],\n         license=\"BSD\",\n", "issue": "Make Glymur an optional dependancy\nThis is \"make io imports optional\"\n\n", "before_files": [{"content": "\"\"\"\nSunPy: Python for Solar Physics\n\nThe SunPy project is an effort to create an open-source software library for\nsolar physics using the Python programming language.\n\"\"\"\nDOCLINES = __doc__.split(\"\\n\")\n\nCLASSIFIERS = [\n    'Development Status :: 3 - Alpha',\n    'Intended Audience :: Science/Research',\n    'Intended Audience :: Developers',\n    'License :: OSI Approved :: BSD License',\n    'Programming Language :: Python',\n    'Programming Language :: Python :: 3',\n    'Topic :: Software Development',\n    'Topic :: Scientific/Engineering',\n    'Topic :: Scientific/Engineering :: Physics',\n    'Operating System :: Microsoft :: Windows',\n    'Operating System :: POSIX',\n    'Operating System :: Unix',\n    'Operating System :: MacOS'\n]\n\nVERSION = '0.3.2'\n\ndef git_description():\n    import subprocess\n    try:\n        out = subprocess.Popen(['git', 'describe', '--tags'], stdout = subprocess.PIPE).communicate()[0]\n        description = out.strip().decode('ascii')\n    except OSError:\n        description = 'Error: could not run git'\n    return description\n\ndef write_version_py():\n    import os\n    if os.path.exists('.git'):\n        GIT_DESCRIPTION = git_description()\n    else:\n        GIT_DESCRIPTION = 'N/A'\n\n    out = open('sunpy/version.py', 'w')\n    template = \"\"\"# This file is automatically generated by SunPy's setup.py\nversion = '%(version)s'\ngit_description = '%(git_description)s'\n\"\"\"\n    try:\n        out.write(template % {'version': VERSION,\n                              'git_description': GIT_DESCRIPTION})\n    finally:\n        out.close()\n\n\ndef install(setup): #pylint: disable=W0621\n    from setuptools import find_packages\n    #Crotate Module\n    from distutils.core import Extension\n    from os.path import dirname, join\n    cwd = dirname(__file__)\n    try:\n        import numpy as np\n    except ImportError:\n        print(\"SunPy WARNING: NumPy must be installed first to build the C extension\")\n\n    if 'np' in locals():\n        module = 'sunpy.image.Crotate'   # import this\n        sourcefiles = [join(cwd, 'sunpy', 'image', 'src', 'rot_extn.c'),\n                       join(cwd, 'sunpy', 'image', 'src', 'transform', 'aff_tr.c')]\n        libs = ['m']\n        # -ON for compile optimise\n        gcc_args = ['-std=c99', '-O3']\n        # gcc_args = ['-std=c99']\n\n        # need *module* name here\n        crotate = Extension(module,\n                            sources = sourcefiles,\n                            libraries = libs,\n                            extra_compile_args = gcc_args,\n                            include_dirs =\n                            [np.get_include(), join(cwd, 'sunpy', 'image', 'src')]\n                            )\n\n        module_ana = 'sunpy.io._pyana'\n        sourcefiles_ana = [join(cwd, 'sunpy', 'io', 'src', 'ana', 'anacompress.c'),\n                       join(cwd, 'sunpy', 'io', 'src', 'ana', 'anadecompress.c'),\n                       join(cwd, 'sunpy', 'io', 'src', 'ana', 'anarw.c'),\n                       join(cwd, 'sunpy', 'io', 'src', 'ana', 'testrw.c'),\n                       join(cwd, 'sunpy', 'io', 'src', 'ana', '_pyana.c')]\n\n        ana = Extension(module_ana,\n                            sources = sourcefiles_ana,\n                            libraries = libs,\n                            extra_compile_args = gcc_args,\n                            include_dirs =\n                            [np.get_include(), join(cwd, 'sunpy', 'io', 'src')]\n                            )\n    ext_modules = []\n    if 'crotate' in locals():\n        ext_modules.append(crotate)\n    if 'ana' in locals():\n        ext_modules.append(ana)\n\n    write_version_py()\n\n    setup(\n\tauthor=\"Steven Christe, Matt Earnshaw,  Russell Hewett, Keith Hughitt, Jack Ireland, Florian Mayer, Stuart Mumford,  Albert Shih, David Perez-Suarez et. al\",\n        author_email=\"sunpy@googlegroups.com\",\n        classifiers=CLASSIFIERS,\n        description=DOCLINES[0],\n        download_url=\"http://www.sunpy.org/download/\",\n        # 2011/11/21: disabling for now to prevent paver warnings\n        #extra_requires={\n        #    \"Plotman\": ['PyQt4']\n        #},\n        install_requires=[\n            'numpy>1.6.0',\n            'astropy>=0.3.0',\n            'scipy',\n #           'suds',\n            'pandas>=0.10.0',\n            'matplotlib>=1.1',\n            'glymur>=0.5.9',\n #           'beautifulsoup4',\n            'sqlalchemy',\n        ],\n        license=\"BSD\",\n        long_description=\"\\n\".join(DOCLINES[2:]),\n        maintainer=\"SunPy Developers\",\n        maintainer_email=\"sunpy@googlegroups.com\",\n        name=\"sunpy\",\n        packages=find_packages(),\n        package_data={'': ['*.fits', '*.fit', 'sunpyrc']},\n        platforms=[\"Windows\", \"Linux\", \"Solaris\", \"Mac OS-X\", \"Unix\"],\n        provides=['sunpy'],\n        url=\"http://www.sunpy.org/\",\n        use_2to3=True,\n        version=VERSION,\n        ext_modules = ext_modules\n    )\n\nif __name__ == '__main__':\n    from distribute_setup import use_setuptools\n    use_setuptools()\n    from setuptools import setup\n    install(setup)\n", "path": "setup.py"}], "after_files": [{"content": "\"\"\"\nSunPy: Python for Solar Physics\n\nThe SunPy project is an effort to create an open-source software library for\nsolar physics using the Python programming language.\n\"\"\"\nDOCLINES = __doc__.split(\"\\n\")\n\nCLASSIFIERS = [\n    'Development Status :: 3 - Alpha',\n    'Intended Audience :: Science/Research',\n    'Intended Audience :: Developers',\n    'License :: OSI Approved :: BSD License',\n    'Programming Language :: Python',\n    'Programming Language :: Python :: 3',\n    'Topic :: Software Development',\n    'Topic :: Scientific/Engineering',\n    'Topic :: Scientific/Engineering :: Physics',\n    'Operating System :: Microsoft :: Windows',\n    'Operating System :: POSIX',\n    'Operating System :: Unix',\n    'Operating System :: MacOS'\n]\n\nVERSION = '0.3.2'\n\ndef git_description():\n    import subprocess\n    try:\n        out = subprocess.Popen(['git', 'describe', '--tags'], stdout = subprocess.PIPE).communicate()[0]\n        description = out.strip().decode('ascii')\n    except OSError:\n        description = 'Error: could not run git'\n    return description\n\ndef write_version_py():\n    import os\n    if os.path.exists('.git'):\n        GIT_DESCRIPTION = git_description()\n    else:\n        GIT_DESCRIPTION = 'N/A'\n\n    out = open('sunpy/version.py', 'w')\n    template = \"\"\"# This file is automatically generated by SunPy's setup.py\nversion = '%(version)s'\ngit_description = '%(git_description)s'\n\"\"\"\n    try:\n        out.write(template % {'version': VERSION,\n                              'git_description': GIT_DESCRIPTION})\n    finally:\n        out.close()\n\n\ndef install(setup): #pylint: disable=W0621\n    from setuptools import find_packages\n    #Crotate Module\n    from distutils.core import Extension\n    from os.path import dirname, join\n    cwd = dirname(__file__)\n    try:\n        import numpy as np\n    except ImportError:\n        print(\"SunPy WARNING: NumPy must be installed first to build the C extension\")\n\n    if 'np' in locals():\n        module = 'sunpy.image.Crotate'   # import this\n        sourcefiles = [join(cwd, 'sunpy', 'image', 'src', 'rot_extn.c'),\n                       join(cwd, 'sunpy', 'image', 'src', 'transform', 'aff_tr.c')]\n        libs = ['m']\n        # -ON for compile optimise\n        gcc_args = ['-std=c99', '-O3']\n        # gcc_args = ['-std=c99']\n\n        # need *module* name here\n        crotate = Extension(module,\n                            sources = sourcefiles,\n                            libraries = libs,\n                            extra_compile_args = gcc_args,\n                            include_dirs =\n                            [np.get_include(), join(cwd, 'sunpy', 'image', 'src')]\n                            )\n\n        module_ana = 'sunpy.io._pyana'\n        sourcefiles_ana = [join(cwd, 'sunpy', 'io', 'src', 'ana', 'anacompress.c'),\n                       join(cwd, 'sunpy', 'io', 'src', 'ana', 'anadecompress.c'),\n                       join(cwd, 'sunpy', 'io', 'src', 'ana', 'anarw.c'),\n                       join(cwd, 'sunpy', 'io', 'src', 'ana', 'testrw.c'),\n                       join(cwd, 'sunpy', 'io', 'src', 'ana', '_pyana.c')]\n\n        ana = Extension(module_ana,\n                            sources = sourcefiles_ana,\n                            libraries = libs,\n                            extra_compile_args = gcc_args,\n                            include_dirs =\n                            [np.get_include(), join(cwd, 'sunpy', 'io', 'src')]\n                            )\n    ext_modules = []\n    if 'crotate' in locals():\n        ext_modules.append(crotate)\n    if 'ana' in locals():\n        ext_modules.append(ana)\n\n    write_version_py()\n\n    setup(\n\tauthor=\"Steven Christe, Matt Earnshaw,  Russell Hewett, Keith Hughitt, Jack Ireland, Florian Mayer, Stuart Mumford,  Albert Shih, David Perez-Suarez et. al\",\n        author_email=\"sunpy@googlegroups.com\",\n        classifiers=CLASSIFIERS,\n        description=DOCLINES[0],\n        download_url=\"http://www.sunpy.org/download/\",\n        install_requires=[\n            'numpy>1.6.0',\n            'astropy>=0.3.0',\n            'scipy',\n            'pandas>=0.10.0',\n            'matplotlib>=1.1',\n            'sqlalchemy',\n        ],\n        license=\"BSD\",\n        long_description=\"\\n\".join(DOCLINES[2:]),\n        maintainer=\"SunPy Developers\",\n        maintainer_email=\"sunpy@googlegroups.com\",\n        name=\"sunpy\",\n        packages=find_packages(),\n        package_data={'': ['*.fits', '*.fit', 'sunpyrc']},\n        platforms=[\"Windows\", \"Linux\", \"Solaris\", \"Mac OS-X\", \"Unix\"],\n        provides=['sunpy'],\n        url=\"http://www.sunpy.org/\",\n        use_2to3=True,\n        version=VERSION,\n        ext_modules = ext_modules\n    )\n\nif __name__ == '__main__':\n    from distribute_setup import use_setuptools\n    use_setuptools()\n    from setuptools import setup\n    install(setup)\n", "path": "setup.py"}]}