We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Remove upper requirement on the astropy version
Is there any reason for having the upper version bound on astropy (`astropy>=2.0.3,<3.0.0`) in the requirements file? Is this just that PyCBC is not yet completely Python 3 compatible yet? From looking at the locations where astropy is used in the code, and testing them with astropy v3.1.2 installed, I don't seem to see any problems.

If the issue is that not having the upper bound makes the test suite try and download a non-Python 2 compatible astropy version, you could edit the requirements file to, e.g.,

```
astropy>=2.0.3,<3.0.0; python_version <= '2.7'
astropy>=2.0.3; python_version > '3.4'
```

--- 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 #!/usr/bin/env python
2 # Copyright (C) 2012 Alex Nitz, Duncan Brown, Andrew Miller, Josh Willis
3 #
4 # This program is free software; you can redistribute it and/or modify it
5 # under the terms of the GNU General Public License as published by the
6 # Free Software Foundation; either version 2 of the License, or (at your
7 # option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
12 # Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License along
15 # with this program; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 
18 """
19 setup.py file for PyCBC package
20 """
21 
22 from __future__ import print_function
23 
24 import os, sys, subprocess, shutil
25 
26 from distutils.errors import DistutilsError
27 from distutils.command.clean import clean as _clean
28 
29 from setuptools.command.install import install as _install
30 from setuptools import Extension, setup, Command
31 from setuptools.command.build_ext import build_ext as _build_ext
32 from setuptools import find_packages
33 
34 PY3 = sys.version_info[0] == 3
35 
36 requires = []
37 setup_requires = ['numpy>=1.13.0,<1.15.3',]
38 install_requires =  setup_requires + ['Mako>=1.0.1',
39                       'cython',
40                       'decorator>=3.4.2',
41                       'scipy>=0.16.0',
42                       'matplotlib>=1.5.1',
43                       'pillow',
44                       'h5py>=2.5',
45                       'jinja2',
46                       'astropy>=2.0.3,<3.0.0',
47                       'mpld3>=0.3',
48                       'lscsoft-glue>=1.59.3',
49                       'emcee==2.2.1',
50                       'requests>=1.2.1',
51                       'beautifulsoup4>=4.6.0',
52                       'six>=1.10.0',
53                       'ligo-segments',
54                       ]
55 
56 if not PY3:
57     install_requires += ['weave>=0.16.0']
58 
59 def find_files(dirname, relpath=None):
60     def find_paths(dirname):
61         items = []
62         for fname in os.listdir(dirname):
63             path = os.path.join(dirname, fname)
64             if os.path.isdir(path):
65                 items += find_paths(path)
66             elif not path.endswith(".py") and not path.endswith(".pyc"):
67                 items.append(path)
68         return items
69     items = find_paths(dirname)
70     if relpath is None:
71         relpath = dirname
72     return [os.path.relpath(path, relpath) for path in items]
73 
74 class cbuild_ext(_build_ext):
75     def run(self):
76         import pkg_resources
77 
78         # At this point we can be sure pip has already installed numpy
79         numpy_incl = pkg_resources.resource_filename('numpy', 'core/include')
80 
81         for ext in self.extensions:
82             if (hasattr(ext, 'include_dirs') and
83                     numpy_incl not in ext.include_dirs):
84                 ext.include_dirs.append(numpy_incl)
85 
86         _build_ext.run(self)
87 
88 
89 # Add swig-generated files to the list of things to clean, so they
90 # get regenerated each time.
91 class clean(_clean):
92     def finalize_options (self):
93         _clean.finalize_options(self)
94         self.clean_files = []
95         self.clean_folders = ['docs/_build']
96     def run(self):
97         _clean.run(self)
98         for f in self.clean_files:
99             try:
100                 os.unlink(f)
101                 print('removed {0}'.format(f))
102             except:
103                 pass
104 
105         for fol in self.clean_folders:
106             shutil.rmtree(fol, ignore_errors=True)
107             print('removed {0}'.format(fol))
108 
109 # write versioning info
110 def get_version_info():
111     """Get VCS info and write version info to version.py
112     """
113     from pycbc import _version_helper
114 
115     class vdummy(object):
116         def __getattr__(self, attr):
117             return ''
118 
119     # If this is a pycbc git repo always populate version information using GIT
120     try:
121         vinfo = _version_helper.generate_git_version_info()
122     except:
123         vinfo = vdummy()
124         vinfo.version = '1.13.dev6'
125         vinfo.release = 'False'
126 
127     with open('pycbc/version.py', 'w') as f:
128         f.write("# coding: utf-8\n")
129         f.write("# Generated by setup.py for PyCBC on %s.\n\n"
130                 % vinfo.build_date)
131 
132         # print general info
133         f.write('version = \'%s\'\n' % vinfo.version)
134         f.write('date = \'%s\'\n' % vinfo.date)
135         f.write('release = %s\n' % vinfo.release)
136         f.write('last_release = \'%s\'\n' % vinfo.last_release)
137 
138         # print git info
139         f.write('\ngit_hash = \'%s\'\n' % vinfo.hash)
140         f.write('git_branch = \'%s\'\n' % vinfo.branch)
141         f.write('git_tag = \'%s\'\n' % vinfo.tag)
142         f.write('git_author = \'%s\'\n' % vinfo.author)
143         f.write('git_committer = \'%s\'\n' % vinfo.committer)
144         f.write('git_status = \'%s\'\n' % vinfo.status)
145         f.write('git_builder = \'%s\'\n' % vinfo.builder)
146         f.write('git_build_date = \'%s\'\n' % vinfo.build_date)
147         f.write('git_verbose_msg = """Version: %s\n'
148                 'Branch: %s\n'
149                 'Tag: %s\n'
150                 'Id: %s\n'
151                 'Builder: %s\n'
152                 'Build date: %s\n'
153                 'Repository status is %s"""\n' %(
154                                                vinfo.version,
155                                                vinfo.branch,
156                                                vinfo.tag,
157                                                vinfo.hash,
158                                                vinfo.builder,
159                                                vinfo.build_date,
160                                                vinfo.status))
161         f.write('from pycbc._version import *\n')
162         version = vinfo.version
163 
164     from pycbc import version
165     version = version.version
166     return version
167 
168 class build_docs(Command):
169     user_options = []
170     description = "Build the documentation pages"
171     def initialize_options(self):
172         pass
173     def finalize_options(self):
174         pass
175     def run(self):
176         subprocess.check_call("cd docs; cp Makefile.std Makefile; cp conf_std.py conf.py; sphinx-apidoc "
177                               " -o ./ -f -A 'PyCBC dev team' -V '0.1' ../pycbc && make html",
178                             stderr=subprocess.STDOUT, shell=True)
179 
180 class build_gh_pages(Command):
181     user_options = []
182     description = "Build the documentation pages for GitHub"
183     def initialize_options(self):
184         pass
185     def finalize_options(self):
186         pass
187     def run(self):
188         subprocess.check_call("mkdir -p _gh-pages/latest && touch _gh-pages/.nojekyll && "
189                               "cd docs; cp Makefile.gh_pages Makefile; cp conf_std.py conf.py; sphinx-apidoc "
190                               " -o ./ -f -A 'PyCBC dev team' -V '0.1' ../pycbc && make html",
191                             stderr=subprocess.STDOUT, shell=True)
192 
193 cmdclass = { 'build_docs' : build_docs,
194              'build_gh_pages' : build_gh_pages,
195              'clean' : clean,
196              'build_ext':cbuild_ext
197             }
198 
199 extras_require = {'cuda': ['pycuda>=2015.1', 'scikit-cuda']}
200 
201 # do the actual work of building the package
202 VERSION = get_version_info()
203 
204 cythonext = ['waveform.spa_tmplt',
205              'waveform.utils',
206              'types.array',
207              'filter.matchedfilter']
208 ext = []
209 for name in cythonext:
210     e = Extension("pycbc.%s_cpu" % name,
211                   ["pycbc/%s_cpu.pyx" % name.replace('.', '/')],
212                   extra_compile_args=[ '-O3', '-w', '-msse4.2',
213                                  '-ffast-math', '-ffinite-math-only'],
214                   compiler_directives={'embedsignature': True})
215     ext.append(e)
216 
217 setup (
218     name = 'PyCBC',
219     version = VERSION,
220     description = 'Core library to analyze gravitational-wave data, find signals, and study their parameters.',
221     long_description = open('descr.rst').read(),
222     author = 'Ligo-Virgo Collaborations and the PyCBC team',
223     author_email = 'alex.nitz@gmail.org',
224     url = 'http://www.pycbc.org/',
225     download_url = 'https://github.com/gwastro/pycbc/tarball/v%s' % VERSION,
226     keywords = ['ligo', 'physics', 'gravity', 'signal processing', 'gravitational waves'],
227     cmdclass = cmdclass,
228     setup_requires = setup_requires,
229     extras_require = extras_require,
230     install_requires = install_requires,
231     scripts  = find_files('bin', relpath='./') + ['tools/einsteinathome/pycbc_build_eah.sh'],
232     packages = find_packages(),
233     package_data = {'pycbc.workflow': find_files('pycbc/workflow'),
234                     'pycbc.results': find_files('pycbc/results'),
235                     'pycbc.tmpltbank': find_files('pycbc/tmpltbank')},
236     ext_modules = ext,
237     classifiers=[
238         'Programming Language :: Python',
239         'Programming Language :: Python :: 2',
240         'Programming Language :: Python :: 2.7',
241         'Intended Audience :: Science/Research',
242         'Natural Language :: English',
243         'Topic :: Scientific/Engineering',
244         'Topic :: Scientific/Engineering :: Astronomy',
245         'Topic :: Scientific/Engineering :: Physics',
246         'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
247     ],
248 )
249
```
--- 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()

```

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -43,7 +43,8 @@
                       'pillow',
                       'h5py>=2.5',
                       'jinja2',
