Commit 33567a28 authored by Kipp Cannon's avatar Kipp Cannon

setup.py: aesthetics

- convert indenting style to that of this package, compress
parent b8e57142
......@@ -14,85 +14,73 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
"""setup for segments
"""
import os.path
import re
from setuptools import setup, Extension
import sys
from setuptools import (setup, find_packages, Extension)
cmdclass = {}
# get version
def find_version(path):
with open(path, 'r') as fp:
version_file = fp.read()
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
# collect package data
packages = find_packages()
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", open(path).read(), re.M)
if not version_match:
raise RuntimeError("'%s': unable to find __version__ string" % path)
return version_match.group(1)
# declare dependencies
setup_requires = ['setuptools']
install_requires = ['six', 'ligo-common']
cmdclass = {}
# add test dependencies
if {'pytest', 'test', 'prt'}.intersection(sys.argv):
setup_requires.append('pytest_runner')
setup_requires.append('pytest_runner')
# add documentation dependencies
if {'build_sphinx'}.intersection(sys.argv):
setup_requires.extend([
'sphinx',
'sphinx_rtd_theme',
])
from sphinx.setup_command import BuildDoc
cmdclass['build_sphinx'] = BuildDoc
setup_requires.extend([
'sphinx',
'sphinx_rtd_theme',
])
from sphinx.setup_command import BuildDoc
cmdclass['build_sphinx'] = BuildDoc
# define extension
csegments = Extension(
'ligo.__segments',
['src/segments.c', 'src/infinity.c', 'src/segment.c', 'src/segmentlist.c'],
include_dirs=['src'],
)
# run setup
setup(name='ligo-segments',
version=find_version(os.path.join('ligo', 'segments.py')),
description='Representations of semi-open intervals',
author='Kipp Cannon',
author_email='kipp.cannon@ligo.org',
license='GPLv3',
packages=packages,
namespace_packages=['ligo'],
cmdclass=cmdclass,
setup_requires=setup_requires,
install_requires=install_requires,
ext_modules=[csegments],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Intended Audience :: Science/Research',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Developers',
'Natural Language :: English',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Astronomy',
'Topic :: Scientific/Engineering :: Physics',
'Operating System :: POSIX',
'Operating System :: Unix',
'Operating System :: MacOS',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
],
)
setup(
name = 'ligo-segments',
version = find_version(os.path.join('ligo', 'segments.py')),
description = 'Representations of semi-open intervals',
author = 'Kipp Cannon',
author_email = 'kipp.cannon@ligo.org',
license = 'GPLv3',
packages = ['ligo'],
namespace_packages = ['ligo'],
cmdclass = cmdclass,
setup_requires = setup_requires,
install_requires = ['six', 'ligo-common'],
ext_modules = [
Extension(
'ligo.__segments',
['src/segments.c', 'src/infinity.c', 'src/segment.c', 'src/segmentlist.c'],
include_dirs = ['src'],
),
],
classifiers = [
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Intended Audience :: Science/Research',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Developers',
'Natural Language :: English',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Astronomy',
'Topic :: Scientific/Engineering :: Physics',
'Operating System :: POSIX',
'Operating System :: Unix',
'Operating System :: MacOS',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
],
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment