00001 # -*- python -*- 00002 # vim:set ts=4 sw=4 et: 00003 # 00004 # Copyright 2014 Vladimir Ermakov. 00005 # 00006 # This program is free software; you can redistribute it and/or modify 00007 # it under the terms of the GNU General Public License as published by 00008 # the Free Software Foundation; either version 3 of the License, or 00009 # (at your option) any later version. 00010 # 00011 # This program is distributed in the hope that it will be useful, but 00012 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00013 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00014 # for more details. 00015 # 00016 # You should have received a copy of the GNU General Public License along 00017 # with this program; if not, write to the Free Software Foundation, Inc., 00018 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 00020 from __future__ import print_function 00021 00022 import os 00023 import sys 00024 00025 00026 def print_if(cond, *args, **kvargs): 00027 if cond: 00028 print(*args, **kvargs) 00029 00030 00031 def fault(*args, **kvargs): 00032 kvargs['file'] = sys.stderr 00033 print(*args, **kvargs) 00034 sys.exit(1)