Re: Call For Help! I need Windows/Python developers!

James Abbatiello <[email protected]> Fri, 26 Jun 2009 01:51:22 -0400
Newsgroups gmane.comp.python.cheetah
Message-ID <[email protected]>
On Fri, Jun 26, 2009 at 12:16 AM, James Abbatiello<[email protected]> wrote:
> 2) Some tests assume that the shell will expand globs ("*.tmpl") and
> the Windows shell doesn't do this.  I'm skipping these tests on
> Windows.

R. Tyler Ballance suggested that it might be better to manually expand
the globs if running on Windows.  This will allow the tests to pass on
all platforms.  Here's a new patch that tries to do this.

-- 
James Abbatiello

------------------------------------------------------------------------------

_______________________________________________
Cheetahtemplate-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
0001-Expand-glob-command-line-arguments-on-Windows.patch (application/octet-stream, 1.4 KB)
From 4384f1b3ac98a4fc6546f6be1207beeb057e2de0 Mon Sep 17 00:00:00 2001
From: James Abbatiello <[email protected]>
Date: Fri, 26 Jun 2009 01:49:58 -0400
Subject: [PATCH] Expand glob command line arguments on Windows

---
 src/CheetahWrapper.py |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/CheetahWrapper.py b/src/CheetahWrapper.py
index 9f24b69..7cf1a72 100644
--- a/src/CheetahWrapper.py
+++ b/src/CheetahWrapper.py
@@ -174,7 +174,19 @@ class CheetahWrapper(object):
         pao("--parallel", action="store", type="int", dest="parallel", default=1, help='Compile/fill templates in parallel, e.g. --parallel=4')
         pao('--shbang', dest='shbang', default='#!/usr/bin/env python', help='Specify the shbang to place at the top of compiled templates, e.g. --shbang="#!/usr/bin/python2.6"')
 
-        self.opts, self.pathArgs = opts, files = self.parser.parse_args(args)
+        opts, files = self.parser.parse_args(args)
+        self.opts = opts
+        if sys.platform == "win32":
+            new_files = []
+            for spec in files:
+                file_list = glob.glob(spec)
+                if file_list:
+                    new_files.extend(file_list)
+                else:
+                    new_files.append(spec)
+            files = new_files
+        self.pathArgs = files
+
         D("""\
 cheetah compile %s
 Options are
-- 
1.6.3.2.1299.gee46c