summaryrefslogtreecommitdiff
path: root/tools/map-diff.py
diff options
context:
space:
mode:
authorVincent Petithory <vincent.petithory@gmail.com>2013-02-18 23:11:40 +0100
committerVincent Petithory <vincent.petithory@gmail.com>2013-02-18 23:32:23 +0100
commit3f8b83436c3c4d5aa46903572456c7f3252115db (patch)
tree1d8c04a664417a14dc07b712f7bd13ef81b5ea68 /tools/map-diff.py
parentd5faa80c7e7424d94ff5178a5581dd411553f8fa (diff)
downloadclientdata-3f8b83436c3c4d5aa46903572456c7f3252115db.tar.gz
clientdata-3f8b83436c3c4d5aa46903572456c7f3252115db.tar.bz2
clientdata-3f8b83436c3c4d5aa46903572456c7f3252115db.tar.xz
clientdata-3f8b83436c3c4d5aa46903572456c7f3252115db.zip
Map tools: use new --tilesize option of tmwrasterizer and update some things
Diffstat (limited to 'tools/map-diff.py')
-rwxr-xr-xtools/map-diff.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/tools/map-diff.py b/tools/map-diff.py
index b872d47f..1da5cdec 100755
--- a/tools/map-diff.py
+++ b/tools/map-diff.py
@@ -75,11 +75,13 @@ class MapDiff(object):
def _rastermap(self, tmx):
tmxf, tmxraster = tempfile.mkstemp(suffix='.png')
- subprocess.check_call([self.platform_programs.get('tmxrasterizer'), tmx, tmxraster])
+ subprocess.check_call([
+ self.platform_programs.get('tmxrasterizer'),
+ '--scale', '1.0',
+ tmx, tmxraster
+ ])
if os.stat(tmxraster).st_size == 0:
- # the image couldnt be rendered. The most probable reason is
- # that the map was too big (e.g 024-4, 500x500 tiles)
- raise Exception('Map too large to be rendered.')
+ raise Exception('A problem was encountered when rendering a map')
return tmxraster
@@ -107,10 +109,12 @@ class MapGitRevDiff(MapDiff):
# We have the 2 revs to compare. Let's extract the related tmx file
p1 = self._mktmx_from_rev(c1)
p2 = self._mktmx_from_rev(c2)
- difftmxpath = '%s_%s-%s.png' % (self.map_number, c1, c2)
- self._diffmaps(p1, p2, difftmxpath)
- os.unlink(p1)
- os.unlink(p2)
+ try:
+ difftmxpath = '%s_%s-%s.png' % (self.map_number, c1, c2)
+ self._diffmaps(p1, p2, difftmxpath)
+ finally:
+ os.unlink(p1)
+ os.unlink(p2)
def _mktmx_from_rev(self, rev):
p = subprocess.Popen([self.platform_programs.get('git'), '--no-pager', 'show', '%s:%s' % (rev, self.tmx_path)], stdout=subprocess.PIPE)