euscan: Progressbar on stderr

Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
volpino 2012-07-24 08:10:56 +02:00
parent fb77d201c8
commit 2b09bfba8a
4 changed files with 5 additions and 2 deletions

View File

@ -36,6 +36,7 @@ from euscan import CONFIG, output
# Globals # Globals
isatty = os.environ.get('TERM') != 'dumb' and sys.stdout.isatty() isatty = os.environ.get('TERM') != 'dumb' and sys.stdout.isatty()
isatty_stderr = os.environ.get('TERM') != 'dumb' and sys.stderr.isatty()
def exit_helper(status): def exit_helper(status):
@ -184,7 +185,7 @@ def parse_args():
CONFIG['nocolor'] = True CONFIG['nocolor'] = True
pp.output.nocolor() pp.output.nocolor()
elif o in ("-p", "--progress"): elif o in ("-p", "--progress"):
CONFIG['progress'] = isatty CONFIG['progress'] = isatty_stderr
elif o in ("--mirror"): elif o in ("--mirror"):
CONFIG['mirror'] = True CONFIG['mirror'] = True
elif o in ("-i", "--ignore-pre-release"): elif o in ("-i", "--ignore-pre-release"):

View File

@ -13,6 +13,7 @@ from euscan.version import get_version_type
from djeuscan.processing import FakeLogger from djeuscan.processing import FakeLogger
from djeuscan.models import Package, Version, VersionLog from djeuscan.models import Package, Version, VersionLog
class ScanPortage(object): class ScanPortage(object):
def __init__(self, logger=None, no_log=False, purge_packages=False, def __init__(self, logger=None, no_log=False, purge_packages=False,
purge_versions=False): purge_versions=False):

View File

@ -3,7 +3,6 @@ from urllib import urlencode
from django.test import TestCase from django.test import TestCase
from django.test.client import Client from django.test.client import Client
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from djeuscan.tests.euscan_factory import UserFactory from djeuscan.tests.euscan_factory import UserFactory

View File

@ -1,3 +1,4 @@
import sys
from io import StringIO from io import StringIO
from collections import defaultdict from collections import defaultdict
import json import json
@ -37,6 +38,7 @@ class ProgressHandler(object):
def progress_bar(): def progress_bar():
on_progress = None on_progress = None
progress_bar = TermProgressBar(title="euscan") progress_bar = TermProgressBar(title="euscan")
progress_bar.file = sys.stderr
progress_handler = ProgressHandler(progress_bar) progress_handler = ProgressHandler(progress_bar)
on_progress = progress_handler.on_progress on_progress = progress_handler.on_progress