Modifications to support boobank under win32
Signed-off-by: Romain Bignon <romain@peerfuse.org>
This commit is contained in:
parent
08d556a6e2
commit
86937aef95
3 changed files with 28 additions and 9 deletions
|
|
@ -20,6 +20,7 @@ from __future__ import with_statement
|
||||||
|
|
||||||
import stat
|
import stat
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
from ConfigParser import RawConfigParser, DuplicateSectionError
|
from ConfigParser import RawConfigParser, DuplicateSectionError
|
||||||
from logging import warning
|
from logging import warning
|
||||||
|
|
||||||
|
|
@ -37,11 +38,16 @@ class BackendsConfig(object):
|
||||||
try:
|
try:
|
||||||
mode = os.stat(confpath).st_mode
|
mode = os.stat(confpath).st_mode
|
||||||
except OSError:
|
except OSError:
|
||||||
os.mknod(confpath, 0600)
|
if sys.platform == 'win32':
|
||||||
|
fptr = open(confpath,'w')
|
||||||
|
fptr.close()
|
||||||
|
else:
|
||||||
|
os.mknod(confpath, 0600)
|
||||||
else:
|
else:
|
||||||
if mode & stat.S_IRGRP or mode & stat.S_IROTH:
|
if sys.platform != 'win32':
|
||||||
raise self.WrongPermissions(
|
if mode & stat.S_IRGRP or mode & stat.S_IROTH:
|
||||||
u'Weboob will not start until config file %s is readable by group or other users.' % confpath)
|
raise self.WrongPermissions(
|
||||||
|
u'Weboob will not start until config file %s is readable by group or other users.' % confpath)
|
||||||
|
|
||||||
def iter_backends(self):
|
def iter_backends(self):
|
||||||
config = RawConfigParser()
|
config = RawConfigParser()
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,13 @@ class ConsoleApplication(BaseApplication):
|
||||||
CAPS = None
|
CAPS = None
|
||||||
|
|
||||||
# shell escape strings
|
# shell escape strings
|
||||||
BOLD = '[1m'
|
if sys.platform == 'win32':
|
||||||
NC = '[0m' # no color
|
#workaround to disable bold
|
||||||
|
BOLD = ''
|
||||||
|
NC = '' # no color
|
||||||
|
else:
|
||||||
|
BOLD = '[1m'
|
||||||
|
NC = '[0m' # no color
|
||||||
|
|
||||||
stdin = sys.stdin
|
stdin = sys.stdin
|
||||||
stdout = sys.stdout
|
stdout = sys.stdout
|
||||||
|
|
@ -356,7 +361,10 @@ class ConsoleApplication(BaseApplication):
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if v.masked:
|
if v.masked:
|
||||||
line = getpass.getpass(question)
|
if sys.platform == 'win32':
|
||||||
|
line = getpass.getpass(str(question))
|
||||||
|
else:
|
||||||
|
line = getpass.getpass(question)
|
||||||
else:
|
else:
|
||||||
self.stdout.write(question)
|
self.stdout.write(question)
|
||||||
self.stdout.flush()
|
self.stdout.flush()
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ from __future__ import with_statement
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
import WConio
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import tty, termios
|
import tty, termios
|
||||||
|
|
@ -85,7 +87,10 @@ class IFormatter(object):
|
||||||
# XXX if stdin is not a tty, it seems that the command fails.
|
# 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()):
|
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):
|
def after_format(self, formatted):
|
||||||
if self.outfile != sys.stdout:
|
if self.outfile != sys.stdout:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue