mail[Wesnoth-commits] r25277 - in /trunk: Makefile.am SConstruct


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by esr on March 29, 2008 - 12:28:
Author: esr
Date: Sat Mar 29 12:28:18 2008
New Revision: 25277

URL: http://svn.gna.org/viewcvs/wesnoth?rev=25277&view=rev
Log:
Implement tinygui image resizing in scons recipe.

Modified:
    trunk/Makefile.am
    trunk/SConstruct

Modified: trunk/Makefile.am
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/Makefile.am?rev=25277&r1=25276&r2=25277&view=diff
==============================================================================
--- trunk/Makefile.am (original)
+++ trunk/Makefile.am Sat Mar 29 12:28:18 2008
@@ -58,7 +58,7 @@
        cd utils; ./sanity_check
        cd data/tools; make sanity-check
 
-# *** Not yet covered by scons recipe (dummylocales. doc install, tinygui)
+# *** Not yet covered by scons recipe (dummylocales. doc install)
 install-data-local:
        @$(NORMAL_INSTALL)
 if INSTALLDATA

Modified: trunk/SConstruct
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/SConstruct?rev=25277&r1=25276&r2=25277&view=diff
==============================================================================
--- trunk/SConstruct (original)
+++ trunk/SConstruct Sat Mar 29 12:28:18 2008
@@ -1,5 +1,10 @@
 #
 # SCons build description for the Wesnoth project
+#
+# Prerequisites are:
+# 1. Subversion command-line client programs svnstatus and svnversion.
+# 2. Unix file(1), on installation only.
+# 3. Unix convert(1), on installation only, if using tinygui.
 #
 import os, sys, commands, shutil, sets
 from SCons.Script import *
@@ -895,7 +900,25 @@
                 os.makedirs(target)
             map(lambda f: InstallFilteredHook(target, 
os.path.join(str(source), f), env), os.listdir(str(source)))
     elif CopyFilter(source):
-        #print "Copy  source=%s target=%s" % (str(source), target)
+        #print "Copy source=%s target=%s" % (str(source), target)
+        if env["tinygui"] and source.endswith("jpg") or 
source.endswith("png"):
+             (status, output) = commands.getstatusoutput("file "+ source)
+             output = output.replace(" x ", "x")
+             target = os.path.join(target, os.path.basename(source))
+             if "RGBA" in output or "alpha" in output:
+                 command = "convert -filter point -resize %s %s %s"
+             else:
+                 command = "convert -filter point -resize %s %s %s"
+             if status == 0:
+                 for (large, small) in (("1024x768","320x240"),
+                                        ("640x480","240x180"),
+                                        ("205x205","240x180")):
+                     if large in output:
+                         os.system(command % (small, source, target))
+                 else:
+                     os.system(command % ("50%", source, target))
+                 return None
+        # Just copy non-images, and images if tinygui is off
         shutil.copy2(str(source), target)
     return None
 env.Append(BUILDERS={'InstallFiltered':Builder(action=InstallFilteredHook)})




Related Messages


Powered by MHonArc, Updated Sat Mar 29 12:41:18 2008