Skip to content

Commit

Permalink
added system-level packaging
Browse files Browse the repository at this point in the history
include circle configuration
  • Loading branch information
duncanmmacleod committed Jan 17, 2019
1 parent 3df909d commit 9b80ea0
Show file tree
Hide file tree
Showing 11 changed files with 300 additions and 0 deletions.
96 changes: 96 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,96 @@
version: 2

run-tests: &run-tests
name: Test
command: python -m pytest --cov dqsegdb2 --pyargs dqsegdb2

debian-build: &debian-build
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Build
command: |
set -x;
apt-get -yqq update;
apt-get -yqq install dpkg-dev devscripts;
pushd $(mktemp -d -p .);
tar -xf ../dqsegdb2-*.tar.* --strip-components=1;
mk-build-deps --tool "apt-get -y" --install --remove;
dpkg-buildpackage -us -uc -b;
popd;
dpkg --install python*dqsegdb2*.deb;
- run: *run-tests
- store_artifacts:
path: "*.deb"

centos-build: &centos-build
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Build
command: |
set -x;
yum -y -q update;
yum -y -q install rpm-build yum-utils;
SRPM=$(rpmbuild --define "_topdir $(pwd)" -ts ./dqsegdb2-*.tar.* | cut -d\ -f2);
yum-builddep -y -q ${SRPM};
rpmbuild --define "_rpmdir $(pwd)" --rebuild ${SRPM};
mv noarch/*.rpm .;
yum -y -q --nogpgcheck localinstall ./python*dqsegdb2*.rpm;
- run: *run-tests
- store_artifacts:
path: "*.rpm"

jobs:
sdist:
docker:
- image: python
steps:
- checkout
- run:
name: Build tarball
command: python setup.py --quiet sdist --dist-dir .
- persist_to_workspace:
root: .
paths:
- dqsegdb2-*.tar.*

debian:stretch:2.7:
<<: *debian-build
docker:
- image: ligo/base:stretch
environment:
PYTHON_VERSION: "2.7"

debian:stretch:3.5:
<<: *debian-build
docker:
- image: ligo/base:stretch
environment:
PYTHON_VERSION: "3.5"

el7:2.7:
<<: *centos-build
docker:
- image: ligo/base:el7
environment:
PYTHON_VERSION: "2.7"

workflows:
version: 2
build_and_test:
jobs:
- sdist
- debian:stretch:2.7:
requires:
- sdist
- debian:stretch:3.5:
requires:
- sdist
- el7:2.7:
requires:
- sdist
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,6 +4,7 @@

# build files/directories to ignore
/build/
/dist/
/.cache/
/*.egg-info/
/.eggs/
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
@@ -1 +1,3 @@
include LICENSE
include dqsegdb2.spec
recursive-include debian *
5 changes: 5 additions & 0 deletions debian/changelog
@@ -0,0 +1,5 @@
dqsegdb2 (1.0.0-1) unstable; urgency=low

* first release

-- Duncan Macleod <duncan.macleod@ligo.org> Wed, 01 Aug 2018 19:01:11 +0100
1 change: 1 addition & 0 deletions debian/compat
@@ -0,0 +1 @@
9
55 changes: 55 additions & 0 deletions debian/control
@@ -0,0 +1,55 @@
# -- dqsegdb2 source package --------------------------------------------------

Source: dqsegdb2
Section: python
Priority: optional
Maintainer: Duncan Macleod <duncan.macleod@ligo.org>
Standards-Version: 4.2.1
X-Python-Version: >= 2.7
X-Python3-Version: >= 3.4
Homepage: https://github.com/duncanmmacleod/dqsegdb2
Build-Depends: debhelper (>= 9),
dh-python,
python-all,
python3-all,
python-setuptools,
python3-setuptools,
python-ligo-segments,
python3-ligo-segments,
python-gwdatafind,
python3-gwdatafind,
python-pytest,
python3-pytest,
python-mock

# -- python-dqsegdb2 ----------------------------------------------------------

Package: python-dqsegdb2
Architecture: all
Depends: ${misc:Depends},
${python:Depends},
python-ligo-segments,
python-gwdatafind
Description: Simplified Python 2 interface to DQSEGDB
DQSEGDB2 is a simplified Python implementation of the DQSEGDB API as
defined in LIGO-T1300625.
.
This package only provides a query interface for `GET` requests, any users
wishing to make `POST` requests should refer to the official `dqsegdb` Python
client available from https://github.com/ligovirgo/dqsegdb/.

# -- python3-dqsegdb2 ---------------------------------------------------------

Package: python3-dqsegdb2
Architecture: all
Depends: ${misc:Depends},
${python3:Depends},
python3-ligo-segments,
python3-gwdatafind
Description: Simplified Python 3 interface to DQSEGDB
DQSEGDB2 is a simplified Python implementation of the DQSEGDB API as
defined in LIGO-T1300625.
.
This package only provides a query interface for `GET` requests, any users
wishing to make `POST` requests should refer to the official `dqsegdb` Python
client available from https://github.com/ligovirgo/dqsegdb/.
24 changes: 24 additions & 0 deletions debian/copyright
@@ -0,0 +1,24 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Contact: Duncan Macleod <duncan.macleod@ligo.org>
Source: https://git.ligo.org/duncanmmacleod/python-pmdc

Files: *
Copyright: 2018 Duncan Macleod <duncan.macleod@ligo.org>
License: GPL-3+

License: GPL-3+
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 package 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, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in `/usr/share/common-licenses/GPL-3'.
7 changes: 7 additions & 0 deletions debian/rules
@@ -0,0 +1,7 @@
#!/usr/bin/make -f

export PYBUILD_NAME = dqsegdb2
export PYBUILD_TEST_PYTEST = 1

%:
dh $@ --with python2,python3 --buildsystem=pybuild
1 change: 1 addition & 0 deletions debian/source/format
@@ -0,0 +1 @@
3.0 (quilt)
106 changes: 106 additions & 0 deletions dqsegdb2.spec
@@ -0,0 +1,106 @@
%define name dqsegdb2
%define version 1.0.0
%define release 1

Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
Summary: Simplified python interface to DQSEGDB

License: GPLv3
Url: https://pypi.org/project/%{name}/
Source0: https://pypi.io/packages/source/d/%{name}/%{name}-%{version}.tar.gz

Vendor: Duncan Macleod <duncan.macleod@ligo.org>

BuildArch: noarch

BuildRequires: rpm-build
BuildRequires: python-rpm-macros
BuildRequires: python-srpm-macros
BuildRequires: python2-rpm-macros
BuildRequires: python3-rpm-macros

# python2-dqsegdb2
BuildRequires: python2-setuptools
BuildRequires: python2-ligo-segments
BuildRequires: python2-gwdatafind
BuildRequires: pytest
BuildRequires: python2-mock

# python3x-dqsegdb2
BuildRequires: python%{python3_version_nodots}-setuptools
BuildRequires: python%{python3_version_nodots}-ligo-segments
BuildRequires: python%{python3_version_nodots}-gwdatafind
BuildRequires: python%{python3_version_nodots}-pytest

%description
DQSEGDB2 is a simplified Python implementation of the DQSEGDB API as defined in
LIGO-T1300625.
This package only provides a query interface for `GET` requests, any users
wishing to make `POST` requests should refer to the official `dqsegdb` Python
client available from https://github.com/ligovirgo/dqsegdb/.

# -- python2-gwdatafind

%package -n python2-%{name}
Summary: Simplified Python %{python2_version} interface to DQSEGDB
Requires: python2-ligo-segments
Requires: python2-gwdatafind
%{?python_provide:%python_provide python2-%{name}}
%description -n python2-%{name}
DQSEGDB2 is a simplified Python implementation of the DQSEGDB API as defined in
LIGO-T1300625.
This package only provides a query interface for `GET` requests, any users
wishing to make `POST` requests should refer to the official `dqsegdb` Python
client available from https://github.com/ligovirgo/dqsegdb/.

# -- python3x-gwdatafind

%package -n python%{python3_version_nodots}-%{name}
Summary: Simplified Python %{python3_version} interface to DQSEGDB
Requires: python%{python3_version_nodots}-ligo-segments
Requires: python%{python3_version_nodots}-gwdatafind
%{?python_provide:%python_provide python%{python3_version_nodots}-%{name}}
%description -n python%{python3_version_nodots}-%{name}
DQSEGDB2 is a simplified Python implementation of the DQSEGDB API as defined in
LIGO-T1300625.
This package only provides a query interface for `GET` requests, any users
wishing to make `POST` requests should refer to the official `dqsegdb` Python
client available from https://github.com/ligovirgo/dqsegdb/.

# -- build steps

%prep
%autosetup -n %{name}-%{version}

%build
%py2_build
%py3_build

%check
%{__python2} -m pytest --pyargs %{name}
%{__python3} -m pytest --pyargs %{name}

%install
%py2_install
%py3_install

%clean
rm -rf $RPM_BUILD_ROOT

%files -n python2-%{name}
%license LICENSE
%doc README.md
%{python2_sitelib}/*

%files -n python%{python3_version_nodots}-%{name}
%license LICENSE
%doc README.md
%{python3_sitelib}/*

# -- changelog

%changelog
* Wed Aug 01 2018 Duncan Macleod <duncan.macleod@ligo.org>
- 1.0.0 first release
2 changes: 2 additions & 0 deletions setup.cfg
@@ -0,0 +1,2 @@
[metadata]
license_file = LICENSE

0 comments on commit 9b80ea0

Please sign in to comment.