There will be maintenance performed on git.ligo.org, chat.ligo.org, containers.lig.org, and docs.ligo.org starting at 9am PDT on Tuesday 18th August 2020. There will be an extremely small period of downtime at the start of the maintenance window as various services are restarted. Please address any comments, questions, or concerns to computing-help@igwn.org.

setup.py 2.93 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
# Copyright (C) 2016 Duncan Macleod
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.


import os.path
import re
Kipp Cannon's avatar
Kipp Cannon committed
20
from setuptools import setup, Extension
21 22 23 24 25
import sys


# get version
def find_version(path):
Kipp Cannon's avatar
Kipp Cannon committed
26 27 28 29
	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)
30

Kipp Cannon's avatar
Kipp Cannon committed
31
version = find_version(os.path.join('ligo', 'segments', '__init__.py'))
32 33 34 35

# transform ligo-segments.spec.in to ligo-segments.spec
open("ligo-segments.spec", "w").writelines([line.replace("@VERSION@", version) for line in open("ligo-segments.spec.in")])

36 37
# declare dependencies
setup_requires = ['setuptools']
Kipp Cannon's avatar
Kipp Cannon committed
38
cmdclass = {}
39

40
if {'pytest', 'test', 'prt'}.intersection(sys.argv):
Kipp Cannon's avatar
Kipp Cannon committed
41
	setup_requires.append('pytest_runner')
42

43
if {'build_sphinx'}.intersection(sys.argv):
Kipp Cannon's avatar
Kipp Cannon committed
44 45 46 47 48 49
	setup_requires.extend([
		'sphinx',
		'sphinx_rtd_theme',
	])
	from sphinx.setup_command import BuildDoc
	cmdclass['build_sphinx'] = BuildDoc
50

51 52

# run setup
Kipp Cannon's avatar
Kipp Cannon committed
53 54
setup(
	name = 'ligo-segments',
55
	version = version,
Kipp Cannon's avatar
Kipp Cannon committed
56 57 58 59
	description = 'Representations of semi-open intervals',
	author = 'Kipp Cannon',
	author_email = 'kipp.cannon@ligo.org',
	license = 'GPLv3',
Kipp Cannon's avatar
Kipp Cannon committed
60
	packages = ['ligo', 'ligo.segments'],
Kipp Cannon's avatar
Kipp Cannon committed
61 62 63
	namespace_packages = ['ligo'],
	cmdclass = cmdclass,
	setup_requires = setup_requires,
64
	install_requires = ['six'],
Kipp Cannon's avatar
Kipp Cannon committed
65 66
	ext_modules = [
		Extension(
Kipp Cannon's avatar
Kipp Cannon committed
67
			'ligo.segments.__segments',
Kipp Cannon's avatar
Kipp Cannon committed
68 69 70 71 72 73 74 75 76 77 78
			['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',
79
		'Programming Language :: Python :: 3.7',
Kipp Cannon's avatar
Kipp Cannon committed
80 81 82 83 84 85 86 87 88 89 90 91 92
		'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)',
	],
)