~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to terminal.py

  • Committer: Aaron Bentley
  • Date: 2012-01-20 02:07:15 UTC
  • Revision ID: aaron@aaronbentley.com-20120120020715-ar6jbqnrjcuebggz
Tags: release-2.5
Update for 2.5 release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Copyright (C) 2004 Aaron Bentley
2
 
# <aaron.bentley@utoronto.ca>
 
2
# <aaron@aaronbentley.com>
3
3
#
4
4
#    This program is free software; you can redistribute it and/or modify
5
5
#    it under the terms of the GNU General Public License as published by
27
27
    # XXX See terminfo(5) for all the gory details.
28
28
    if sys.platform == "win32":
29
29
        return False
 
30
    if not sys.stdout.isatty():
 
31
        return False
30
32
    import curses
31
 
    curses.setupterm()
 
33
    try:
 
34
        curses.setupterm()
 
35
    except curses.error:
 
36
        return False
32
37
    return bool(curses.tigetstr('setaf'))
33
38
 
34
39
colors = {