-                      'astropy>=2.0.3,<3.0.0',
+                      'astropy>=2.0.3,<3.0.0; python_version <= "2.7"',
+                      'astropy>=2.0.3; python_version > "3.4"',
                       'mpld3>=0.3',
                       'lscsoft-glue>=1.59.3',
                       'emcee==2.2.1',

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -43,7 +43,8 @@\n                       'pillow',\n                       'h5py>=2.5',\n                       'jinja2',\n-                      'astropy>=2.0.3,<3.0.0',\n+                      'astropy>=2.0.3,<3.0.0; python_version <= \"2.7\"',\n+                      'astropy>=2.0.3; python_version > \"3.4\"',\n                       'mpld3>=0.3',\n                       'lscsoft-glue>=1.59.3',\n                       'emcee==2.2.1',\n", "issue": "Remove upper requirement on the astropy version\nIs there any reason for having the upper version bound on astropy (`astropy>=2.0.3,<3.0.0`) in the requirements file? Is this just that PyCBC is not yet completely Python 3 compatible yet? From looking at the locations where astropy is used in the code, and testing them with astropy v3.1.2 installed, I don't seem to see any problems.\r\n\r\nIf the issue is that not having the upper bound makes the test suite try and download a non-Python 2 compatible astropy version, you could edit the requirements file to, e.g.,\r\n\r\n```\r\nastropy>=2.0.3,<3.0.0; python_version <= '2.7'\r\nastropy>=2.0.3; python_version > '3.4'\r\n```\n", "before_files": [{"content": "#!/usr/bin/env python\n# Copyright (C) 2012 Alex Nitz, Duncan Brown, Andrew Miller, Josh Willis\n#\n# This program is free software; you can redistribute it and/or modify it\n# under the terms of the GNU General Public License as published by the\n# Free Software Foundation; either version 2 of the License, or (at your\n# option) any later version.\n#\n# This program is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General\n# Public License for more details.\n#\n# You should have received a copy of the GNU General Public License along\n# with this program; if not, write to the Free Software Foundation, Inc.,\n# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n\n\"\"\"\nsetup.py file for PyCBC package\n\"\"\"\n\nfrom __future__ import print_function\n\nimport os, sys, subprocess, shutil\n\nfrom distutils.errors import DistutilsError\nfrom distutils.command.clean import clean as _clean\n\nfrom setuptools.command.install import install as _install\nfrom setuptools import Extension, setup, Command\nfrom setuptools.command.build_ext import build_ext as _build_ext\nfrom setuptools import find_packages\n\nPY3 = sys.version_info[0] == 3\n\nrequires = []\nsetup_requires = ['numpy>=1.13.0,<1.15.3',]\ninstall_requires =  setup_requires + ['Mako>=1.0.1',\n                      'cython',\n                      'decorator>=3.4.2',\n                      'scipy>=0.16.0',\n                      'matplotlib>=1.5.1',\n                      'pillow',\n                      'h5py>=2.5',\n                      'jinja2',\n                      'astropy>=2.0.3,<3.0.0',\n                      'mpld3>=0.3',\n                      'lscsoft-glue>=1.59.3',\n                      'emcee==2.2.1',\n                      'requests>=1.2.1',\n                      'beautifulsoup4>=4.6.0',\n                      'six>=1.10.0',\n                      'ligo-segments',\n                      ]\n\nif not PY3:\n    install_requires += ['weave>=0.16.0']\n\ndef find_files(dirname, relpath=None):\n    def find_paths(dirname):\n        items = []\n        for fname in os.listdir(dirname):\n            path = os.path.join(dirname, fname)\n            if os.path.isdir(path):\n                items += find_paths(path)\n            elif not path.endswith(\".py\") and not path.endswith(\".pyc\"):\n                items.append(path)\n        return items\n    items = find_paths(dirname)\n    if relpath is None:\n        relpath = dirname\n    return [os.path.relpath(path, relpath) for path in items]\n\nclass cbuild_ext(_build_ext):\n    def run(self):\n        import pkg_resources\n\n        # At this point we can be sure pip has already installed numpy\n        numpy_incl = pkg_resources.resource_filename('numpy', 'core/include')\n\n        for ext in self.extensions:\n            if (hasattr(ext, 'include_dirs') and\n                    numpy_incl not in ext.include_dirs):\n                ext.include_dirs.append(numpy_incl)\n\n        _build_ext.run(self)\n\n\n# Add swig-generated files to the list of things to clean, so they\n# get regenerated each time.\nclass clean(_clean):\n    def finalize_options (self):\n        _clean.finalize_options(self)\n        self.clean_files = []\n        self.clean_folders = ['docs/_build']\n    def run(self):\n        _clean.run(self)\n        for f in self.clean_files:\n            try:\n                os.unlink(f)\n                print('removed {0}'.format(f))\n            except:\n                pass\n\n        for fol in self.clean_folders:\n            shutil.rmtree(fol, ignore_errors=True)\n            print('removed {0}'.format(fol))\n\n# write versioning info\ndef get_version_info():\n    \"\"\"Get VCS info and write version info to version.py\n    \"\"\"\n    from pycbc import _version_helper\n\n    class vdummy(object):\n        def __getattr__(self, attr):\n            return ''\n\n    # If this is a pycbc git repo always populate version information using GIT\n    try:\n        vinfo = _version_helper.generate_git_version_info()\n    except:\n        vinfo = vdummy()\n        vinfo.version = '1.13.dev6'\n        vinfo.release = 'False'\n\n    with open('pycbc/version.py', 'w') as f:\n        f.write(\"# coding: utf-8\\n\")\n        f.write(\"# Generated by setup.py for PyCBC on %s.\\n\\n\"\n                % vinfo.build_date)\n\n        # print general info\n        f.write('version = \\'%s\\'\\n' % vinfo.version)\n        f.write('date = \\'%s\\'\\n' % vinfo.date)\n        f.write('release = %s\\n' % vinfo.release)\n        f.write('last_release = \\'%s\\'\\n' % vinfo.last_release)\n\n        # print git info\n        f.write('\\ngit_hash = \\'%s\\'\\n' % vinfo.hash)\n        f.write('git_branch = \\'%s\\'\\n' % vinfo.branch)\n        f.write('git_tag = \\'%s\\'\\n' % vinfo.tag)\n        f.write('git_author = \\'%s\\'\\n' % vinfo.author)\n        f.write('git_committer = \\'%s\\'\\n' % vinfo.committer)\n        f.write('git_status = \\'%s\\'\\n' % vinfo.status)\n        f.write('git_builder = \\'%s\\'\\n' % vinfo.builder)\n        f.write('git_build_date = \\'%s\\'\\n' % vinfo.build_date)\n        f.write('git_verbose_msg = \"\"\"Version: %s\\n'\n                'Branch: %s\\n'\n                'Tag: %s\\n'\n                'Id: %s\\n'\n                'Builder: %s\\n'\n                'Build date: %s\\n'\n                'Repository status is %s\"\"\"\\n' %(\n                                               vinfo.version,\n                                               vinfo.branch,\n                                               vinfo.tag,\n                                               vinfo.hash,\n                                               vinfo.builder,\n                                               vinfo.build_date,\n                                               vinfo.status))\n        f.write('from pycbc._version import *\\n')\n        version = vinfo.version\n\n    from pycbc import version\n    version = version.version\n    return version\n\nclass build_docs(Command):\n    user_options = []\n    description = \"Build the documentation pages\"\n    def initialize_options(self):\n        pass\n    def finalize_options(self):\n        pass\n    def run(self):\n        subprocess.check_call(\"cd docs; cp Makefile.std Makefile; cp conf_std.py conf.py; sphinx-apidoc \"\n                              \" -o ./ -f -A 'PyCBC dev team' -V '0.1' ../pycbc && make html\",\n                            stderr=subprocess.STDOUT, shell=True)\n\nclass build_gh_pages(Command):\n    user_options = []\n    description = \"Build the documentation pages for GitHub\"\n    def initialize_options(self):\n        pass\n    def finalize_options(self):\n        pass\n    def run(self):\n        subprocess.check_call(\"mkdir -p _gh-pages/latest && touch _gh-pages/.nojekyll && \"\n                              \"cd docs; cp Makefile.gh_pages Makefile; cp conf_std.py conf.py; sphinx-apidoc \"\n                              \" -o ./ -f -A 'PyCBC dev team' -V '0.1' ../pycbc && make html\",\n                            stderr=subprocess.STDOUT, shell=True)\n\ncmdclass = { 'build_docs' : build_docs,\n             'build_gh_pages' : build_gh_pages,\n             'clean' : clean,\n             'build_ext':cbuild_ext\n            }\n\nextras_require = {'cuda': ['pycuda>=2015.1', 'scikit-cuda']}\n\n# do the actual work of building the package\nVERSION = get_version_info()\n\ncythonext = ['waveform.spa_tmplt',\n             'waveform.utils',\n             'types.array',\n             'filter.matchedfilter']\next = []\nfor name in cythonext:\n    e = Extension(\"pycbc.%s_cpu\" % name,\n                  [\"pycbc/%s_cpu.pyx\" % name.replace('.', '/')],\n                  extra_compile_args=[ '-O3', '-w', '-msse4.2',\n                                 '-ffast-math', '-ffinite-math-only'],\n                  compiler_directives={'embedsignature': True})\n    ext.append(e)\n\nsetup (\n    name = 'PyCBC',\n    version = VERSION,\n    description = 'Core library to analyze gravitational-wave data, find signals, and study their parameters.',\n    long_description = open('descr.rst').read(),\n    author = 'Ligo-Virgo Collaborations and the PyCBC team',\n    author_email = 'alex.nitz@gmail.org',\n    url = 'http://www.pycbc.org/',\n    download_url = 'https://github.com/gwastro/pycbc/tarball/v%s' % VERSION,\n    keywords = ['ligo', 'physics', 'gravity', 'signal processing', 'gravitational waves'],\n    cmdclass = cmdclass,\n    setup_requires = setup_requires,\n    extras_require = extras_require,\n    install_requires = install_requires,\n    scripts  = find_files('bin', relpath='./') + ['tools/einsteinathome/pycbc_build_eah.sh'],\n    packages = find_packages(),\n    package_data = {'pycbc.workflow': find_files('pycbc/workflow'),\n                    'pycbc.results': find_files('pycbc/results'),\n                    'pycbc.tmpltbank': find_files('pycbc/tmpltbank')},\n    ext_modules = ext,\n    classifiers=[\n        'Programming Language :: Python',\n        'Programming Language :: Python :: 2',\n        'Programming Language :: Python :: 2.7',\n        'Intended Audience :: Science/Research',\n        'Natural Language :: English',\n        'Topic :: Scientific/Engineering',\n        'Topic :: Scientific/Engineering :: Astronomy',\n        'Topic :: Scientific/Engineering :: Physics',\n        'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',\n    ],\n)\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# Copyright (C) 2012 Alex Nitz, Duncan Brown, Andrew Miller, Josh Willis\n#\n# This program is free software; you can redistribute it and/or modify it\n# under the terms of the GNU General Public License as published by the\n# Free Software Foundation; either version 2 of the License, or (at your\n# option) any later version.\n#\n# This program is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General\n# Public License for more details.\n#\n# You should have received a copy of the GNU General Public License along\n# with this program; if not, write to the Free Software Foundation, Inc.,\n# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n\n\"\"\"\nsetup.py file for PyCBC package\n\"\"\"\n\nfrom __future__ import print_function\n\nimport os, sys, subprocess, shutil\n\nfrom distutils.errors import DistutilsError\nfrom distutils.command.clean import clean as _clean\n\nfrom setuptools.command.install import install as _install\nfrom setuptools import Extension, setup, Command\nfrom setuptools.command.build_ext import build_ext as _build_ext\nfrom setuptools import find_packages\n\nPY3 = sys.version_info[0] == 3\n\nrequires = []\nsetup_requires = ['numpy>=1.13.0,<1.15.3',]\ninstall_requires =  setup_requires + ['Mako>=1.0.1',\n                      'cython',\n                      'decorator>=3.4.2',\n                      'scipy>=0.16.0',\n                      'matplotlib>=1.5.1',\n                      'pillow',\n                      'h5py>=2.5',\n                      'jinja2',\n                      'astropy>=2.0.3,<3.0.0; python_version <= \"2.7\"',\n                      'astropy>=2.0.3; python_version > \"3.4\"',\n                      'mpld3>=0.3',\n                      'lscsoft-glue>=1.59.3',\n                      'emcee==2.2.1',\n                      'requests>=1.2.1',\n                      'beautifulsoup4>=4.6.0',\n                      'six>=1.10.0',\n                      'ligo-segments',\n                      ]\n\nif not PY3:\n    install_requires += ['weave>=0.16.0']\n\ndef find_files(dirname, relpath=None):\n    def find_paths(dirname):\n        items = []\n        for fname in os.listdir(dirname):\n            path = os.path.join(dirname, fname)\n            if os.path.isdir(path):\n                items += find_paths(path)\n            elif not path.endswith(\".py\") and not path.endswith(\".pyc\"):\n                items.append(path)\n        return items\n    items = find_paths(dirname)\n    if relpath is None:\n        relpath = dirname\n    return [os.path.relpath(path, relpath) for path in items]\n\nclass cbuild_ext(_build_ext):\n    def run(self):\n        import pkg_resources\n\n        # At this point we can be sure pip has already installed numpy\n        numpy_incl = pkg_resources.resource_filename('numpy', 'core/include')\n\n        for ext in self.extensions:\n            if (hasattr(ext, 'include_dirs') and\n                    numpy_incl not in ext.include_dirs):\n                ext.include_dirs.append(numpy_incl)\n\n        _build_ext.run(self)\n\n\n# Add swig-generated files to the list of things to clean, so they\n# get regenerated each time.\nclass clean(_clean):\n    def finalize_options (self):\n        _clean.finalize_options(self)\n        self.clean_files = []\n        self.clean_folders = ['docs/_build']\n    def run(self):\n        _clean.run(self)\n        for f in self.clean_files:\n            try:\n                os.unlink(f)\n                print('removed {0}'.format(f))\n            except:\n                pass\n\n        for fol in self.clean_folders:\n            shutil.rmtree(fol, ignore_errors=True)\n            print('removed {0}'.format(fol))\n\n# write versioning info\ndef get_version_info():\n    \"\"\"Get VCS info and write version info to version.py\n    \"\"\"\n    from pycbc import _version_helper\n\n    class vdummy(object):\n        def __getattr__(self, attr):\n            return ''\n\n    # If this is a pycbc git repo always populate version information using GIT\n    try:\n        vinfo = _version_helper.generate_git_version_info()\n    except:\n        vinfo = vdummy()\n        vinfo.version = '1.13.dev6'\n        vinfo.release = 'False'\n\n    with open('pycbc/version.py', 'w') as f:\n        f.write(\"# coding: utf-8\\n\")\n        f.write(\"# Generated by setup.py for PyCBC on %s.\\n\\n\"\n                % vinfo.build_date)\n\n        # print general info\n        f.write('version = \\'%s\\'\\n' % vinfo.version)\n        f.write('date = \\'%s\\'\\n' % vinfo.date)\n        f.write('release = %s\\n' % vinfo.release)\n        f.write('last_release = \\'%s\\'\\n' % vinfo.last_release)\n\n        # print git info\n        f.write('\\ngit_hash = \\'%s\\'\\n' % vinfo.hash)\n        f.write('git_branch = \\'%s\\'\\n' % vinfo.branch)\n        f.write('git_tag = \\'%s\\'\\n' % vinfo.tag)\n        f.write('git_author = \\'%s\\'\\n' % vinfo.author)\n        f.write('git_committer = \\'%s\\'\\n' % vinfo.committer)\n        f.write('git_status = \\'%s\\'\\n' % vinfo.status)\n        f.write('git_builder = \\'%s\\'\\n' % vinfo.builder)\n        f.write('git_build_date = \\'%s\\'\\n' % vinfo.build_date)\n        f.write('git_verbose_msg = \"\"\"Version: %s\\n'\n                'Branch: %s\\n'\n                'Tag: %s\\n'\n                'Id: %s\\n'\n                'Builder: %s\\n'\n                'Build date: %s\\n'\n                'Repository status is %s\"\"\"\\n' %(\n                                               vinfo.version,\n                                               vinfo.branch,\n                                               vinfo.tag,\n                                               vinfo.hash,\n                                               vinfo.builder,\n                                               vinfo.build_date,\n                                               vinfo.status))\n        f.write('from pycbc._version import *\\n')\n        version = vinfo.version\n\n    from pycbc import version\n    version = version.version\n    return version\n\nclass build_docs(Command):\n    user_options = []\n    description = \"Build the documentation pages\"\n    def initialize_options(self):\n        pass\n    def finalize_options(self):\n        pass\n    def run(self):\n        subprocess.check_call(\"cd docs; cp Makefile.std Makefile; cp conf_std.py conf.py; sphinx-apidoc \"\n                              \" -o ./ -f -A 'PyCBC dev team' -V '0.1' ../pycbc && make html\",\n                            stderr=subprocess.STDOUT, shell=True)\n\nclass build_gh_pages(Command):\n    user_options = []\n    description = \"Build the documentation pages for GitHub\"\n    def initialize_options(self):\n        pass\n    def finalize_options(self):\n        pass\n    def run(self):\n        subprocess.check_call(\"mkdir -p _gh-pages/latest && touch _gh-pages/.nojekyll && \"\n                              \"cd docs; cp Makefile.gh_pages Makefile; cp conf_std.py conf.py; sphinx-apidoc \"\n                              \" -o ./ -f -A 'PyCBC dev team' -V '0.1' ../pycbc && make html\",\n                            stderr=subprocess.STDOUT, shell=True)\n\ncmdclass = { 'build_docs' : build_docs,\n             'build_gh_pages' : build_gh_pages,\n             'clean' : clean,\n             'build_ext':cbuild_ext\n            }\n\nextras_require = {'cuda': ['pycuda>=2015.1', 'scikit-cuda']}\n\n# do the actual work of building the package\nVERSION = get_version_info()\n\ncythonext = ['waveform.spa_tmplt',\n             'waveform.utils',\n             'types.array',\n             'filter.matchedfilter']\next = []\nfor name in cythonext:\n    e = Extension(\"pycbc.%s_cpu\" % name,\n                  [\"pycbc/%s_cpu.pyx\" % name.replace('.', '/')],\n                  extra_compile_args=[ '-O3', '-w', '-msse4.2',\n                                 '-ffast-math', '-ffinite-math-only'],\n                  compiler_directives={'embedsignature': True})\n    ext.append(e)\n\nsetup (\n    name = 'PyCBC',\n    version = VERSION,\n    description = 'Core library to analyze gravitational-wave data, find signals, and study their parameters.',\n    long_description = open('descr.rst').read(),\n    author = 'Ligo-Virgo Collaborations and the PyCBC team',\n    author_email = 'alex.nitz@gmail.org',\n    url = 'http://www.pycbc.org/',\n    download_url = 'https://github.com/gwastro/pycbc/tarball/v%s' % VERSION,\n    keywords = ['ligo', 'physics', 'gravity', 'signal processing', 'gravitational waves'],\n    cmdclass = cmdclass,\n    setup_requires = setup_requires,\n    extras_require = extras_require,\n    install_requires = install_requires,\n    scripts  = find_files('bin', relpath='./') + ['tools/einsteinathome/pycbc_build_eah.sh'],\n    packages = find_packages(),\n    package_data = {'pycbc.workflow': find_files('pycbc/workflow'),\n                    'pycbc.results': find_files('pycbc/results'),\n                    'pycbc.tmpltbank': find_files('pycbc/tmpltbank')},\n    ext_modules = ext,\n    classifiers=[\n        'Programming Language :: Python',\n        'Programming Language :: Python :: 2',\n        'Programming Language :: Python :: 2.7',\n        'Intended Audience :: Science/Research',\n        'Natural Language :: English',\n        'Topic :: Scientific/Engineering',\n        'Topic :: Scientific/Engineering :: Astronomy',\n        'Topic :: Scientific/Engineering :: Physics',\n        'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',\n    ],\n)\n", "path": "setup.py"}]}