From 9cd40193c542c90bf2339b656e428eaffeb89fbd Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 1 Oct 2014 10:43:22 -0700 Subject: [PATCH] south-1.0: Package the 2014-07-01 release MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit South is now end-of-life [1]: Please note that South is now end of lifed in favour of the ​new migrations framework in Django 1.7, which is based on South but with significant design improvements. South will not work with Django 1.7; it supports only versions 1.4, 1.5 and 1.6. so I've limited compatibility to +# Date 1397849538 18000 +# Branch python3-iteritems +# Node ID 3753b49ca9f3d34c94156622b380def245d88e80 +# Parent 0e17add9b5e0f30f7cf5acf47961eea6a7f4032c +Fixed a Python 3 incompatibility by replacing dict.iteritems() usage with an iteritems py3 util function from six. + +diff --git a/south/migration/migrators.py b/south/migration/migrators.py +--- a/south/migration/migrators.py ++++ b/south/migration/migrators.py +@@ -16,7 +16,7 @@ + from south.db import DEFAULT_DB_ALIAS + from south.models import MigrationHistory + from south.signals import ran_migration +-from south.utils.py3 import StringIO ++from south.utils.py3 import StringIO, iteritems + + + class Migrator(object): +@@ -161,7 +161,7 @@ + if self.verbosity: + print(" - Migration '%s' is marked for no-dry-run." % migration) + return +- for name, db in south.db.dbs.iteritems(): ++ for name, db in iteritems(south.db.dbs): + south.db.dbs[name].dry_run = True + # preserve the constraint cache as it can be mutated by the dry run + constraint_cache = deepcopy(south.db.db._constraint_cache) +@@ -181,7 +181,7 @@ + if self._ignore_fail: + south.db.db.debug = old_debug + south.db.db.clear_run_data(pending_creates) +- for name, db in south.db.dbs.iteritems(): ++ for name, db in iteritems(south.db.dbs): + south.db.dbs[name].dry_run = False + # restore the preserved constraint cache from before dry run was + # executed +diff --git a/south/utils/py3.py b/south/utils/py3.py +--- a/south/utils/py3.py ++++ b/south/utils/py3.py +@@ -26,3 +26,18 @@ + def with_metaclass(meta, base=object): + """Create a base class with a metaclass.""" + return meta("NewBase", (base,), {}) ++ ++ ++def _add_doc(func, doc): ++ """Add documentation to a function.""" ++ func.__doc__ = doc ++ ++if PY3: ++ def iteritems(d, **kw): ++ return iter(d.items(**kw)) ++else: ++ def iteritems(d, **kw): ++ return iter(d.iteritems(**kw)) ++ ++_add_doc(iteritems, ++ "Return an iterator over the (key, value) pairs of a dictionary.") diff --git a/south-1.0.ebuild b/south-1.0.ebuild new file mode 100644 index 0000000..e3d248b --- /dev/null +++ b/south-1.0.ebuild @@ -0,0 +1,59 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header$ + +EAPI=5 + +PYTHON_COMPAT=( python{2_7,3_2,3_3,3_4} pypy ) + +inherit distutils-r1 + +MY_PN="South" +MY_P="${MY_PN}-${PV}" + +DESCRIPTION="Intelligent schema migrations for Django apps." +HOMEPAGE="http://south.aeracode.org/" +SRC_URI="mirror://pypi/${MY_P:0:1}/${MY_PN}/${MY_P}.tar.gz -> ${P}.tar.gz" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="doc test" + +RDEPEND="> southtest/settings.py + "${EPYTHON}" manage.py test south || die "tests failed for ${EPYTHON}" +} + +pkg_postinst() { + elog "In order to use the south schema migrations for your Django project," + elog "just add 'south' to your INSTALLED_APPS in the settings.py file." + elog "manage.py will now automagically offer the new functions." +} -- 2.26.2