[weboob] (no subject)

Laurent Dufréchou ldufrechou at rtsys.fr
Thu Mar 17 00:25:06 CET 2011


>From ce61390da7a46357ebf7e1bf28714ff199af181f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Laurent=20Dufr=C3=A9chou?= <ldufrechou at rtsys.fr>
Date: Thu, 17 Mar 2011 00:18:59 +0100
Subject: [PATCH 1/2] Modify setup.py to include PATH into subshell env under win32

---
 setup.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/setup.py b/setup.py
index 51d93ee..4d1239e 100755
--- a/setup.py
+++ b/setup.py
@@ -83,7 +83,7 @@ def build_qt():
     pyuic4 = check_executable('pyuic4', 'To disable Qt applications, use --no-qt.')
 
     if sys.platform == 'win32':
-        env={ 'PYUIC' : pyuic4}
+        env={ 'PYUIC' : pyuic4, 'PATH':os.environ['PATH']}
         extraMakeFlag = ['-e']
     else:
         env = None
-- 
1.7.4.msysgit.0

>From 5b8ebdc04d7de0227fca2eb7643a7ea541ad33f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Laurent=20Dufr=C3=A9chou?= <ldufrechou at rtsys.fr>
Date: Thu, 17 Mar 2011 00:20:12 +0100
Subject: [PATCH 2/2] Modifications to support boobank under win32

---
 weboob/core/backendscfg.py                        |   14 ++++++++++----
 weboob/tools/application/console.py               |   14 +++++++++++---
 weboob/tools/application/formatters/iformatter.py |    9 +++++++--
 3 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/weboob/core/backendscfg.py b/weboob/core/backendscfg.py
index 4551e14..841c3a8 100644
--- a/weboob/core/backendscfg.py
+++ b/weboob/core/backendscfg.py
@@ -20,6 +20,7 @@ from __future__ import with_statement
 
 import stat
 import os
+import sys
 from ConfigParser import RawConfigParser, DuplicateSectionError
 from logging import warning
 
@@ -37,11 +38,16 @@ class BackendsConfig(object):
         try:
             mode = os.stat(confpath).st_mode
         except OSError:
-            os.mknod(confpath, 0600)
+            if sys.platform == 'win32':
+                fptr = open(confpath,'w')
+                fptr.close()
+            else:
+                os.mknod(confpath, 0600)
         else:
-            if mode & stat.S_IRGRP or mode & stat.S_IROTH:
-                raise self.WrongPermissions(
-                    u'Weboob will not start until config file %s is readable by group or other users.' % confpath)
+            if sys.platform != 'win32':
+                if mode & stat.S_IRGRP or mode & stat.S_IROTH:
+                    raise self.WrongPermissions(
+                        u'Weboob will not start until config file %s is readable by group or other users.' % confpath)
 
     def iter_backends(self):
         config = RawConfigParser()
diff --git a/weboob/tools/application/console.py b/weboob/tools/application/console.py
index 28ab68b..7c91f21 100644
--- a/weboob/tools/application/console.py
+++ b/weboob/tools/application/console.py
@@ -40,8 +40,13 @@ class ConsoleApplication(BaseApplication):
     CAPS = None
 
     # shell escape strings
-    BOLD   = ''
-    NC     = ''    # no color
+    if sys.platform == 'win32':
+        #workaround to disable bold
+        BOLD   = ''
+        NC     = ''          # no color
+    else:
+        BOLD   = ''
+        NC     = ''    # no color
 
     stdin = sys.stdin
     stdout = sys.stdout
@@ -356,7 +361,10 @@ class ConsoleApplication(BaseApplication):
 
         while True:
             if v.masked:
-                line = getpass.getpass(question)
+                if sys.platform == 'win32':
+                    line = getpass.getpass(str(question))
+                else:
+                    line = getpass.getpass(question)
             else:
                 self.stdout.write(question)
                 self.stdout.flush()
diff --git a/weboob/tools/application/formatters/iformatter.py b/weboob/tools/application/formatters/iformatter.py
index 37ea894..13b59c4 100644
--- a/weboob/tools/application/formatters/iformatter.py
+++ b/weboob/tools/application/formatters/iformatter.py
@@ -21,7 +21,9 @@ from __future__ import with_statement
 import os
 import sys
 import subprocess
-
+if sys.platform == 'win32':
+    import WConio
+    
 try:
     import tty, termios
 except ImportError:
@@ -85,7 +87,10 @@ class IFormatter(object):
         # XXX if stdin is not a tty, it seems that the command fails.
 
         if os.isatty(sys.stdout.fileno()) and os.isatty(sys.stdin.fileno()):
-            self.termrows = int( subprocess.Popen('stty size', shell=True, stdout=subprocess.PIPE).communicate()[0].split()[0])
+            if sys.platform == 'win32':
+                self.termrows = WConio.gettextinfo()[8]
+            else:
+                self.termrows = int( subprocess.Popen('stty size', shell=True, stdout=subprocess.PIPE).communicate()[0].split()[0])
 
     def after_format(self, formatted):
         if self.outfile != sys.stdout:
-- 
1.7.4.msysgit.0





More information about the weboob mailing list