diff -Nru python-tasklib-2.3.0/debian/changelog python-tasklib-2.4.3/debian/changelog --- python-tasklib-2.3.0/debian/changelog 2021-01-15 08:27:28.000000000 +0000 +++ python-tasklib-2.4.3/debian/changelog 2021-10-12 13:54:14.000000000 +0000 @@ -1,3 +1,19 @@ +python-tasklib (2.4.3-1) unstable; urgency=medium + + * New upstream version 2.4.3 + + -- Jochen Sprickerhof Tue, 12 Oct 2021 15:54:14 +0200 + +python-tasklib (2.4.0-1) unstable; urgency=medium + + * New upstream version 2.4.0 + * update copyright + * drop patch (applied upstream) + * bump policy version (no changes) + * Update upstream URL + + -- Jochen Sprickerhof Tue, 21 Sep 2021 21:18:31 +0200 + python-tasklib (2.3.0-3) unstable; urgency=medium * Drop wsl dependency diff -Nru python-tasklib-2.3.0/debian/control python-tasklib-2.4.3/debian/control --- python-tasklib-2.3.0/debian/control 2021-01-15 07:52:28.000000000 +0000 +++ python-tasklib-2.4.3/debian/control 2021-09-21 20:02:58.000000000 +0000 @@ -9,12 +9,12 @@ python3-setuptools, Build-Depends-Indep: python3-tzlocal, taskwarrior, -Standards-Version: 4.5.1 +Standards-Version: 4.6.0 Rules-Requires-Root: no Testsuite: autopkgtest-pkg-python Vcs-Browser: https://salsa.debian.org/tasktools-team/python-tasklib Vcs-Git: https://salsa.debian.org/tasktools-team/python-tasklib.git -Homepage: https://github.com/robgolding/tasklib +Homepage: https://github.com/GothenburgBitFactory/tasklib Package: python3-tasklib Architecture: all diff -Nru python-tasklib-2.3.0/debian/copyright python-tasklib-2.4.3/debian/copyright --- python-tasklib-2.3.0/debian/copyright 2019-11-09 21:15:39.000000000 +0000 +++ python-tasklib-2.4.3/debian/copyright 2021-09-21 19:12:44.000000000 +0000 @@ -1,7 +1,7 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Files: * -Copyright: 2013-2017, Rob Golding +Copyright: 2013-2021, Rob Golding & Gothenburg Bit Factory License: BSD-3-clause Files: debian/* diff -Nru python-tasklib-2.3.0/debian/patches/0001-Fix-unit-tests-on-non-wsl-non-Travis-systems.patch python-tasklib-2.4.3/debian/patches/0001-Fix-unit-tests-on-non-wsl-non-Travis-systems.patch --- python-tasklib-2.3.0/debian/patches/0001-Fix-unit-tests-on-non-wsl-non-Travis-systems.patch 2021-01-15 08:21:44.000000000 +0000 +++ python-tasklib-2.4.3/debian/patches/0001-Fix-unit-tests-on-non-wsl-non-Travis-systems.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -From: Jochen Sprickerhof -Date: Fri, 15 Jan 2021 09:08:05 +0100 -Subject: Fix unit tests on non wsl non Travis systems - -The test_custom_command was introduced in #63 with the TASK_VERSION for -Travis. As TASK_VERSION is not part of a default environment, the test -would still try to run `wsl` on other systems and fail. ---- - tasklib/tests.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tasklib/tests.py b/tasklib/tests.py -index 8b93a86..fcd46de 100644 ---- a/tasklib/tests.py -+++ b/tasklib/tests.py -@@ -72,7 +72,7 @@ class TaskWarriorTest(TasklibTest): - tw = self.get_taskwarrior( - task_command='wsl task', - # prevent `_get_version` from running as `wsl` may not exist -- version_override=os.getenv('TASK_VERSION'), -+ version_override=os.getenv('TASK_VERSION', 'v1.2.3'), - ) - self.assertEqual(tw._get_task_command(), ['wsl', 'task']) - diff -Nru python-tasklib-2.3.0/debian/patches/series python-tasklib-2.4.3/debian/patches/series --- python-tasklib-2.3.0/debian/patches/series 2021-01-15 08:21:44.000000000 +0000 +++ python-tasklib-2.4.3/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -0001-Fix-unit-tests-on-non-wsl-non-Travis-systems.patch diff -Nru python-tasklib-2.3.0/debian/watch python-tasklib-2.4.3/debian/watch --- python-tasklib-2.3.0/debian/watch 2019-11-09 21:14:21.000000000 +0000 +++ python-tasklib-2.4.3/debian/watch 2021-09-21 19:18:20.000000000 +0000 @@ -1,4 +1,4 @@ version=4 opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%@PACKAGE@-$1.tar.gz%" \ - https://github.com/robgolding/tasklib/tags \ + https://github.com/GothenburgBitFactory/tasklib/tags \ (?:.*?/)?v?(\d[\d.]*)\.tar\.gz diff -Nru python-tasklib-2.3.0/docs/conf.py python-tasklib-2.4.3/docs/conf.py --- python-tasklib-2.3.0/docs/conf.py 2021-01-03 09:17:32.000000000 +0000 +++ python-tasklib-2.4.3/docs/conf.py 2021-10-10 14:34:09.000000000 +0000 @@ -44,16 +44,16 @@ # General information about the project. project = u'tasklib' -copyright = u'2014, Rob Golding' +copyright = u'2014 - 2021, Rob Golding & Gothenburg Bit Factory' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '2.3.0' +version = '2.4.3' # The full version, including alpha/beta/rc tags. -release = '2.3.0' +release = '2.4.3' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff -Nru python-tasklib-2.3.0/docs/index.rst python-tasklib-2.4.3/docs/index.rst --- python-tasklib-2.3.0/docs/index.rst 2021-01-03 09:17:32.000000000 +0000 +++ python-tasklib-2.4.3/docs/index.rst 2021-10-10 14:34:09.000000000 +0000 @@ -4,13 +4,13 @@ tasklib is a Python library for interacting with taskwarrior_ databases, using a queryset API similar to that of Django's ORM. -Supports Python 3.5 and above, with taskwarrior 2.1.x and above. +Supports Python 3.5 and above, with taskwarrior 2.4.x and above. Older versions of taskwarrior are untested and may not work. Requirements ------------ -* taskwarrior_ v2.1.x or above, although newest minor release is recommended. +* taskwarrior_ v2.4.x or above, although newest minor release is recommended. Installation ------------ diff -Nru python-tasklib-2.3.0/README.rst python-tasklib-2.4.3/README.rst --- python-tasklib-2.3.0/README.rst 2021-01-03 09:17:32.000000000 +0000 +++ python-tasklib-2.4.3/README.rst 2021-10-10 14:34:09.000000000 +0000 @@ -14,7 +14,7 @@ ------------ * Python 3.5 or above -* taskwarrior_ v2.1.x or above. +* taskwarrior_ v2.4.x or above. Older versions of taskwarrior are untested and may not work. diff -Nru python-tasklib-2.3.0/setup.py python-tasklib-2.4.3/setup.py --- python-tasklib-2.3.0/setup.py 2021-01-03 09:17:32.000000000 +0000 +++ python-tasklib-2.4.3/setup.py 2021-10-10 14:34:09.000000000 +0000 @@ -2,7 +2,7 @@ install_requirements = ['pytz', 'tzlocal'] -version = '2.3.0' +version = '2.4.3' try: import importlib @@ -12,27 +12,32 @@ setup( name='tasklib', version=version, - description='Python Task Warrior library', + description='Official Taskwarrior library for Python', long_description=open('README.rst').read(), - author='Rob Golding', - author_email='rob@robgolding.com', + author='GothenburgBitFactory', + author_email='support@gothenburgbitfactory.org', license='BSD', - url='https://github.com/robgolding/tasklib', - download_url='https://github.com/robgolding/tasklib/downloads', + url='https://github.com/GothenburgBitFactory/tasklib', + download_url='https://github.com/GothenburgBitFactory/tasklib/downloads', packages=find_packages(), include_package_data=True, test_suite='tasklib.tests', install_requires=install_requirements, classifiers=[ - 'Development Status :: 4 - Beta', + 'Development Status :: 6 - Mature', 'Programming Language :: Python', "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", 'License :: OSI Approved :: BSD License', 'Topic :: Software Development :: Libraries :: Python Modules', 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'Intended Audience :: System Administrators', + 'Operating System :: OS Independent' ], ) diff -Nru python-tasklib-2.3.0/tasklib/backends.py python-tasklib-2.4.3/tasklib/backends.py --- python-tasklib-2.3.0/tasklib/backends.py 2021-01-03 09:17:32.000000000 +0000 +++ python-tasklib-2.4.3/tasklib/backends.py 2021-10-10 14:34:09.000000000 +0000 @@ -84,9 +84,6 @@ class TaskWarrior(Backend): - VERSION_2_1_0 = '2.1.0' - VERSION_2_2_0 = '2.2.0' - VERSION_2_3_0 = '2.3.0' VERSION_2_4_0 = '2.4.0' VERSION_2_4_1 = '2.4.1' VERSION_2_4_2 = '2.4.2' @@ -218,31 +215,17 @@ ) def format_description(self, task): - # Task version older than 2.4.0 ignores first word of the - # task description if description: prefix is used - if self.version < self.VERSION_2_4_0: - return task._data['description'] - else: - return "description:'{0}'".format( - task._data['description'] or '', - ) + return "description:'{0}'".format( + task._data['description'] or '', + ) def convert_datetime_string(self, value): - - if self.version >= self.VERSION_2_4_0: - # For strings, use 'calc' to evaluate the string to datetime - # available since TW 2.4.0 - args = value.split() - result = self.execute_command(['calc'] + args) - naive = datetime.datetime.strptime(result[0], DATE_FORMAT_CALC) - localized = local_zone.localize(naive) - else: - raise ValueError( - 'Provided value could not be converted to ' - 'datetime, its type is not supported: {}' - .format(type(value)), - ) - + # For strings, use 'calc' to evaluate the string to datetime + # available since TW 2.4.0 + args = value.split() + result = self.execute_command(['calc'] + args) + naive = datetime.datetime.strptime(result[0], DATE_FORMAT_CALC) + localized = local_zone.localize(naive) return localized @property @@ -329,7 +312,7 @@ def filter_tasks(self, filter_obj): self.enforce_recurrence() - args = ['export'] + filter_obj.get_filter_params() + args = filter_obj.get_filter_params() + ["export"] tasks = [] for line in self.execute_command(args): if line: @@ -347,7 +330,10 @@ args = [task['uuid'], 'modify'] if task.saved else ['add'] args.extend(self._get_modified_task_fields_as_args(task)) - output = self.execute_command(args) + output = self.execute_command( + args, + config_override={'verbose': 'new-uuid'} + ) # Parse out the new ID, if the task is being added for the first time if not task.saved: @@ -355,8 +341,8 @@ # Complain loudly if it seems that more tasks were created # Should not happen. - # Expected output: Created task 1. - # Created task 1 (recurrence template). + # Expected output: Created task bd23f69a-a078-48a4-ac11-afba0643eca9. + # Created task bd23f69a-a078-48a4-ac11-afba0643eca9 (recurrence template). if len(id_lines) != 1 or len(id_lines[0].split(' ')) not in (3, 5): raise TaskWarriorException( 'Unexpected output when creating ' @@ -366,11 +352,8 @@ # Circumvent the ID storage, since ID is considered read-only identifier = id_lines[0].split(' ')[2].rstrip('.') - # Identifier can be either ID or UUID for completed tasks - try: - task._data['id'] = int(identifier) - except ValueError: - task._data['uuid'] = identifier + # Identifier is UUID, because we used new-uuid verbosity override + task._data['uuid'] = identifier # Refreshing is very important here, as not only modification time # is updated, but arbitrary attribute may have changed due hooks @@ -387,10 +370,6 @@ self.execute_command([task['uuid'], 'stop']) def complete_task(self, task): - # Older versions of TW do not stop active task at completion - if self.version < self.VERSION_2_4_0 and task.active: - task.stop() - self.execute_command([task['uuid'], 'done']) def annotate_task(self, task, annotation): @@ -406,7 +385,11 @@ # of newly saved tasks. Any other place in the code is fine # with using UUID only. args = [task['uuid'] or task['id'], 'export'] - output = self.execute_command(args) + output = self.execute_command( + args, + # Supress GC, which can change ID numbers (undesirable for refresh) + config_override={'gc': '0'} + ) def valid(output): return len(output) == 1 and output[0].startswith('{') @@ -427,8 +410,7 @@ for key, value in data.items(): taskfilter.add_filter_param(key, value) - output = self.execute_command(['export'] + - taskfilter.get_filter_params()) + output = self.execute_command(taskfilter.get_filter_params() + ['export']) # If more than 1 task has been matched still, raise an exception if not valid(output): diff -Nru python-tasklib-2.3.0/tasklib/__init__.py python-tasklib-2.4.3/tasklib/__init__.py --- python-tasklib-2.3.0/tasklib/__init__.py 2021-01-03 09:17:32.000000000 +0000 +++ python-tasklib-2.4.3/tasklib/__init__.py 2021-10-10 14:34:09.000000000 +0000 @@ -2,4 +2,4 @@ from .task import Task from .serializing import local_zone -__version__ = '2.3.0' +__version__ = '2.4.3' diff -Nru python-tasklib-2.3.0/tasklib/serializing.py python-tasklib-2.4.3/tasklib/serializing.py --- python-tasklib-2.3.0/tasklib/serializing.py 2021-01-03 09:17:32.000000000 +0000 +++ python-tasklib-2.4.3/tasklib/serializing.py 2021-10-10 14:34:09.000000000 +0000 @@ -8,7 +8,7 @@ from .lazy import LazyUUIDTaskSet, LazyUUIDTask DATE_FORMAT = '%Y%m%dT%H%M%SZ' -local_zone = tzlocal.get_localzone() +local_zone = pytz.timezone(str(tzlocal.get_localzone())) class SerializingObject(object): diff -Nru python-tasklib-2.3.0/tasklib/task.py python-tasklib-2.4.3/tasklib/task.py --- python-tasklib-2.3.0/tasklib/task.py 2021-01-03 09:17:32.000000000 +0000 +++ python-tasklib-2.4.3/tasklib/task.py 2021-10-10 14:34:09.000000000 +0000 @@ -1,12 +1,13 @@ from __future__ import print_function import copy +import datetime import importlib import json import logging import os import sys -from .serializing import SerializingObject +from .serializing import SerializingObject, local_zone DATE_FORMAT = '%Y%m%dT%H%M%SZ' REPR_OUTPUT_SIZE = 10 @@ -295,7 +296,10 @@ @property def waiting(self): - return self['status'] == 'waiting' + if not self['wait']: + return False + + return self['wait'] > local_zone.localize(datetime.datetime.now()) @property def pending(self): @@ -523,7 +527,7 @@ return self.filter(status=DELETED) def waiting(self): - return self.filter(status=WAITING) + return self.filter(wait__after='now') def recurring(self): return self.filter(status=RECURRING) diff -Nru python-tasklib-2.3.0/tasklib/tests.py python-tasklib-2.4.3/tasklib/tests.py --- python-tasklib-2.3.0/tasklib/tests.py 2021-01-03 09:17:32.000000000 +0000 +++ python-tasklib-2.4.3/tasklib/tests.py 2021-10-10 14:34:09.000000000 +0000 @@ -72,7 +72,7 @@ tw = self.get_taskwarrior( task_command='wsl task', # prevent `_get_version` from running as `wsl` may not exist - version_override=os.getenv('TASK_VERSION'), + version_override=os.getenv('TASK_VERSION', 'v1.2.3'), ) self.assertEqual(tw._get_task_command(), ['wsl', 'task']) @@ -131,6 +131,16 @@ self.assertEqual(len(self.tw.tasks.waiting()), 1) + def test_waiting_property(self): + t = Task(self.tw, description='test task') + t.save() + self.assertFalse(t.waiting) + + t['wait'] = datetime.datetime.now() + datetime.timedelta(days=1) + t.save() + + self.assertTrue(t.waiting) + def test_recurring_empty(self): Task(self.tw, description='test task').save() self.assertEqual(len(self.tw.tasks.recurring()), 0) @@ -1229,21 +1239,21 @@ t = Task(self.tw, description='test task', due='eoy') now = local_zone.localize(datetime.datetime.now()) eoy = local_zone.localize(datetime.datetime( - year=now.year+1, - month=1, - day=1, - hour=0, - minute=0, - second=0, + year=now.year, + month=12, + day=31, + hour=23, + minute=59, + second=59, )) - if self.tw.version < '2.5.2': + if self.tw.version >= '2.5.2' and self.tw.version < '2.6.0': eoy = local_zone.localize(datetime.datetime( - year=now.year, - month=12, - day=31, - hour=23, - minute=59, - second=59, + year=now.year+1, + month=1, + day=1, + hour=0, + minute=0, + second=0, )) self.assertEqual(eoy, t['due']) @@ -1260,23 +1270,23 @@ now = local_zone.localize(datetime.datetime.now()) due_date = local_zone.localize( datetime.datetime( - year=now.year+1, - month=1, - day=1, - hour=0, - minute=0, - second=0, + year=now.year, + month=12, + day=31, + hour=23, + minute=59, + second=59, ) ) - datetime.timedelta(0, 4 * 30 * 86400) - if self.tw.version < '2.5.2': + if self.tw.version >= '2.5.2' and self.tw.version < '2.6.0': due_date = local_zone.localize( datetime.datetime( - year=now.year, - month=12, - day=31, - hour=23, - minute=59, - second=59, + year=now.year+1, + month=1, + day=1, + hour=0, + minute=0, + second=0, ) ) - datetime.timedelta(0, 4 * 30 * 86400) self.assertEqual(due_date, t['due']) diff -Nru python-tasklib-2.3.0/.travis.yml python-tasklib-2.4.3/.travis.yml --- python-tasklib-2.3.0/.travis.yml 2021-01-03 09:17:32.000000000 +0000 +++ python-tasklib-2.4.3/.travis.yml 2021-10-10 14:34:09.000000000 +0000 @@ -1,9 +1,5 @@ language: python env: - - TASK_VERSION=v2.1.1 - - TASK_VERSION=v2.1.2 - - TASK_VERSION=v2.2.0 - - TASK_VERSION=v2.3.0 - TASK_VERSION=v2.4.0 - TASK_VERSION=v2.4.1 - TASK_VERSION=v2.4.2 @@ -11,11 +7,14 @@ - TASK_VERSION=v2.4.4 - TASK_VERSION=v2.5.0 - TASK_VERSION=v2.5.1 + - TASK_VERSION=v2.5.2 + - TASK_VERSION=v2.5.3 python: - "3.5" - "3.6" - "3.7" - "3.8" + - "3.9" install: - pip install -e . - pip install coveralls