Commit 7902d0b3 authored by Duncan Macleod's avatar Duncan Macleod

ligo-segments: added basic packaging setup

- simplifies test Makefile to just run segments_verify.py
- adds setup.py, referencing ligo namespace package
- adds ligo-segments.spec
- adds debian packaging directory
parent 749da01a
include LICENSE MANIFEST.in
include src/*.c
include src/*.h
include ligo-segments.spec
include debian/*
include debian/source/*
include test/*
ligo-segments
=============
Defines the `segment`, `segmentlist`, and `segmentlistdict` objects for manipulating semi-open intervals.
ligo-segments (1.0.0-rc1-1) unstable; urgency=low
* initial commit of debian packaging scripts, not a true release
-- Duncan Macleod <duncan.macleod@ligo.org> Tue, 20 Feb 2018 15:39:00 +0000
Source: ligo-segments
Maintainer: Duncan Macleod <duncan.macleod@ligo.org>
Section: python
Priority: optional
Standards-Version: 4.1.3
X-Python-Version: >= 2.7
X-Python3-Version: >= 3.4
Build-Depends: debhelper (>= 9),
dh-python,
python-all-dev,
python3-all-dev,
python-pytest,
python3-pytest,
python-setuptools,
python3-setuptools,
python-six,
python3-six
Package: python-ligo-segments
Architecture: any
Depends: ${shlibs:Depends},
${misc:Depends},
${python:Depends},
python-six
Description: Representations of semi-open intervals - Python package
ligo-segments provides representation of semi-open intervals or "segments".
The main application of this package is represenation of intervals of time
in gravitational-wave data analysis.
.
This package provides Python 2 modules.
Package: python3-ligo-segments
Architecture: any
Depends: ${shlibs:Depends},
${misc:Depends},
${python3:Depends},
python3-six
Description: Representations of semi-open intervals - Python 3 package
ligo-segments provides representation of semi-open intervals or "segments".
The main application of this package is represenation of intervals of time
in gravitational-wave data analysis.
.
This package provides Python 3 modules.
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://git.ligo.org/lscsoft/ligo-segments
Files: *
Copyright: 2011, LIGO Scientific Collaboration
License: GPL-2+
License: GPL-2+
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 2 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 package; if not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301 USA
.
On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file
`/usr/share/common-licenses/GPL-2'.
#!/usr/bin/make -f
export PYBUILD_NAME := ligo-segments
export PYBUILD_AFTER_TEST := env \
PYTHONPATH={build_dir} \
PYTHONDONTWRITEBYTECODE=1 \
make -C {dir}/test PYTHON={interpreter}
%:
dh $@ --with python2,python3 --buildsystem=pybuild
extend-diff-ignore="\.egg-info$"
Test-Command: set -e ; for py in $(pyversions -r 2>/dev/null) ; do echo "Testing with $py:" ; pushd test ; $py -m pytest . ; popd ; done
Depends: python-all, python-pytest, python-ligo-segments
Test-Command: set -e ; for py in $(py3versions -r 2>/dev/null) ; do echo "Testing with $py:" ; pushd test ; $py -m pytest . ; popd ; done
Depends: python3-all, python3-pytest, python3-ligo-segments
%global srcname ligo-segments
Name: %{srcname}
Version: 1.0.0rc1
Release: 1%{?dist}
Summary: Representations of semi-open intervals
License: GPLv3
URL: https://git.ligo.org/lscsoft/ligo-segments/
Source0: https://files.pythonhosted.org/packages/source/p/%{srcname}/%{srcname}-%{version}.tar.gz
BuildRequires: python3-rpm-macros
BuildRequires: python-devel
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python2-setuptools
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python-six
BuildRequires: python%{python3_pkgversion}-six
BuildRequires: pytest
BuildRequires: python%{python3_pkgversion}-pytest
%description
This module defines the segment and segmentlist objects, as well as the
infinity object used to define semi-infinite and infinite segments.
%package -n python2-%{srcname}
Summary: %{summary}
Requires: python-six
Requires: ligo-common
%{?python_provide:%python_provide python2-%{srcname}}
%description -n python2-%{srcname}
This module defines the segment and segmentlist objects, as well as the
infinity object used to define semi-infinite and infinite segments.
%package -n python%{python3_pkgversion}-%{srcname}
Summary: %{summary}
Requires: python%{python3_pkgversion}-six
Requires: python%{python3_pkgversion}-ligo-common
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
%description -n python%{python3_pkgversion}-%{srcname}
This module defines the segment and segmentlist objects, as well as the
infinity object used to define semi-infinite and infinite segments.
%prep
%autosetup -n %{srcname}-%{version}
%build
%py2_build
%py3_build
%install
%py2_install
%py3_install
%check
cd test
# hack the python site to read from the build path:
echo "import site; site.addsitedir('$RPM_BUILD_ROOT%{python2_sitearch}')" > $RPM_BUILD_ROOT%{python2_sitearch}/sitecustomize.py
echo "import site; site.addsitedir('$RPM_BUILD_ROOT%{python3_sitearch}')" > $RPM_BUILD_ROOT%{python3_sitearch}/sitecustomize.py
# run the tests
make check PYTHON=%{__python2} PYTHONPATH="$RPM_BUILD_ROOT%{python2_sitearch}"
make check PYTHON=%{__python3} PYTHONPATH="$RPM_BUILD_ROOT%{python3_sitearch}"
%files -n python2-%{srcname}
%license LICENSE
%doc README.rst
%{python2_sitearch}/*
%files -n python%{python3_pkgversion}-%{srcname}
%license LICENSE
%doc README.rst
%{python3_sitearch}/*
%changelog
__import__('pkg_resources').declare_namespace(__name__)
......@@ -47,14 +47,12 @@ from bisect import bisect_right as _bisect_right
from copy import copy as _shallowcopy
from glue import git_version
import six
from six.moves import range
__author__ = "Kipp Cannon <kipp.cannon@ligo.org>"
__version__ = "git id %s" % git_version.id
__date__ = git_version.date
__version__ = '1.0.0-rc1'
#
......
# 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.
"""setup for segments
"""
import os.path
import re
import sys
from setuptools import (setup, find_packages, Extension)
# 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()
# declare dependencies
setup_requires = ['setuptools']
install_requires = ['six']
# add test dependencies
if set(('pytest', 'test', 'prt')).intersection(sys.argv):
setup_requires.append('pytest_runner')
# 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',
packages=packages,
namespace_packages=['ligo'],
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)',
],
)
PYTHON ?= python
check : \
glue_ligolw_ilwd_verify \
iterutils_verify \
lal_verify \
ligolw_sqlite_test \
ligolw_test01 \
ligolw_test03a \
ligolw_test03b \
ligolw_test03c \
ligolw_test04 \
ligolw_test05 \
offsetvector_verify \
segments_verify \
segmentsUtils_verify \
test_ligolw_array \
test_ligolw_ligolw \
test_ligolw_lsctables \
test_ligolw_table \
test_ligolw_tokenizer \
test_ligolw_utils \
test_ligolw_utils_segments
segments_verify
@echo "All Tests Passed"
define printpassfail
......@@ -36,113 +17,7 @@ define servefilesstop
{ killall $(PYTHON) ; sleep 1 ; true ; }
endef
glue_ligolw_ilwd_verify :
@echo "=== start glue_ligolw_ilwd_verify ===>"
$(PYTHON) glue_ligolw_ilwd_verify.py && $(printpassfail)
@echo "<=== end glue_ligolw_ilwd_verify ==="
iterutils_verify :
@echo "=== start iterutils_verify ===>"
$(PYTHON) iterutils_verify.py && $(printpassfail)
@echo "<=== end iterutils_verify ==="
lal_verify :
@echo "=== start lal_verify ===>"
$(PYTHON) lal_verify.py && $(printpassfail)
@echo "<=== end lal_verify ==="
ligolw_test01 :
@echo "=== start ligolw_test01 ===>"
# test reading array data from a file
$(PYTHON) ligo_lw_test_01.py && $(printpassfail)
@echo "<=== end ligolw_test01 ==="
ligolw_test03a :
@echo "=== start ligolw_test03a ===>"
# test reading compressed and non-compressed files from stdin
{ cat inspiral_event_id_test_in1.xml.gz | ligolw_print >/dev/null ; } && $(printpassfail)
{ cat inspiral_event_id_test_in2.xml | ligolw_print >/dev/null ; } && $(printpassfail)
@echo "<=== end ligolw_test03a ==="
ligolw_test03b :
@echo "=== start ligolw_test03b ===>"
# test reading compressed and non-compressed files
ligolw_print inspiral_event_id_test_in1.xml.gz >/dev/null && $(printpassfail)
ligolw_print inspiral_event_id_test_in2.xml >/dev/null && $(printpassfail)
@echo "<=== end ligolw_test03b ==="
ligolw_test03c :
@echo "=== start ligolw_test03c ===>"
# test reading compressed and non-compressed files from http:// URLs
$(servefilesstart) && { ligolw_print http://127.0.0.1:$(SERVEFILESPORT)/inspiral_event_id_test_in1.xml.gz >/dev/null && $(printpassfail) ; } ; $(servefilesstop)
$(servefilesstart) && { ligolw_print http://127.0.0.1:$(SERVEFILESPORT)/inspiral_event_id_test_in2.xml >/dev/null && $(printpassfail) ; } ; $(servefilesstop)
@echo "<=== end ligolw_test03c ==="
ligolw_test04 :
@echo "=== start ligolw_test04 ===>"
{ ligolw_cut --delete-table sngl_inspiral <inspiral_event_id_test_in1.xml.gz | cmp ligolw_cut_proof.xml ; } && $(printpassfail)
@echo "<=== end ligolw_test04 ==="
ligolw_test05 :
@echo "=== start ligolw_test05 ===>"
# make sure XML writing code compresses files
FILENAME=$(shell mktemp --suffix .xml.gz) && { ligolw_add --output $${FILENAME} ligolw_sqlite_test_input.xml.gz && gunzip --test $${FILENAME} && $(printpassfail) ; } ; rm -f $${FILENAME}
@echo "<=== end ligolw_test05 ==="
ligolw_sqlite_test :
@echo "=== start ligolw_sqlite_test ===>"
sh ligolw_sqlite_test.sh && $(printpassfail)
@echo "<=== end ligolw_sqlite_test ==="
offsetvector_verify :
@echo "=== start offsetvector_verify ===>"
$(PYTHON) offsetvector_verify.py && $(printpassfail)
@echo "<=== end offsetvector_verify ==="
segmentsUtils_verify :
@echo "=== start segmentsUtils_verify ===>"
$(PYTHON) segmentsUtils_verify.py && $(printpassfail)
@echo "<=== end segmentsUtils_verify ==="
segments_verify :
@echo "=== start segments_verify ===>"
$(PYTHON) segments_verify.py && $(printpassfail)
@echo "<=== end segments_verify ==="
test_ligolw_array :
@echo "=== start test_ligolw_array ===>"
$(PYTHON) test_ligolw_array.py && $(printpassfail)
@echo "<=== end test_ligolw_array ==="
test_ligolw_ligolw :
@echo "=== start test_ligolw_ligolw ===>"
$(PYTHON) test_ligolw_ligolw.py && $(printpassfail)
@echo "<=== end test_ligolw_ligolw ==="
test_ligolw_lsctables :
@echo "=== start test_ligolw_lsctables ===>"
$(PYTHON) test_ligolw_lsctables.py && $(printpassfail)
@echo "<=== end test_ligolw_lsctables ==="
test_ligolw_table :
@echo "=== start test_ligolw_table ===>"
$(PYTHON) test_ligolw_table.py && $(printpassfail)
@echo "<=== end test_ligolw_table ==="
test_ligolw_tokenizer :
@echo "=== start test_ligolw_tokenizer ===>"
$(PYTHON) test_ligolw_tokenizer.py && $(printpassfail)
@echo "<=== end test_ligolw_tokenizer ==="
test_ligolw_utils :
@echo "=== start test_ligolw_utils ===>"
$(PYTHON) test_ligolw_utils.py && $(printpassfail)
@echo "<=== end test_ligolw_utils ==="
test_ligolw_utils_segments :
@echo "=== start test_ligolw_utils_segments ===>"
$(PYTHON) test_ligolw_utils_segments.py && $(printpassfail)
@echo "<=== end test_ligolw_utils_segments ==="
clean :
rm -f ligo_lw_test_01*png
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