[game-data-packager] 01/02: PackageRelation: make str() stable

Simon McVittie smcv at debian.org
Wed Jun 29 10:00:51 UTC 2016


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch master
in repository game-data-packager.

commit 3f92824b98789290b92b6f75d3e9b997f1d80ade
Author: Simon McVittie <smcv at debian.org>
Date:   Wed Jun 29 10:40:28 2016 +0100

    PackageRelation: make str() stable
    
    Previously, there was no guarantee about the order of dict entries.
---
 game_data_packager/data.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/game_data_packager/data.py b/game_data_packager/data.py
index 10fb32e..73703d2 100644
--- a/game_data_packager/data.py
+++ b/game_data_packager/data.py
@@ -349,7 +349,11 @@ class PackageRelation:
 
     def __str__(self):
         if self.contextual:
-            return repr(self)
+            ret = []
+            for context, specific in self.contextual.items():
+                ret.append(repr(context) + ': ' + repr(str(specific)))
+            ret.sort()
+            return '{' + ', '.join(ret) + '}'
 
         if self.alternatives:
             return ' | '.join([str(s) for s in self.alternatives])

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list