1
# GNU Solfege - free ear training software
2
# Copyright (C) 2005, 2007, 2008 Tom Cato Amundsen
4
# This program is free software: you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation, either version 3 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program. If not, see <http://www.gnu.org/licenses/>.
18
This file does the checking for optional features that depend on
19
python modules the user can have installed.
21
It also does sanity check on the python and pygtk versions and some
22
other initial setup tasks.
29
use_cairo_widgets = None
31
def assert_python_version(required_version):
32
if sys.version_info < required_version:
34
print "Solfege need Python %s or newer. The configure script told you so!" % (".".join([str(i) for i in required_version]))
38
def setup_pygtk(required_version):
40
# this is needed for py2exe
41
if sys.platform == 'win32':
42
os.environ['PATH'] += ";lib;bin;"
46
gtk.rc_parse("solfege.gtkrc")
47
# The rest of this function is just for sanity check. Not really required.
48
if gtk.pygtk_version < required_version:
50
print " GNU Solfege requires pygtk version %s or newer." % (".".join([str(i) for i in required_version]))
51
print " The version installed appears to be %s" % (".".join([str(i) for i in gtk.pygtk_version]))
52
print " Exiting program."
59
global use_cairo_widgets
60
assert_python_version((2, 4))
62
if options.enable_gtkhtml:
64
if options.no_cairo_widgets:
65
use_cairo_widgets = False
68
if gtk.pygtk_version < (2, 8, 0):
69
use_cairo_widgets = False
71
use_cairo_widgets = True