diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000000000000000000000000000000000000..a350733d5f75ae9302a9025ed4f2a6045d4f3a80 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,7 @@ +python-procset (1.0-1) experimental; urgency=low + + * Initial release. (Closes: #1036617) + * Do not package deprecated code. + * Disable code coverage. + + -- Raphaël Bleuse <cs@research.bleuse.net> Sat, 20 May 2023 13:39:16 +0200 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000000000000000000000000000000000000..640e4ad0c461c805e8206e2667583ed8279431cd --- /dev/null +++ b/debian/control @@ -0,0 +1,31 @@ +Source: python-procset +Section: python +Priority: optional +Maintainer: Raphaël Bleuse <cs@research.bleuse.net> +Uploaders: Vincent Danjean <vdanjean@debian.org> +Build-Depends: debhelper-compat (= 13), + dh-python, + python3-all, + python3-setuptools, + python3-pytest, +Standards-Version: 4.6.2 +Rules-Requires-Root: no +Homepage: https://gitlab.inria.fr/bleuse/procset.py +Vcs-Git: https://gitlab.inria.fr/bleuse/procset.py.git +Vcs-Browser: https://gitlab.inria.fr/bleuse/procset.py + +Package: python3-procset +Architecture: all +Depends: ${misc:Depends}, + ${python3:Depends}, +Description: Pure Python implementation of the interval set data structure + An interval set (provided as the ProcSet class) is a memory-efficient + representation of closed-interval sets. + A ProcSet is an hybrid between a set and a list of indexes. + More precisely, a ProcSet object is an ordered collection of unique + non-negative int. + It supports most of set operations: notably membership testing, mathematical + operations such as intersection, union, and (symmetric) difference; with the + additional ability to access its elements by position. + . + This is the Python 3 package. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000000000000000000000000000000000000..3af7986053a319e9471392ea443489a344d09499 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,30 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: procset.py +Upstream-Contact: Raphaël Bleuse <cs@research.bleuse.net> +Source: https://gitlab.inria.fr/bleuse/procset.py + +Files: * +Copyright: 2017–2023, Raphaël Bleuse <cs@research.bleuse.net> +License: LGPL-3 + +Files: debian/* +Copyright: 2023, Raphaël Bleuse <cs@research.bleuse.net> +License: LGPL-3 + +License: LGPL-3 + procset.py is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License version 3 only + as published by the Free Software Foundation. + . + procset.py 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 Lesser General Public License version 3 for more details. + . + You should have received a copy of the GNU Lesser General Public + License version 3 along with this program. If not, see + <https://www.gnu.org/licenses/>. + . + On Debian systems, the full text of the GNU Lesser General Public + License version 3 can be found in the file + `/usr/share/common-licenses/LGPL-3'. diff --git a/debian/patches/drop-code-coverage.patch b/debian/patches/drop-code-coverage.patch new file mode 100644 index 0000000000000000000000000000000000000000..17747504654d4361f91e565d1874678c57729605 --- /dev/null +++ b/debian/patches/drop-code-coverage.patch @@ -0,0 +1,29 @@ +Description: Disable code coverage for Debian build +Author: Raphaël Bleuse <cs@research.bleuse.net> +Forwarded: no +Last-Update: 2023-05-21 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +Index: procset.git/setup.cfg +=================================================================== +--- procset.git.orig/setup.cfg ++++ procset.git/setup.cfg +@@ -35,17 +35,11 @@ py_modules = procset, intsetwrap + + [options.extras_require] + test = +- coverage + pytest +- pytest-cov + interval_set # tests for deprecated API + + + # tests' configuration ################## + + [tool:pytest] +-addopts = -v -r fxX --maxfail=25 --cov-report=html --cov +- +-[coverage:run] +-branch = True +-source = src ++addopts = -v -r fxX --maxfail=25 diff --git a/debian/patches/remove-deprecated-code.patch b/debian/patches/remove-deprecated-code.patch new file mode 100644 index 0000000000000000000000000000000000000000..f08a1b3cd0254f3e76c6d52173144e8ccab6b9c9 --- /dev/null +++ b/debian/patches/remove-deprecated-code.patch @@ -0,0 +1,483 @@ +Description: Do not package deprecated feature +Author: Raphaël Bleuse <cs@research.bleuse.net> +Forwarded: no +Last-Update: 2023-05-21 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +Index: procset.git/setup.cfg +=================================================================== +--- procset.git.orig/setup.cfg ++++ procset.git/setup.cfg +@@ -24,19 +24,15 @@ classifiers = + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Topic :: Software Development :: Libraries :: Python Modules +-obsoletes = interval_set +-provides = interval_set + + [options] + zip_safe = False + package_dir = =src +-# intsetwrap is a transition module, and is planned for removal +-py_modules = procset, intsetwrap ++py_modules = procset + + [options.extras_require] + test = + pytest +- interval_set # tests for deprecated API + + + # tests' configuration ################## +Index: procset.git/src/intsetwrap.py +=================================================================== +--- procset.git.orig/src/intsetwrap.py ++++ /dev/null +@@ -1,146 +0,0 @@ +-# -*- coding: utf-8 -*- +- +-# Copyright © 2017 +-# Contributed by Raphaël Bleuse <raphael.bleuse@uni.lu> +-# +-# This file is part of procset.py, a pure python module to manage sets of +-# closed intervals. +-# +-# procset.py is free software: you can redistribute it and/or modify it +-# under the terms of the GNU Lesser General Public License version 3 only +-# as published by the Free Software Foundation. +-# +-# procset.py 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 Lesser General Public License version 3 for more details. +-# +-# You should have received a copy of the GNU Lesser General Public +-# License version 3 along with this program. If not, see +-# <https://www.gnu.org/licenses/>. +- +-""" +-Wrapper functions around procset to provide the API of interval_set. +- +-This module aims at easing the transition from interval_set to procset, and +-should not be used in any new project. The code is not optimized at all, as it +-converts the structures to ProcSet back and forth. +- +-The module is planned for removal in the next major release. +-""" +- +-import functools as _functools +-import warnings as _warnings +- +-from procset import ProcSet as _ProcSet +- +- +-# helper decorator factory +- +-def _deprecated(message=""): +- def _decorated(func): +- @_functools.wraps(func) +- def _wrapper(*args, **kwargs): +- _warnings.warn( +- message, +- DeprecationWarning, +- stacklevel=2 +- ) +- return func(*args, **kwargs) +- return _wrapper +- return _decorated +- +- +-# old API implementation: string conversions +- +-@_deprecated("Deprecated function: use str(intervals) or format(intervals) instead.") +-def interval_set_to_string(itvs, separator=" "): +- """[deprecated] Convert an intervals' set into a string.""" +- format_spec = '-' + separator[0] +- return format(_ProcSet(*itvs), format_spec) +- +- +-@_deprecated("Deprecated function: use ProcSet.from_str(s) instead.") +-def string_to_interval_set(string, separator=" "): +- """[deprecated] Transform a string to an intervals' set.""" +- return list(_ProcSet.from_str(string, outsep=separator).intervals()) +- +- +-# old API implementation: ID list conversions +- +-@_deprecated("Deprecated function: use ProcSet(*ids) instead.") +-def id_list_to_iterval_set(idlist): +- """[deprecated] Convert a list of ID (int) into an intervals' set.""" +- return list(_ProcSet(*idlist).intervals()) +- +- +-@_deprecated("Deprecated function: use list(itvs) instead.") +-def interval_set_to_id_list(itvs): +- """[deprecated] Convert an intervals' set into a list of ID (int).""" +- return list(_ProcSet(*itvs)) +- +- +-# old API implementation: ID set conversions +- +-@_deprecated("Deprecated function: use set(itvs) instead.") +-def interval_set_to_set(itvs): +- """[deprecated] Convert an intervals' set into a set of ID (int).""" +- return set(_ProcSet(*itvs)) +- +- +-@_deprecated("Deprecated function: use ProcSet(*s) instead.") +-def set_to_interval_set(idset): +- """[deprecated] Convert a set of ID (int) into an intervals' set.""" +- return list(_ProcSet(*idset).intervals()) +- +- +-# old API implementation: statistics +- +-@_deprecated("Deprecated function: use len(itvs) instead.") +-def total(itvs): +- """[deprecated] Compute the number of elements in the whole set.""" +- return len(_ProcSet(*itvs)) +- +- +-# old API implementation: set theory operations +- +-@_deprecated("Deprecated function: use == instead.") +-def equals(itvs1, itvs2): +- """[deprecated] Check for equality between two intervals' sets.""" +- return _ProcSet(*itvs1) == _ProcSet(*itvs2) +- +- +-@_deprecated("Deprecated function: itvs_base - itvs2 instead.") +-def difference(itvs1, itvs2): +- """ +- [deprecated] Return the intervals' set containing elements in the first set +- but not in the second. +- """ +- return list((_ProcSet(*itvs1) - _ProcSet(*itvs2)).intervals()) +- +- +-@_deprecated("Deprecated function: use itvs1 & itvs2 instead.") +-def intersection(itvs1, itvs2): +- """ +- [deprecated] Return the intervals' set containing elements common to the +- first and second sets. +- """ +- return list((_ProcSet(*itvs1) & _ProcSet(*itvs2)).intervals()) +- +- +-@_deprecated("Deprecated function: use itvs1 | itvs2 instead.") +-def union(itvs1, itvs2): +- """ +- [deprecated] Return the intervals' set with the elements from the first set +- and the second set. +- """ +- return list((_ProcSet(*itvs1) | _ProcSet(*itvs2)).intervals()) +- +- +-@_deprecated("Deprecated function: use aggregate method instead.") +-def aggregate(itvs): +- """ +- [deprecated] Return the smallest interval containing all intervals from the +- given intervals' set. +- """ +- return list(_ProcSet(*itvs).aggregate().intervals()) +Index: procset.git/test/test_wrapper.py +=================================================================== +--- procset.git.orig/test/test_wrapper.py ++++ /dev/null +@@ -1,206 +0,0 @@ +-# -*- coding: utf-8 -*- +- +-# Copyright © 2017, 2019 +-# Contributed by Raphaël Bleuse <cs@research.bleuse.net> +-# +-# This file is part of procset.py, a pure python module to manage sets of +-# closed intervals. +-# +-# procset.py is free software: you can redistribute it and/or modify it +-# under the terms of the GNU Lesser General Public License version 3 only +-# as published by the Free Software Foundation. +-# +-# procset.py 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 Lesser General Public License version 3 for more details. +-# +-# You should have received a copy of the GNU Lesser General Public +-# License version 3 along with this program. If not, see +-# <https://www.gnu.org/licenses/>. +- +-import pytest +-import interval_set.interval_set as oldapi +-import intsetwrap as newapi +- +- +-# pylint: disable=no-self-use,too-many-public-methods,missing-docstring +-@pytest.mark.filterwarnings("ignore:^Deprecated function:DeprecationWarning") +-class TestCompatibility: +- def test_itvs2str(self): +- new = newapi.interval_set_to_string([(1, 2), (5, 5), (10, 50)]) +- old = oldapi.interval_set_to_string([(1, 2), (5, 5), (10, 50)]) +- assert new == old +- +- @pytest.mark.xfail(reason="bug in reference implementation") +- def test_str2itvs_1(self): +- new = newapi.string_to_interval_set("1 2 3 7-9 13") +- old = oldapi.string_to_interval_set("1 2 3 7-9 13") +- assert new == old +- +- def test_str2itvs_2(self): +- new = newapi.string_to_interval_set("") +- old = oldapi.string_to_interval_set("") +- assert new == old +- +- def test_str2itvs_3(self): +- with pytest.raises(ValueError): +- newapi.string_to_interval_set("(2,3)") +- with pytest.raises(ValueError): +- oldapi.string_to_interval_set("(2,3)") +- +- def test_itvs2list_1(self): +- new = newapi.interval_set_to_id_list([]) +- old = oldapi.interval_set_to_id_list([]) +- assert new == old +- +- def test_itvs2list_2(self): +- new = newapi.interval_set_to_id_list([(1, 1), (3, 4)]) +- old = oldapi.interval_set_to_id_list([(1, 1), (3, 4)]) +- assert new == old +- +- def test_list2itvs_1(self): +- new = newapi.id_list_to_iterval_set([]) +- old = oldapi.id_list_to_iterval_set([]) +- assert new == old +- +- def test_list2itvs_2(self): +- new = newapi.id_list_to_iterval_set([1, 2, 5, 7, 9, 10, 11]) +- old = oldapi.id_list_to_iterval_set([1, 2, 5, 7, 9, 10, 11]) +- assert new == old +- +- def test_itvs2set_1(self): +- new = newapi.interval_set_to_set([]) +- old = oldapi.interval_set_to_set([]) +- assert new == old +- +- def test_itvs2set_2(self): +- new = newapi.interval_set_to_set([(1, 1), (3, 4)]) +- old = oldapi.interval_set_to_set([(1, 1), (3, 4)]) +- assert new == old +- +- def test_set2itvs_1(self): +- new = newapi.set_to_interval_set(set()) +- old = oldapi.set_to_interval_set(set()) +- assert new == old +- +- def test_set2itvs_2(self): +- new = newapi.set_to_interval_set({1, 2, 5, 7, 9, 10, 11}) +- old = oldapi.set_to_interval_set({1, 2, 5, 7, 9, 10, 11}) +- assert new == old +- +- def test_total_1(self): +- new = newapi.total([]) +- old = oldapi.total([]) +- assert new == old +- +- def test_total_2(self): +- new = newapi.total([(0, 0)]) +- old = oldapi.total([(0, 0)]) +- assert new == old +- +- def test_total_3(self): +- new = newapi.total([(1, 1), (3, 4)]) +- old = oldapi.total([(1, 1), (3, 4)]) +- assert new == old +- +- def test_equals_1(self): +- new = newapi.equals([], []) +- old = oldapi.equals([], []) +- assert new == old +- +- def test_equals_2(self): +- new = newapi.equals([(1, 1)], [(1, 2)]) +- old = oldapi.equals([(1, 1)], [(1, 2)]) +- assert new == old +- +- def test_equals_3(self): +- new = newapi.equals([(1, 10)], []) +- old = oldapi.equals([(1, 10)], []) +- assert new == old +- +- def test_equals_4(self): +- new = newapi.equals([(1, 2), (3, 4)], [(1, 4)]) +- old = oldapi.equals([(1, 2), (3, 4)], [(1, 4)]) +- assert new == old +- +- def test_equals_5(self): +- new = newapi.equals([(5, 100), (3, 4)], [(3, 4), (5, 100)]) +- old = oldapi.equals([(5, 100), (3, 4)], [(3, 4), (5, 100)]) +- assert new == old +- +- def test_difference_1(self): +- new = newapi.difference([], [(1, 1)]) +- old = oldapi.difference([], [(1, 1)]) +- assert new == old +- +- def test_difference_2(self): +- new = newapi.difference([(1, 1), (3, 4)], [(1, 2), (4, 7)]) +- old = oldapi.difference([(1, 1), (3, 4)], [(1, 2), (4, 7)]) +- assert new == old +- +- def test_difference_3(self): +- new = newapi.difference([(1, 12)], [(1, 2), (4, 7)]) +- old = oldapi.difference([(1, 12)], [(1, 2), (4, 7)]) +- assert new == old +- +- def test_intersection_1(self): +- new = newapi.intersection([(1, 2), (4, 5)], [(1, 3), (5, 7)]) +- old = oldapi.intersection([(1, 2), (4, 5)], [(1, 3), (5, 7)]) +- assert new == old +- +- def test_intersection_2(self): +- new = newapi.intersection([(2, 3), (5, 7)], [(1, 1), (4, 4)]) +- old = oldapi.intersection([(2, 3), (5, 7)], [(1, 1), (4, 4)]) +- assert new == old +- +- def test_intersection_3(self): +- new = newapi.intersection([(3, 7)], [(2, 8)]) +- old = oldapi.intersection([(3, 7)], [(2, 8)]) +- assert new == old +- +- def test_intersection_4(self): +- new = newapi.intersection([(3, 7)], [(2, 6)]) +- old = oldapi.intersection([(3, 7)], [(2, 6)]) +- assert new == old +- +- def test_union(self): +- new = newapi.union([(1, 1), (3, 4)], [(1, 2), (4, 7)]) +- old = oldapi.union([(1, 1), (3, 4)], [(1, 2), (4, 7)]) +- assert new == old +- +- def test_aggregate_1(self): +- new = newapi.aggregate([]) +- old = oldapi.aggregate([]) +- assert new == old +- +- def test_aggregate_2(self): +- new = newapi.aggregate([(1, 2), (3, 4)]) +- old = oldapi.aggregate([(1, 2), (3, 4)]) +- assert new == old +- +- def test_aggregate_3(self): +- new = newapi.aggregate([(3, 4), (1, 2)]) +- old = oldapi.aggregate([(3, 4), (1, 2)]) +- assert new == old +- +-DEPRECATED_CALLS = ( +- (newapi.interval_set_to_id_list, []), +- (newapi.interval_set_to_set, []), +- (newapi.set_to_interval_set, set()), +- (newapi.id_list_to_iterval_set, list()), +- (newapi.string_to_interval_set, ''), +- (newapi.interval_set_to_string, []), +- (newapi.total, []), +- (newapi.equals, [], []), +- (newapi.difference, [], []), +- (newapi.intersection, [], []), +- (newapi.union, [], []), +- (newapi.aggregate, []), +-) +- +-@pytest.mark.parametrize('params', DEPRECATED_CALLS, ids=lambda t: t[0].__name__) +-def test_deprecation_warnings(params): +- call, *args = params +- with pytest.deprecated_call(): +- call(*args) +Index: procset.git/docs/index.rst +=================================================================== +--- procset.git.orig/docs/index.rst ++++ procset.git/docs/index.rst +@@ -8,7 +8,6 @@ Overview + Overview <self> + ProcSet API <api> + tips +- intsetwrap + + + .. currentmodule:: procset +@@ -18,11 +17,7 @@ This package implements for Python a mem + closed-interval sets. + + +-The package provides two modules: :mod:`procset` and :mod:`intsetwrap`: +- - :mod:`procset` is an implementation aiming at providing a pythonic +- experience: it should be the preferred module for any new project. +- - :mod:`intsetwrap` is a wrapper around :mod:`procset` providing the old API +- of :mod:`interval_set`: do not use in any new project. ++The package provides the :mod:`procset` module. + + + A :class:`ProcSet` is an hybrid between a :class:`set` and a :class:`list` of +Index: procset.git/docs/intsetwrap.rst +=================================================================== +--- procset.git.orig/docs/intsetwrap.rst ++++ /dev/null +@@ -1,47 +0,0 @@ +-Migrating :mod:`interval_set` +-============================= +- +-The module :mod:`interval_set` provided a crude API to manipulate interval +-sets. +-To ease the transition, the :mod:`intsetwrap` module is provided as a drop in +-wrapper of the new :mod:`procset` API. +- +-.. note:: +- The focus of the wrapper is to keep the same semantic. +- As every call transforms the interval set to a ProcSet before converting it +- back, the performances may drastically drop. +- +- +-As a first migration step, it's as simple as replacing ``import interval_set`` +-by ``import intsetwrap as interval_set``. +- +-The following table shows how :mod:`procset` API may be used when migrating. +-``pset`` represents a :class:`~procset.ProcSet` object. +- +-+------------------------------------+---------------------------------+ +-| :mod:`interval_set` API | :mod:`procset` API | +-+====================================+=================================+ +-| ``aggregate(itvs)`` | ``pset.aggregate()`` | +-+------------------------------------+---------------------------------+ +-| ``difference(itvs1, itvs2)`` | ``pset1 - pset2`` | +-+------------------------------------+---------------------------------+ +-| ``equals(itvs1, itvs2)`` | ``pset1 == pset2`` | +-+------------------------------------+---------------------------------+ +-| ``id_list_to_iterval_set(idlist)`` | ``ProcSet(*idlist)`` | +-+------------------------------------+---------------------------------+ +-| ``intersection(itvs1, itvs2)`` | ``pset1 & pset2`` | +-+------------------------------------+---------------------------------+ +-| ``interval_set_to_id_list(itvs)`` | ``list(pset)`` | +-+------------------------------------+---------------------------------+ +-| ``interval_set_to_set(itvs)`` | ``set(pset)`` | +-+------------------------------------+---------------------------------+ +-| ``interval_set_to_string(itvs)`` | ``str(pset)``, ``format(pset)`` | +-+------------------------------------+---------------------------------+ +-| ``set_to_interval_set(idset)`` | ``ProcSet(*idset)`` | +-+------------------------------------+---------------------------------+ +-| ``string_to_interval_set(string)`` | ``ProcSet.from_str(string)`` | +-+------------------------------------+---------------------------------+ +-| ``total(itvs)`` | ``len(pset)`` | +-+------------------------------------+---------------------------------+ +-| ``union(itvs1, itvs2)`` | ``pset1 | pset2`` | +-+------------------------------------+---------------------------------+ +Index: procset.git/README.rst +=================================================================== +--- procset.git.orig/README.rst ++++ procset.git/README.rst +@@ -15,8 +15,6 @@ Features + - Free Software: licensed under LGPLv3 (see `<LICENSE.rst>`_). + - Pure Python module :) + - Thoroughly tested! +-- Drop-in replacement for `interval_set` (see `intsetwrap.py +- <src/intsetwrap.py>`_). + + + Limitations diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000000000000000000000000000000000000..0c2d7eb9025f3c5b091ff7fb39b3b46267a14212 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,2 @@ +drop-code-coverage.patch +remove-deprecated-code.patch diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000000000000000000000000000000000000..88437dc1c20be92a05f2067a3eab92282f4090af --- /dev/null +++ b/debian/rules @@ -0,0 +1,11 @@ +#!/usr/bin/make -f + +export DH_VERBOSE=1 +export PYBUILD_NAME=procset +export PYBUILD_TEST_PYTEST=1 + +%: + dh $@ --with python3 --buildsystem=pybuild + +execute_after_dh_auto_clean: + $(RM) --recursive -- src/procset.egg-info/ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000000000000000000000000000000000000..163aaf8d82b6c54f23c45f32895dbdfdcc27b047 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000000000000000000000000000000000000..434f7b96ce7de41fa5e5bc0bf712e6f081557887 --- /dev/null +++ b/debian/watch @@ -0,0 +1,3 @@ +version=4 +opts=uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/ \ +https://gitlab.inria.fr/bleuse/procset.py/-/tags?sort=updated_desc archive/@ANY_VERSION@/procset\.py-v?\d\S*@ARCHIVE_EXT@