source: rtems-source-builder/source-builder/sb/defaults.py @ e5aa27f0

4.104.114.95
Last change on this file since e5aa27f0 was e5aa27f0, checked in by Chris Johns <chrisj@…>, on 02/20/13 at 23:07:04

Make sources directory if it does not exist.

Remove the need to add the --force option. Also revert the force option
back to the --force from --no-force and leave it so the user can
bypass the host check of various packages.

  • Property mode set to 100644
File size: 24.4 KB
Line 
1#
2# RTEMS Tools Project (http://www.rtems.org/)
3# Copyright 2010-2012 Chris Johns (chrisj@rtems.org)
4# All rights reserved.
5#
6# This file is part of the RTEMS Tools package in 'rtems-tools'.
7#
8# Permission to use, copy, modify, and/or distribute this software for any
9# purpose with or without fee is hereby granted, provided that the above
10# copyright notice and this permission notice appear in all copies.
11#
12# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
20#
21# Determine the defaults and load the specific file.
22#
23
24import glob
25import pprint
26import re
27import os
28
29import error
30import execute
31import path
32
33basepath = 'sb'
34
35#
36# All paths in defaults must be Unix format. Do not store any Windows format
37# paths in the defaults.
38#
39# Every entry must describe the type of checking a host must pass.
40#
41
42defaults = {
43# Nothing
44'nil':                 ('none', 'none', ''),
45
46# Set to invalid values.
47'_bset':               ('none',    'none', ''),
48'name':                ('none',    'none', ''),
49'version':             ('none',    'none', ''),
50'release':             ('none',    'none', ''),
51
52# GNU triples needed to build packages
53'_host':               ('triplet', 'required', ''),
54'_build':              ('triplet', 'required', '%{_host}'),
55'_target':             ('none',    'optional', ''),
56
57# Paths
58'_host_platform':      ('none',    'none',     '%{_host_cpu}-%{_host_vendor}-%{_host_os}%{?_gnu}'),
59'_build':              ('none',    'none',     '%{_host}'),
60'_arch':               ('none',    'none',     '%{_host_arch}'),
61'_sbdir':              ('none',    'none',     ''),
62'_topdir':             ('dir',     'required',  path.shell(os.getcwd())),
63'_configdir':          ('dir',     'optional', '%{_topdir}/config:%{_sbdir}/config'),
64'_tardir':             ('dir',     'optional', '%{_topdir}/tar'),
65'_sourcedir':          ('dir',     'optional', '%{_topdir}/sources'),
66'_patchdir':           ('dir',     'optional', '%{_topdir}/patches:%{_sbdir}/patches'),
67'_builddir':           ('dir',     'optional', '%{_topdir}/build/%{name}-%{version}-%{release}'),
68'_docdir':             ('dir',     'none',     '%{_defaultdocdir}'),
69'_tmppath':            ('dir',     'none',     '%{_topdir}/build/tmp'),
70'_tmproot':            ('dir',     'none',     '%{_tmppath}/source-build-%(%{__id_u} -n)/%{_bset}'),
71'buildroot:':          ('dir',     'none',     '%{_tmppath}/%{name}-root-%(%{__id_u} -n)'),
72'_datadir':            ('dir',     'none',     '%{_prefix}/share'),
73'_defaultdocdir':      ('dir',     'none',     '%{_prefix}/share/doc'),
74'_exeext':             ('none',    'none',     ''),
75'_exec_prefix':        ('dir',     'none',     '%{_prefix}'),
76'_bindir':             ('dir',     'none',     '%{_exec_prefix}/bin'),
77'_sbindir':            ('dir',     'none',     '%{_exec_prefix}/sbin'),
78'_libexecdir':         ('dir',     'none',     '%{_exec_prefix}/libexec'),
79'_datarootdir':        ('dir',     'none',     '%{_prefix}/share'),
80'_datadir':            ('dir',     'none',     '%{_datarootdir}'),
81'_sysconfdir':         ('dir',     'none',     '%{_prefix}/etc'),
82'_sharedstatedir':     ('dir',     'none',     '%{_prefix}/com'),
83'_localstatedir':      ('dir',     'none',     '%{prefix}/var'),
84'_includedir':         ('dir',     'none',     '%{_prefix}/include'),
85'_lib':                ('dir',     'none',     'lib'),
86'_libdir':             ('dir',     'none',     '%{_exec_prefix}/%{_lib}'),
87'_libexecdir':         ('dir',     'none',     '%{_exec_prefix}/libexec'),
88'_mandir':             ('dir',     'none',     '%{_datarootdir}/man'),
89'_infodir':            ('dir',     'none',     '%{_datarootdir}/info'),
90'_localedir':          ('dir',     'none',     '%{_datarootdir}/locale'),
91'_localedir':          ('dir',     'none',     '%{_datadir}/locale'),
92'_localstatedir':      ('dir',     'none',     '%{_prefix}/var'),
93'_prefix':             ('dir',     'none',     '%{_usr}'),
94'_usr':                ('dir',     'none',     '/usr/local'),
95'_usrsrc':             ('dir',     'none',     '%{_usr}/src'),
96'_var':                ('dir',     'none',     '/usr/local/var'),
97'_varrun':             ('dir',     'none',     '%{_var}/run'),
98
99# Defaults, override in platform specific modules.
100'___setup_shell':      ('exe',     'required', '/bin/sh'),
101'__aclocal':           ('exe',     'optional', 'aclocal'),
102'__ar':                ('exe',     'required', 'ar'),
103'__arch_install_post': ('exe',     'none',     '%{nil}'),
104'__as':                ('exe',     'required', 'as'),
105'__autoconf':          ('exe',     'required', 'autoconf'),
106'__autoheader':        ('exe',     'required', 'autoheader'),
107'__automake':          ('exe',     'required', 'automake'),
108'__awk':               ('exe',     'required', 'awk'),
109'__bash':              ('exe',     'optional', '/bin/bash'),
110'__bison':             ('exe',     'required', '/usr/bin/bison'),
111'__bzip2':             ('exe',     'required', '/usr/bin/bzip2'),
112'__cat':               ('exe',     'required', '/bin/cat'),
113'__cc':                ('exe',     'required', '/usr/bin/gcc'),
114'__chgrp':             ('exe',     'required', '/usr/bin/chgrp'),
115'__chmod':             ('exe',     'required', '/bin/chmod'),
116'__chown':             ('exe',     'required', '/usr/sbin/chown'),
117'__cp':                ('exe',     'required', '/bin/cp'),
118'__cpp':               ('exe',     'none',     '%{__cc} -E'),
119'__cxx':               ('exe',     'required', '/usr/bin/g++'),
120'__flex':              ('exe',     'required', '/usr/bin/flex'),
121'__grep':              ('exe',     'required', '/usr/bin/grep'),
122'__gzip':              ('exe',     'required', '/usr/bin/gzip'),
123'__id':                ('exe',     'required', '/usr/bin/id'),
124'__id_u':              ('exe',     'none',     '%{__id} -u'),
125'__install':           ('exe',     'required', '/usr/bin/install'),
126'__install_info':      ('exe',     'optional', '/usr/bin/install-info'),
127'__ld':                ('exe',     'required', '/usr/bin/ld'),
128'__ldconfig':          ('exe',     'required', '/sbin/ldconfig'),
129'__ln_s':              ('exe',     'none',     'ln -s'),
130'__make':              ('exe',     'required', 'make'),
131'__makeinfo':          ('exe',     'required', '/usr/bin/makeinfo'),
132'__mkdir':             ('exe',     'required', '/bin/mkdir'),
133'__mkdir_p':           ('exe',     'none',     '/bin/mkdir -p'),
134'__mv':                ('exe',     'required', '/bin/mv'),
135'__nm':                ('exe',     'required', '/usr/bin/nm'),
136'__objcopy':           ('exe',     'optional', '/usr/bin/objcopy'),
137'__objdump':           ('exe',     'optional', '/usr/bin/objdump'),
138'__patch':             ('exe',     'required', '/usr/bin/patch'),
139'__perl':              ('exe',     'optional', 'perl'),
140'__ranlib':            ('exe',     'required', 'ranlib'),
141'__rm':                ('exe',     'required', '/bin/rm'),
142'__sed':               ('exe',     'required', '/usr/bin/sed'),
143'__setup_post':        ('exe',     'none',     '%{__chmod} -R a+rX,g-w,o-w .'),
144'__sh':                ('exe',     'required', '/bin/sh'),
145'__tar':               ('exe',     'required', '/usr/bin/tar'),
146'__tar_extract':       ('exe',     'none',     '%{__tar} -xvvf'),
147'__unzip':             ('exe',     'required', '/usr/bin/unzip'),
148'__xz':                ('exe',     'required', '/usr/bin/xz'),
149
150# Shell Build Settings.
151'___build_args': ('none', 'none', '-e'),
152'___build_cmd':  ('none', 'none', '%{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}'),
153'___build_post': ('none', 'none', 'exit 0'),
154
155# Prebuild set up script.
156'___build_pre': ('none', 'none', '''# ___build_pre in as set up in defaults.py
157# Directories
158SB_SOURCE_DIR="%{_sourcedir}"
159SB_BUILD_DIR="%{_builddir}"
160SB_OPT_FLAGS="%{?_tmproot:-I%{_tmproot}/%{_prefix}/include -L%{_tmproot}/%{_prefix}/lib} %{optflags}"
161SB_ARCH="%{_arch}"
162SB_OS="%{_os}"
163export SB_SOURCE_DIR SB_BUILD_DIR SB_OPT_FLAGS SB_ARCH SB_OS
164# Documentation
165SB_DOC_DIR="%{_docdir}"
166export SB_DOC_DIR
167# Packages
168SB_PACKAGE_NAME="%{name}"
169SB_PACKAGE_VERSION="%{version}"
170SB_PACKAGE_RELEASE="%{release}"
171export SBPACKAGE_NAME SB_PACKAGE_VERSION SB_PACKAGE_RELEASE
172# Build root directory
173%{?buildroot:SB_BUILD_ROOT="%{buildroot}"}
174export SB_BUILD_ROOT
175# The compiler flags
176%{?_targetcflags:CFLAGS_FOR_TARGET="%{_targetcflags}"}
177%{?_targetcxxflags:CXXFLAGS_FOR_TARGET="%{_targetcxxflags}"}
178export CFLAGS_FOR_TARGET
179export CXXFLAGS_FOR_TARGET
180# Default environment set up.
181LANG=C
182export LANG
183unset DISPLAY || :
184umask 022
185cd "%{_builddir}"'''),
186'___build_shell': ('none', 'none', '%{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}'),
187'___build_template': ('none', 'none', '''#!%{___build_shell}
188%{___build_pre}
189%{nil}'''),
190
191# Configure command
192'configure': ('none', 'none', '''
193CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ;
194CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ;
195FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ;
196./configure --build=%{_build} --host=%{_host} \
197      --target=%{_target_platform} \
198      --program-prefix=%{?_program_prefix} \
199      --prefix=%{_prefix} \
200      --exec-prefix=%{_exec_prefix} \
201      --bindir=%{_bindir} \
202      --sbindir=%{_sbindir} \
203      --sysconfdir=%{_sysconfdir} \
204      --datadir=%{_datadir} \
205      --includedir=%{_includedir} \
206      --libdir=%{_libdir} \
207      --libexecdir=%{_libexecdir} \
208      --localstatedir=%{_localstatedir} \
209      --sharedstatedir=%{_sharedstatedir} \
210      --mandir=%{_mandir} \
211      --infodir=%{_infodir}''')
212}
213
214class command_line:
215    """Process the command line in a common way for all Tool Builder commands."""
216
217    _defaults = { 'params'   : [],
218                  'warn-all' : '0',
219                  'quiet'    : '0',
220                  'force'    : '0',
221                  'trace'    : '0',
222                  'dry-run'  : '0',
223                  'no-clean' : '0',
224                  'no-smp'   : '0',
225                  'rebuild'  : '0' }
226
227    #
228    # The define and if it is a path and needs conversion.
229    #
230    _long_opts = { '--prefix'         : ('_prefix', True),
231                   '--prefixbase'     : ('_prefixbase', True),
232                   '--topdir'         : ('_topdir', True),
233                   '--configdir'      : ('_configdir', True),
234                   '--builddir'       : ('_builddir', True),
235                   '--sourcedir'      : ('_sourcedir', True),
236                   '--tmppath'        : ('_tmppath', True),
237                   '--log'            : ('_logfile', False),
238                   '--url'            : ('_url_base', False),
239                   '--targetcflags'   : ('_targetcflags', False),
240                   '--targetcxxflags' : ('_targetcxxflags', False),
241                   '--libstdcxxflags' : ('_libstdcxxflags', False) }
242
243    _long_true_opts = { '--force'    : '_force',
244                        '--trace'    : '_trace',
245                        '--dry-run'  : '_dry_run',
246                        '--warn-all' : '_warn_all',
247                        '--no-clean' : '_no_clean',
248                        '--no-smp'   : '_no_smp',
249                        '--rebuild'  : '_rebuild' }
250
251    _target_triplets = { '--host'   : '_host',
252                         '--build'  : '_build',
253                         '--target' : '_target' }
254
255    def _help(self):
256        print '%s: [options] [args]' % (self.command_name)
257        print 'Source Builder, an RTEMS Tools Project (c) 2012-2013 Chris Johns'
258        print 'Options and arguments:'
259        print '--force                : Force the build to proceed'
260        print '--trace                : Trace the execution (not current used)'
261        print '--dry-run              : Do everything but actually run the build'
262        print '--warn-all             : Generate warnings'
263        print '--no-clean             : Do not clean up the build tree'
264        print '--no-smp               : Run with 1 job and not as many as CPUs'
265        print '--rebuild              : Rebuild (not used)'
266        print '--host                 : Set the host triplet'
267        print '--build                : Set the build triplet'
268        print '--target               : Set the target triplet'
269        print '--prefix path          : Tools build prefix, ie where they are installed'
270        print '--prefixbase path      : '
271        print '--topdir path          : Top of the build tree, default is $PWD'
272        print '--configdir path       : Path to the configuration directory, default: ./config'
273        print '--builddir path        : Path to the build directory, default: ./build'
274        print '--sourcedir path       : Path to the source directory, default: ./source'
275        print '--tmppath path         : Path to the temp directory, default: ./tmp'
276        print '--log file             : Log file where all build out is written too'
277        print '--url url              : URL to look for source'
278        print '--targetcflags flags   : List of C flags for the target code'
279        print '--targetcxxflags flags : List of C++ flags for the target code'
280        print '--libstdcxxflags flags : List of C++ flags to build the target libstdc++ code'
281        print '--with-<label>         : Add the --with-<label> to the build'
282        print '--without-<label>      : Add the --without-<label> to the build'
283        if self.optargs:
284            for a in self.optargs:
285                print '%-22s : %s' % (a, self.optargs[a])
286        raise error.exit()
287
288    def __init__(self, argv, optargs):
289        self.command_path = path.dirname(argv[0])
290        if len(self.command_path) == 0:
291            self.command_path = '.'
292        self.command_name = path.basename(argv[0])
293        self.args = argv[1:]
294        self.optargs = optargs
295        self.defaults = {}
296        for to in command_line._long_true_opts:
297            self.defaults[command_line._long_true_opts[to]] = ('none', 'none', '0')
298        self.defaults['_sbdir'] = ('dir', 'required', path.shell(self.command_path))
299        self._process()
300
301    def __str__(self):
302        def _dict(dd):
303            s = ''
304            ddl = dd.keys()
305            ddl.sort()
306            for d in ddl:
307                s += '  ' + d + ': ' + str(dd[d]) + '\n'
308            return s
309
310        s = 'command: ' + self.command() + \
311            '\nargs: ' + str(self.args) + \
312            '\nopts:\n' + _dict(self.opts)
313
314        return s
315
316    def _process(self):
317
318        def _process_lopt(opt, arg, long_opts, args, values = False):
319            for lo in long_opts:
320                if values and opt.startswith(lo):
321                    equals = opt.find('=')
322                    if equals < 0:
323                        if arg == len(args) - 1:
324                            raise error.general('missing option value: ' + lo)
325                        arg += 1
326                        value = args[arg]
327                    else:
328                        value = opt[equals + 1:]
329                    if type(long_opts[lo]) is tuple:
330                        if long_opts[lo][1]:
331                            value = path.shell(value)
332                        macro = long_opts[lo][0]
333                    else:
334                        macro = long_opts[lo]
335                    return lo, macro, value, arg
336                elif opt == lo:
337                    return lo, long_opts[lo], True, arg
338            return None, None, None, arg
339
340        self.opts = command_line._defaults
341        i = 0
342        while i < len(self.args):
343            a = self.args[i]
344            if a.startswith('-'):
345                if a.startswith('--'):
346                    if a.startswith('--warn-all'):
347                        self.opts['warn-all'] = True
348                    elif a == '--help':
349                        self._help()
350                    else:
351                        lo, macro, value, i = _process_lopt(a, i,
352                                                            command_line._long_true_opts,
353                                                            self.args)
354                        if lo:
355                            self.defaults[macro] = ('none', 'none', '1')
356                            self.opts[lo[2:]] = '1'
357                        else:
358                            lo, macro, value, i = _process_lopt(a, i,
359                                                                command_line._long_opts,
360                                                                self.args, True)
361                            if lo:
362                                self.defaults[macro] = ('none', 'none', value)
363                                self.opts[lo[2:]] = value
364                            else:
365                                #
366                                # The target triplet is 'cpu-vendor-os'.
367                                #
368                                lo, macro, value, i = _process_lopt(a, i,
369                                                                    command_line._target_triplets,
370                                                                    self.args, True)
371                                if lo:
372                                    #
373                                    # This is a target triplet. Run it past config.sub to make
374                                    # make sure it is ok.
375                                    #
376                                    e = execute.capture_execution()
377                                    config_sub = path.join(self.command_path,
378                                                           basepath, 'config.sub')
379                                    exit_code, proc, output = e.shell(config_sub + ' ' + value)
380                                    if exit_code == 0:
381                                        value = output
382                                    self.defaults[macro] = ('triplet', 'none', value)
383                                    self.opts[lo[2:]] = value
384                                    _arch = macro + '_cpu'
385                                    _vendor = macro + '_vendor'
386                                    _os = macro + '_os'
387                                    _arch_value = ''
388                                    _vendor_value = ''
389                                    _os_value = ''
390                                    dash = value.find('-')
391                                    if dash >= 0:
392                                        _arch_value = value[:dash]
393                                        value = value[dash + 1:]
394                                    dash = value.find('-')
395                                    if dash >= 0:
396                                        _vendor_value = value[:dash]
397                                        value = value[dash + 1:]
398                                    if len(value):
399                                        _os_value = value
400                                    self.defaults[_arch] = ('none', 'none', _arch_value)
401                                    self.defaults[_vendor] = ('none', 'none', _vendor_value)
402                                    self.defaults[_os] = ('none', 'none', _os_value)
403                                if not lo and a not in self.optargs:
404                                    raise error.general('invalid argument (try --help): %s' % (a))
405                else:
406                    if a == '-f':
407                        self.opts['force'] = '1'
408                    elif a == '-n':
409                        self.opts['dry-run'] = '1'
410                    elif a == '-q':
411                        self.opts['quiet'] = '1'
412                    elif a == '-?':
413                        self._help()
414                    else:
415                        raise error.general('invalid argument (try --help): %s' % (a))
416            else:
417                self.opts['params'].append(a)
418            i += 1
419
420    def _post_process(self, _defaults):
421        if self.no_smp():
422            _defaults['_smp_mflags'] = ('none', 'none', _defaults['nil'][2])
423        if _defaults['_host'][2] == _defaults['nil'][2]:
424            raise error.general('host not set')
425        return _defaults
426
427    def expand(self, s, _defaults):
428        """Simple basic expander of config file macros."""
429        mf = re.compile(r'%{[^}]+}')
430        expanded = True
431        while expanded:
432            expanded = False
433            for m in mf.findall(s):
434                name = m[2:-1]
435                if name in _defaults:
436                    s = s.replace(m, _defaults[name][2])
437                    expanded = True
438                else:
439                    raise error.general('cannot process default macro: ' + m)
440        return s
441
442    def command(self):
443        return path.join(self.command_path, self.command_name)
444
445    def force(self):
446        return self.opts['force'] != '0'
447
448    def dry_run(self):
449        return self.opts['dry-run'] != '0'
450
451    def set_dry_run(self):
452        self.opts['dry-run'] = '1'
453
454    def quiet(self):
455        return self.opts['quiet'] != '0'
456
457    def trace(self):
458        return self.opts['trace'] != '0'
459
460    def warn_all(self):
461        return self.opts['warn-all'] != '0'
462
463    def no_clean(self):
464        return self.opts['no-clean'] != '0'
465
466    def no_smp(self):
467        return self.opts['no-smp'] != '0'
468
469    def rebuild(self):
470        return self.opts['rebuild'] != '0'
471
472    def params(self):
473        return self.opts['params']
474
475    def get_arg(self, arg):
476        if not arg in self.optargs:
477            raise error.internal('bad arg: %s' % (arg))
478        for a in self.args:
479            if a.startswith(arg):
480                return a
481        return None
482
483    def get_config_files(self, config):
484        #
485        # Convert to shell paths and return shell paths.
486        #
487        # @fixme should this use a passed in set of defaults and not
488        #        not the initial set of values ?
489        #
490        config = path.shell(config)
491        if '*' in config or '?' in config:
492            print config
493            configdir = path.dirname(config)
494            configbase = path.basename(config)
495            if len(configbase) == 0:
496                configbase = '*'
497            if not configbase.endswith('.cfg'):
498                configbase = configbase + '.cfg'
499            if len(configdir) == 0:
500                configdir = self.expand(defaults['_configdir'][2], defaults)
501            configs = []
502            for cp in configdir.split(':'):
503                hostconfigdir = path.host(cp)
504                for f in glob.glob(os.path.join(hostconfigdir, configbase)):
505                    configs += path.shell(f)
506        else:
507            configs = [config]
508        return configs
509
510    def config_files(self):
511        configs = []
512        for config in self.opts['params']:
513            configs.extend(self.get_config_files(config))
514        return configs
515
516    def logfiles(self):
517        if 'log' in self.opts:
518            return self.opts['log'].split(',')
519        return ['stdout']
520
521    def urls(self):
522        if 'url' in self.opts:
523            return self.opts['url'].split(',')
524        return None
525
526    def prefixbase(self):
527        if 'prefixbase' in self.opts:
528            return self.opts['prefixbase']
529        return None
530
531def load(args, optargs = None):
532    """
533    Copy the defaults, get the host specific values and merge them overriding
534    any matching defaults, then create an options object to handle the command
535    line merging in any command line overrides. Finally post process the
536    command line.
537    """
538    d = defaults
539    overrides = None
540    if os.name == 'nt':
541        import windows
542        overrides = windows.load()
543    else:
544        uname = os.uname()
545        try:
546            if uname[0] == 'Darwin':
547                import darwin
548                overrides = darwin.load()
549            elif uname[0] == 'FreeBSD':
550                import freebsd
551                overrides = freebsd.load()
552            elif uname[0] == 'Linux':
553                import linux
554                overrides = linux.load()
555        except:
556            pass
557    if overrides is None:
558        raise error.general('no hosts defaults found; please add')
559    for k in overrides:
560        d[k] = overrides[k]
561    o = command_line(args, optargs)
562    for k in o.defaults:
563        d[k] = o.defaults[k]
564    d = o._post_process(d)
565    return o, d
566
567if __name__ == '__main__':
568    import sys
569    try:
570        _opts, _defaults = load(args = sys.argv)
571        print _opts
572        pprint.pprint(_defaults)
573    except error.general, gerr:
574        print gerr
575        sys.exit(1)
576    except error.internal, ierr:
577        print ierr
578        sys.exit(1)
579    sys.exit(0)
Note: See TracBrowser for help on using the repository browser.