Author: bugman Date: Sun Jun 8 00:29:50 2008 New Revision: 6322 URL: http://svn.gna.org/viewcvs/relax?rev=6322&view=rev Log: Shifted the dependency checks into a new module. Added: 1.3/dep_check.py Modified: 1.3/relax Added: 1.3/dep_check.py URL: http://svn.gna.org/viewcvs/relax/1.3/dep_check.py?rev=6322&view=auto ============================================================================== --- 1.3/dep_check.py (added) +++ 1.3/dep_check.py Sun Jun 8 00:29:50 2008 @@ -1,0 +1,53 @@ +############################################################################### +# # +# Copyright (C) 2008 Edward d'Auvergne # +# # +# This file is part of the program relax. # +# # +# relax is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# relax is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with relax; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +############################################################################### + +# Module docstring. +"""Module for checking relax dependencies. + +If essential dependencies are missing, then an error message is printed and the program terminated. +""" + + +# Python packages. +################## + + +# numpy. +try: + import numpy +except ImportError: + sys.stderr.write("The dependency 'numpy' has not been installed.\n") + sys.exit() + +# Command line option parser. +try: + import optparse +except ImportError: + sys.stderr.write("The dependency 'Optik' has not been installed.\n") + sys.exit() + +# Minfx python package check. +try: + import minfx +except ImportError: + sys.stderr.write("The dependency 'minfx' has not been installed (see https://gna.org/projects/minfx/).\n") + sys.exit() Modified: 1.3/relax URL: http://svn.gna.org/viewcvs/relax/1.3/relax?rev=6322&r1=6321&r2=6322&view=diff ============================================================================== --- 1.3/relax (original) +++ 1.3/relax Sun Jun 8 00:29:50 2008 @@ -34,7 +34,11 @@ ############################################################################### +# Dependency checks. +import dep_check + # Python modules. +from optparse import Option, OptionParser from os import F_OK, access, getpid, putenv import platform import profile @@ -42,27 +46,6 @@ from re import match from string import split, strip import sys - -# numpy. -try: - import numpy -except ImportError: - sys.stderr.write("The dependency 'numpy' has not been installed.\n") - sys.exit() - -# Command line option parser. -try: - from optparse import Option, OptionParser -except ImportError: - sys.stderr.write("The dependency 'Optik' has not been installed.\n") - sys.exit() - -# Minfx python package check. -try: - import minfx -except ImportError: - sys.stderr.write("The dependency 'minfx' has not been installed (see https://gna.org/projects/minfx/).\n") - sys.exit() # relax modules. import generic_fns