Package: python-warlock Version: 1.0.1-1 Severity: wishlist Tags: patch User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu saucy ubuntu-patch
This patch was originally created by Chuck Short. This will create a python3-warlock package *** /tmp/tmpmqJFev/bug_body In Ubuntu, the attached patch was applied to achieve the following: - debian/control: Add python3-warlock package. - debian/rules: Build for python2/python3. - debian/patches/python3.patch: Add support for python3. - drop debian/docs and add package specific docs - add package specific .install files Thanks for considering the patch. -- System Information: Debian Release: wheezy/sid APT prefers precise-updates APT policy: (500, 'precise-updates'), (500, 'precise-security'), (500, 'precise-proposed'), (500, 'precise'), (100, 'precise-backports') Architecture: amd64 (x86_64) Kernel: Linux 3.2.0-39-generic (SMP w/8 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash
diff -Nru python-warlock-1.0.1/debian/changelog python-warlock-1.0.1/debian/changelog diff -Nru python-warlock-1.0.1/debian/control python-warlock-1.0.1/debian/control --- python-warlock-1.0.1/debian/control 2013-07-20 01:44:11.000000000 -0500 +++ python-warlock-1.0.1/debian/control 2013-07-21 01:37:38.000000000 -0500 @@ -13,10 +13,18 @@ python-json-patch (>= 0.10), python-jsonschema, python-nose, - python-setuptools + python-setuptools, + python3-setuptools, + python-six, + python3-all (>= 3.1.2-7~), + python3-json-patch (>= 0.10), + python3-jsonschema, + python3-nose Standards-Version: 3.9.4 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=openstack/python-warlock.git Vcs-Git: git://anonscm.debian.org/openstack/python-warlock.git +X-Python-Version: >= 2.6 +X-Python3-Version: >= 3.0 Homepage: http://pypi.python.org/pypi/warlock Package: python-warlock @@ -26,7 +34,20 @@ python-jsonschema (>= 0.7), ${misc:Depends}, ${python:Depends} -Description: object model built on top of JSON schema +Description: object model built on top of JSON schema (python2) + With python-warlock, you can build self-validating Python objects using JSON + schemas. First, a schema describe the type of data, then after creating the + object, python-warlock checks that added or edited attributes correspond to + the initial schema. If they don't, an exception is raised. + +Package: python3-warlock +Architecture: all +Pre-Depends: dpkg (>= 1.15.6~) +Depends: python-json-patch (>= 0.10), + python-jsonschema (>= 0.7), + ${misc:Depends}, + ${python3:Depends} +Description: object model built on top of JSON schema (python3) With python-warlock, you can build self-validating Python objects using JSON schemas. First, a schema describe the type of data, then after creating the object, python-warlock checks that added or edited attributes correspond to diff -Nru python-warlock-1.0.1/debian/docs python-warlock-1.0.1/debian/docs --- python-warlock-1.0.1/debian/docs 2013-07-20 01:44:11.000000000 -0500 +++ python-warlock-1.0.1/debian/docs 1969-12-31 18:00:00.000000000 -0600 @@ -1,2 +0,0 @@ -README.md -requirements.txt diff -Nru python-warlock-1.0.1/debian/patches/python3.patch python-warlock-1.0.1/debian/patches/python3.patch --- python-warlock-1.0.1/debian/patches/python3.patch 1969-12-31 18:00:00.000000000 -0600 +++ python-warlock-1.0.1/debian/patches/python3.patch 2013-07-20 23:21:43.000000000 -0500 @@ -0,0 +1,112 @@ +From 415ce83d6ba5cf87fb127910991ca1cdb3eae3d5 Mon Sep 17 00:00:00 2001 +From: Chuck Short <chuck.sh...@canonical.com> +Date: Thu, 23 May 2013 12:08:05 -0500 +Subject: [PATCH] python3 Signed-off-by: Chuck Short + <chuck.sh...@canonical.com> + +--- + requirements.txt | 1 + + test/test_core.py | 9 +++++---- + warlock/core.py | 2 +- + warlock/model.py | 7 ++++--- + 4 files changed, 11 insertions(+), 8 deletions(-) + +Index: python-warlock-1.0.1-1ubuntu1/requirements.txt +=================================================================== +--- python-warlock-1.0.1-1ubuntu1.orig/requirements.txt ++++ python-warlock-1.0.1-1ubuntu1/requirements.txt +@@ -1,2 +1,3 @@ + jsonschema>=0.7,<3 + jsonpatch>=0.10,<2 ++six +Index: python-warlock-1.0.1-1ubuntu1/test/test_core.py +=================================================================== +--- python-warlock-1.0.1-1ubuntu1.orig/test/test_core.py ++++ python-warlock-1.0.1-1ubuntu1/test/test_core.py +@@ -16,6 +16,7 @@ + import unittest + + import warlock ++import six + + + fixture = { +@@ -44,7 +45,7 @@ + + def test_class_name_from_unicode_schema_name(self): + fixture_copy = copy.deepcopy(fixture) +- fixture_copy['name'] = unicode(fixture_copy['name']) ++ fixture_copy['name'] = six.text_type(fixture_copy['name']) + # Can't set class.__name__ to a unicode object, ensure warlock + # does some magic to make it possible + warlock.model_factory(fixture_copy) +@@ -81,7 +82,7 @@ + def test_items(self): + Country = warlock.model_factory(fixture) + sweden = Country(name='Sweden', population=9379116) +- self.assertEqual(set(list(sweden.iteritems())), ++ self.assertEqual(set(list(six.iteritems(sweden))), + set([('name', 'Sweden'), ('population', 9379116)])) + self.assertEqual(set(sweden.items()), + set([('name', 'Sweden'), ('population', 9379116)])) +@@ -104,7 +105,7 @@ + mike_1['sub']['foo'] = 'james' + self.assertEquals(mike.sub['foo'], 'mike') + +- mike_2 = dict(mike.iteritems()) ++ mike_2 = dict(six.iteritems(mike)) + mike_2['sub']['foo'] = 'james' + self.assertEquals(mike.sub['foo'], 'mike') + +@@ -112,7 +113,7 @@ + mike_2['sub']['foo'] = 'james' + self.assertEquals(mike.sub['foo'], 'mike') + +- mike_3_sub = list(mike.itervalues())[0] ++ mike_3_sub = list(six.itervalues(mike))[0] + mike_3_sub['foo'] = 'james' + self.assertEquals(mike.sub['foo'], 'mike') + +Index: python-warlock-1.0.1-1ubuntu1/warlock/core.py +=================================================================== +--- python-warlock-1.0.1-1ubuntu1.orig/warlock/core.py ++++ python-warlock-1.0.1-1ubuntu1/warlock/core.py +@@ -16,7 +16,7 @@ + + import copy + +-import model ++from . import model + + + def model_factory(schema, base_class=model.Model): +Index: python-warlock-1.0.1-1ubuntu1/warlock/model.py +=================================================================== +--- python-warlock-1.0.1-1ubuntu1.orig/warlock/model.py ++++ python-warlock-1.0.1-1ubuntu1/warlock/model.py +@@ -20,7 +20,8 @@ + import jsonpatch + import jsonschema + +-import exceptions ++from . import exceptions ++import six + + + class Model(dict): +@@ -98,13 +99,13 @@ + dict.update(self, other) + + def iteritems(self): +- return copy.deepcopy(dict(self)).iteritems() ++ return six.iteritems(copy.deepcopy(dict(self))) + + def items(self): + return copy.deepcopy(dict(self)).items() + + def itervalues(self): +- return copy.deepcopy(dict(self)).itervalues() ++ return six.itervalues(copy.deepcopy(dict(self))) + + def values(self): + return copy.deepcopy(dict(self)).values() diff -Nru python-warlock-1.0.1/debian/patches/series python-warlock-1.0.1/debian/patches/series --- python-warlock-1.0.1/debian/patches/series 1969-12-31 18:00:00.000000000 -0600 +++ python-warlock-1.0.1/debian/patches/series 2013-05-23 11:01:48.000000000 -0500 @@ -0,0 +1 @@ +python3.patch diff -Nru python-warlock-1.0.1/debian/python3-warlock.docs python-warlock-1.0.1/debian/python3-warlock.docs --- python-warlock-1.0.1/debian/python3-warlock.docs 1969-12-31 18:00:00.000000000 -0600 +++ python-warlock-1.0.1/debian/python3-warlock.docs 2013-05-23 11:26:57.000000000 -0500 @@ -0,0 +1,2 @@ +README.md +requirements.txt diff -Nru python-warlock-1.0.1/debian/python3-warlock.install python-warlock-1.0.1/debian/python3-warlock.install --- python-warlock-1.0.1/debian/python3-warlock.install 1969-12-31 18:00:00.000000000 -0600 +++ python-warlock-1.0.1/debian/python3-warlock.install 2013-07-07 16:04:47.000000000 -0500 @@ -0,0 +1 @@ +/usr/lib/python3/ diff -Nru python-warlock-1.0.1/debian/python-warlock.docs python-warlock-1.0.1/debian/python-warlock.docs --- python-warlock-1.0.1/debian/python-warlock.docs 1969-12-31 18:00:00.000000000 -0600 +++ python-warlock-1.0.1/debian/python-warlock.docs 2013-05-11 01:51:35.000000000 -0500 @@ -0,0 +1,2 @@ +README.md +requirements.txt diff -Nru python-warlock-1.0.1/debian/python-warlock.install python-warlock-1.0.1/debian/python-warlock.install --- python-warlock-1.0.1/debian/python-warlock.install 1969-12-31 18:00:00.000000000 -0600 +++ python-warlock-1.0.1/debian/python-warlock.install 2013-05-23 12:11:24.000000000 -0500 @@ -0,0 +1 @@ +/usr/lib/python2* diff -Nru python-warlock-1.0.1/debian/rules python-warlock-1.0.1/debian/rules --- python-warlock-1.0.1/debian/rules 2013-07-20 01:44:11.000000000 -0500 +++ python-warlock-1.0.1/debian/rules 2013-07-20 05:10:41.000000000 -0500 @@ -6,8 +6,33 @@ include /usr/share/openstack-pkg-tools/pkgos.make +PYTHON2=$(shell pyversions -vr) +PYTHON3=$(shell py3versions -vr) + %: - dh $@ --with python2 + dh $@ --with python2,python3 -override_dh_auto_test: +test-python2.7: nosetests + +test-python3.3: + nosetests3 || true + +override_dh_auto_test: $(PYTHON2:%=test-python%) $(PYTHON3:%=test-python%) + +build-python%: + python$* setup.py build + +override_dh_auto_build: $(PYTHON3:%=build-python%) + dh_auto_build + +install-python%: + python$* setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb + +override_dh_auto_install: $(PYTHON3:%=install-python%) + dh_auto_install + +override_dh_auto_clean: + dh_auto_clean + rm -rf build + rm -rf *.egg-info