Author: elias
Date: Mon Jan 11 21:52:57 2010
New Revision: 40671

URL: http://svn.gna.org/viewcvs/wesnoth?rev=40671&view=rev
Log:
[wmlunits] fixed some problems with latin1 filenames

Modified:
    trunk/data/tools/unit_tree/helpers.py
    trunk/data/tools/wesnoth/wmlparser.py
    trunk/data/tools/wmlunits

Modified: trunk/data/tools/unit_tree/helpers.py
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/unit_tree/helpers.py?rev=40671&r1=40670&r2=40671&view=diff
==============================================================================
--- trunk/data/tools/unit_tree/helpers.py (original)
+++ trunk/data/tools/unit_tree/helpers.py Mon Jan 11 21:52:57 2010
@@ -139,7 +139,8 @@
                 p.wait()
             else:
                 sys.stderr.write(
-                    "Warning: Required image %s: \"%s\" does not exist.\n" % 
(c, i))
+                    "Warning: Required image %s: \"%s\" does not exist.\n" % (
+                        repr(c), repr(i)))
                 if self.verbose:
                     sys.stderr.write("Warning: Looked at the following 
locations:\n")
                     sys.stderr.write("\n".join(bases) + "\n")
@@ -352,7 +353,10 @@
                     except KeyError:
                         sys.stderr.write(
                             ("Error: Era '%s' faction '%s' references " +
-                            "non-existant unit id '%s'!\n") % (eid, fid, uid))
+                            "non-existant unit id '%s'!\n") % (
+                                eid,
+                                fid,
+                                repr(uid)))
                         continue
                     if not eid in unit.eras:
                         unit.eras.append(eid)

Modified: trunk/data/tools/wesnoth/wmlparser.py
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wesnoth/wmlparser.py?rev=40671&r1=40670&r2=40671&view=diff
==============================================================================
--- trunk/data/tools/wesnoth/wmlparser.py (original)
+++ trunk/data/tools/wesnoth/wmlparser.py Mon Jan 11 21:52:57 2010
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-
+# encoding: utf8
 import wmldata, os, glob, sys
 import re
 
@@ -385,10 +385,14 @@
                     return None
             # If it is a directory, parse all cfg files within.
             if os.path.isdir(dirpath):
+                # Note: glob.glob will try to return unicode filenames
+                # if you pass it an unicode string - but to deal with
+                # non-unicode filenames as are allowed in linux we
+                # convert to a byte-string.
                 # Execute all WML files in the directory.
-                files = glob.glob(dirpath + "/*.cfg")
+                files = glob.glob(str(dirpath + "/*.cfg"))
                 # And also execute directories with a _main.cfg.
-                files += glob.glob(dirpath + "/*/_main.cfg")
+                files += glob.glob(str(dirpath + "/*/_main.cfg"))
                 files.sort()
                 mc = dirpath + "/_main.cfg"
                 fc = dirpath + "/_final.cfg"

Modified: trunk/data/tools/wmlunits
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wmlunits?rev=40671&r1=40670&r2=40671&view=diff
==============================================================================
--- trunk/data/tools/wmlunits (original)
+++ trunk/data/tools/wmlunits Mon Jan 11 21:52:57 2010
@@ -111,7 +111,7 @@
                         except KeyError:
                             sys.stderr.write(
                                 "Warning: Unit %s not found as advancement of 
%s\n" %
-                                (auid, uid))
+                                (auid, repr(uid)))
                             continue
                         forest.add_node(helpers.UnitNode(au))
                         new_units_added[auid] = au


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to