3 # Chris Lumens <clumens@redhat.com>
5 # Copyright 2005, 2006 Red Hat, Inc.
7 # This software may be freely redistributed under the terms of the GNU
8 # general public license.
10 # You should have received a copy of the GNU General Public License
11 # along with this program; if not, write to the Free Software
12 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 from pykickstart.data import *
20 from pykickstart.parser import *
22 from rhpl.translate import _
23 import rhpl.translate as translate
25 translate.textdomain("pykickstart")
27 op = OptionParser(usage="usage: %prog [options] ksfile")
28 op.add_option("-e", "--firsterror", dest="firsterror", action="store_true",
29 default=False, help=_("halt after the first error or warning"))
30 op.add_option("-i", "--followincludes", dest="followincludes",
31 action="store_true", default=False,
32 help=_("parse include files when %include is seen"))
34 (opts, extra) = op.parse_args(sys.argv[1:])
42 ksdata = KickstartData()
43 kshandlers = KickstartHandlers(ksdata)
44 ksparser = KickstartParser(ksdata, kshandlers,
45 followIncludes=opts.followincludes,
46 errorsAreFatal=opts.firsterror)
48 # turn DeprecationWarnings into errors
49 warnings.filterwarnings("error")
52 ksparser.readKickstart(f)
53 except DeprecationWarning, msg:
54 print _("File uses a deprecated option or command.\n%s") % msg
56 except (KickstartParseError, KickstartValueError), msg:
59 except KickstartError:
60 print _("General kickstart error in input file")
63 print _("General error in input file: %s") % e