1 |
idella4 14/10/03 05:24:57 |
2 |
|
3 |
Added: |
4 |
south-1.0-3753b49c-Replace-dict.iteritems-with-six.patch |
5 |
Log: |
6 |
bump; rm IUSE doc and related content due to absence of content in acquired tarball, patch to match, tidy to test phase, ebuild adapted from submission in bug #524228 by W. King, closes said bug |
7 |
|
8 |
(Portage version: 2.2.10/cvs/Linux x86_64, signed Manifest commit with key 0xB8072B0D) |
9 |
|
10 |
Revision Changes Path |
11 |
1.1 dev-python/south/files/south-1.0-3753b49c-Replace-dict.iteritems-with-six.patch |
12 |
|
13 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/south/files/south-1.0-3753b49c-Replace-dict.iteritems-with-six.patch?rev=1.1&view=markup |
14 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/south/files/south-1.0-3753b49c-Replace-dict.iteritems-with-six.patch?rev=1.1&content-type=text/plain |
15 |
|
16 |
Index: south-1.0-3753b49c-Replace-dict.iteritems-with-six.patch |
17 |
=================================================================== |
18 |
# HG changeset patch |
19 |
# User Gary Wilson Jr. <gary@×××××××××××××.com> |
20 |
# Date 1397849538 18000 |
21 |
# Branch python3-iteritems |
22 |
# Node ID 3753b49ca9f3d34c94156622b380def245d88e80 |
23 |
# Parent 0e17add9b5e0f30f7cf5acf47961eea6a7f4032c |
24 |
Fixed a Python 3 incompatibility by replacing dict.iteritems() usage with an iteritems py3 util function from six. |
25 |
|
26 |
diff --git a/south/migration/migrators.py b/south/migration/migrators.py |
27 |
--- a/south/migration/migrators.py |
28 |
+++ b/south/migration/migrators.py |
29 |
@@ -16,7 +16,7 @@ |
30 |
from south.db import DEFAULT_DB_ALIAS |
31 |
from south.models import MigrationHistory |
32 |
from south.signals import ran_migration |
33 |
-from south.utils.py3 import StringIO |
34 |
+from south.utils.py3 import StringIO, iteritems |
35 |
|
36 |
|
37 |
class Migrator(object): |
38 |
@@ -161,7 +161,7 @@ |
39 |
if self.verbosity: |
40 |
print(" - Migration '%s' is marked for no-dry-run." % migration) |
41 |
return |
42 |
- for name, db in south.db.dbs.iteritems(): |
43 |
+ for name, db in iteritems(south.db.dbs): |
44 |
south.db.dbs[name].dry_run = True |
45 |
# preserve the constraint cache as it can be mutated by the dry run |
46 |
constraint_cache = deepcopy(south.db.db._constraint_cache) |
47 |
@@ -181,7 +181,7 @@ |
48 |
if self._ignore_fail: |
49 |
south.db.db.debug = old_debug |
50 |
south.db.db.clear_run_data(pending_creates) |
51 |
- for name, db in south.db.dbs.iteritems(): |
52 |
+ for name, db in iteritems(south.db.dbs): |
53 |
south.db.dbs[name].dry_run = False |
54 |
# restore the preserved constraint cache from before dry run was |
55 |
# executed |
56 |
diff --git a/south/utils/py3.py b/south/utils/py3.py |
57 |
--- a/south/utils/py3.py |
58 |
+++ b/south/utils/py3.py |
59 |
@@ -26,3 +26,18 @@ |
60 |
def with_metaclass(meta, base=object): |
61 |
"""Create a base class with a metaclass.""" |
62 |
return meta("NewBase", (base,), {}) |
63 |
+ |
64 |
+ |
65 |
+def _add_doc(func, doc): |
66 |
+ """Add documentation to a function.""" |
67 |
+ func.__doc__ = doc |
68 |
+ |
69 |
+if PY3: |
70 |
+ def iteritems(d, **kw): |
71 |
+ return iter(d.items(**kw)) |
72 |
+else: |
73 |
+ def iteritems(d, **kw): |
74 |
+ return iter(d.iteritems(**kw)) |
75 |
+ |
76 |
+_add_doc(iteritems, |
77 |
+ "Return an iterator over the (key, value) pairs of a dictionary.") |