From: Rob Golding Date: Sun, 7 Sep 2014 17:31:33 +0000 (+0100) Subject: Merge branch 'release/0.4.0' X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/df5c2f8494d1b6ed7441e56bbf0d0a235634c2b1?hp=f1d4272b33cfad95131ce358986c879fe8f12695 Merge branch 'release/0.4.0' --- diff --git a/.travis.yml b/.travis.yml index d456ec9..bc6cd0e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,19 @@ language: python env: + - TASK_VERSION=2.1.1 + - TASK_VERSION=2.1.2 - TASK_VERSION=2.2.0 - - TASK_VERSION=2.3.0.beta2 python: - "2.6" - "2.7" - "3.2" - "3.3" + - "3.4" install: - pip install -e . - sudo apt-get install -qq build-essential cmake uuid-dev - - wget http://www.taskwarrior.org/download/task-$TASK_VERSION.tar.gz - - tar -zxvf task-$TASK_VERSION.tar.gz + - wget http://archive.ubuntu.com/ubuntu/pool/universe/t/task/task_$TASK_VERSION.orig.tar.gz + - tar -zxvf task_$TASK_VERSION.orig.tar.gz - cd task-$TASK_VERSION - cmake . - make diff --git a/README.rst b/README.rst index c835dc2..c8053ef 100644 --- a/README.rst +++ b/README.rst @@ -7,13 +7,13 @@ tasklib tasklib is a Python library for interacting with taskwarrior_ databases, using a queryset API similar to that of Django's ORM. -Supports Python 2.6, 2.7, 3.2 and 3.3 with taskwarrior 2.2.0 or 2.3.0 beta2. -Older versions of taskwarrior are untested and probably won't work. +Supports Python 2.6, 2.7, 3.2, 3.3 and 3.4 with taskwarrior 2.1.x and 2.2.x. +Older versions of taskwarrior are untested and may not work. Requirements ------------ -* taskwarrior_ v2.2.0 or v2.3.0 beta2 +* taskwarrior_ v2.1.x or v2.2.x Installation ------------ diff --git a/docs/index.rst b/docs/index.rst index 9a86f1c..037d756 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -4,13 +4,13 @@ Welcome to tasklib's documentation! tasklib is a Python library for interacting with taskwarrior_ databases, using a queryset API similar to that of Django's ORM. -Supports Python 2.6, 2.7, 3.2 and 3.3 with taskwarrior 2.2.0 or 2.3.0 beta2. -Older versions of taskwarrior are untested and probably won't work. +Supports Python 2.6, 2.7, 3.2, 3.3 and 3.4 with taskwarrior 2.1.x and 2.2.x. +Older versions of taskwarrior are untested and may not work. Requirements ------------ -* taskwarrior_ v2.2.0 or v2.3.0 beta2 +* taskwarrior_ v2.1.x or v2.2.x Installation ------------ diff --git a/setup.py b/setup.py index 3546c3b..37a3065 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -version = '0.3.1' +version = '0.4.0' setup( name='tasklib', @@ -15,6 +15,7 @@ setup( packages=find_packages(), include_package_data=True, test_suite='tasklib.tests', + install_requires=['six==1.5.2'], classifiers=[ 'Development Status :: 4 - Beta', 'Programming Language :: Python', diff --git a/tasklib/task.py b/tasklib/task.py index de0443c..6fbce77 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -1,8 +1,10 @@ +from __future__ import print_function import copy import datetime import json import logging import os +import six import subprocess DATE_FORMAT = '%Y%m%dT%H%M%SZ' @@ -36,8 +38,11 @@ class TaskResource(object): self._data[key] = dehydrate_func(value) self._modified_fields.add(key) - def __repr__(self): - return self.__unicode__() + def __str__(self): + s = six.text_type(self.__unicode__()) + if not six.PY3: + s = s.encode('utf-8') + return s class TaskAnnotation(TaskResource): @@ -297,7 +302,7 @@ class TaskWarrior(object): logger.debug(' '.join(command_args)) p = subprocess.Popen(command_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - stdout, stderr = [x.decode() for x in p.communicate()] + stdout, stderr = [x.decode('utf-8') for x in p.communicate()] if p.returncode: if stderr.strip(): error_msg = stderr.strip().splitlines()[-1] diff --git a/tasklib/tests.py b/tasklib/tests.py index c738739..4ff4e03 100644 --- a/tasklib/tests.py +++ b/tasklib/tests.py @@ -1,3 +1,5 @@ +# coding=utf-8 + import shutil import tempfile import unittest @@ -76,3 +78,14 @@ class AnnotationTest(TasklibTest): ann = task['annotations'][0] task.remove_annotation(ann) self.assertEqual(len(task['annotations']), 0) + + +class UnicodeTest(TasklibTest): + + def test_unicode_task(self): + self.tw.execute_command(['add', '†åßk']) + self.tw.tasks.get() + + def test_non_unicode_task(self): + self.tw.execute_command(['add', 'task']) + self.tw.tasks.get()