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,8 +38,13 @@ class BackendsConfig(object):
|
||||||
try:
|
try:
|
||||||
mode = os.stat(confpath).st_mode
|
mode = os.stat(confpath).st_mode
|
||||||
except OSError:
|
except OSError:
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
fptr = open(confpath,'w')
|
||||||
|
fptr.close()
|
||||||
|
else:
|
||||||
os.mknod(confpath, 0600)
|
os.mknod(confpath, 0600)
|
||||||
else:
|
else:
|
||||||
|
if sys.platform != 'win32':
|
||||||
if mode & stat.S_IRGRP or mode & stat.S_IROTH:
|
if mode & stat.S_IRGRP or mode & stat.S_IROTH:
|
||||||
raise self.WrongPermissions(
|
raise self.WrongPermissions(
|
||||||
u'Weboob will not start until config file %s is readable by group or other users.' % confpath)
|
u'Weboob will not start until config file %s is readable by group or other users.' % confpath)
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,11 @@ class ConsoleApplication(BaseApplication):
|
||||||
CAPS = None
|
CAPS = None
|
||||||
|
|
||||||
# shell escape strings
|
# shell escape strings
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
#workaround to disable bold
|
||||||
|
BOLD = ''
|
||||||
|
NC = '' # no color
|
||||||
|
else:
|
||||||
BOLD = '[1m'
|
BOLD = '[1m'
|
||||||
NC = '[0m' # no color
|
NC = '[0m' # no color
|
||||||
|
|
||||||
|
|
@ -356,6 +361,9 @@ class ConsoleApplication(BaseApplication):
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if v.masked:
|
if v.masked:
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
line = getpass.getpass(str(question))
|
||||||
|
else:
|
||||||
line = getpass.getpass(question)
|
line = getpass.getpass(question)
|
||||||
else:
|
else:
|
||||||
self.stdout.write(question)
|
self.stdout.write(question)
|
||||||
|
|
|
||||||
|
|
@ -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,6 +87,9 @@ 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()):
|
||||||
|
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])
|
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):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue