diff options
author | John Wiegley <johnw@fpcomplete.com> | 2013-01-30 17:01:00 -0600 |
---|---|---|
committer | John Wiegley <johnw@fpcomplete.com> | 2013-01-30 17:01:00 -0600 |
commit | b21ee1de170f99e8ed5c82546c8ae69e209bd8d6 (patch) | |
tree | f016a1a54c73759be460517e0d51db02d85af39a /acprep | |
parent | ccca974dadc9c57805aeb47565eecd4e25c9d368 (diff) | |
parent | 20217e7c9c990039a264b94637bba6b2caffe885 (diff) | |
download | fork-ledger-b21ee1de170f99e8ed5c82546c8ae69e209bd8d6.tar.gz fork-ledger-b21ee1de170f99e8ed5c82546c8ae69e209bd8d6.tar.bz2 fork-ledger-b21ee1de170f99e8ed5c82546c8ae69e209bd8d6.zip |
Merge branch 'next' of github.com:ledger/ledger into next
Diffstat (limited to 'acprep')
-rwxr-xr-x | acprep | 57 |
1 files changed, 27 insertions, 30 deletions
@@ -101,13 +101,6 @@ class CommandLineApp(object): log_handler = None boost_major = "1_52" - options = { - 'debug': False, - 'verbose': False, - 'logfile': False, - 'loglevel': False - } - def __init__(self): "Initialize CommandLineApp." # Create the logger @@ -137,7 +130,8 @@ class CommandLineApp(object): op.add_option('', '--loglevel', metavar='LEVEL', type='string', action='store', dest='loglevel', default=False, help='set log level: DEBUG, INFO, WARNING, ERROR, CRITICAL') - return + + self.options = op.get_default_values() def main(self, *args): """Main body of your application. @@ -167,7 +161,7 @@ class CommandLineApp(object): Process options and execute callback functions as needed. This method should not need to be overridden, if the main() method is defined.""" # Process the options supported and given - self.options, main_args = self.option_parser.parse_args() + self.options, main_args = self.option_parser.parse_args(values=self.options) if self.options.logfile: fh = logging.handlers.RotatingFileHandler(self.options.logfile, @@ -238,9 +232,7 @@ class PrepareBuild(CommandLineApp): self.current_ver = None #self.current_flavor = 'default' self.current_flavor = 'debug' - self.prefix_dir = None self.products_dir = None - self.build_dir = self.source_dir self.configure_args = [] self.CXXFLAGS = [] self.LDFLAGS = [] @@ -264,7 +256,7 @@ class PrepareBuild(CommandLineApp): products = self.default_products_directory() if (exists(products) and isdir(products)) or \ (exists('build') and isdir('build')): - self.build_dir = None + self.options.build_dir = None def __init__(self): CommandLineApp.__init__(self) @@ -272,8 +264,6 @@ class PrepareBuild(CommandLineApp): self.source_dir = os.getcwd() - self.initialize() - op = self.option_parser op.add_option('', '--help', action="callback", @@ -311,21 +301,25 @@ class PrepareBuild(CommandLineApp): help='Enable use of Doxygen to build ref manual ("make docs")') op.add_option('', '--python', action='store_true', dest='python', default=False, - help='Enable Python support (if disabled in acprep)') - op.add_option('', '--no-python', action='store_true', dest='no_python', - default=False, - help='Do not enable Python support by default') + help='Enable Python support') + op.add_option('', '--no-python', action='store_false', dest='python', + help='Disable python support (default)') op.add_option('', '--prefix', metavar='DIR', action="store", dest="prefix_dir", help='Use custom installation prefix') op.add_option('', '--products', metavar='DIR', action="store", dest="option_products", help='Collect all build products in this directory') op.add_option('', '--output', metavar='DIR', action="store", + default=self.source_dir, dest="build_dir", help='Build in the specified directory') op.add_option('', '--local', action="callback", callback=self.option_local, help='Build directly within the source tree (default)') + self.options = op.get_default_values() + + self.initialize() + def main(self, *args): if args and args[0] in ['default', 'debug', 'opt', 'gcov', 'gprof']: self.current_flavor = args[0] @@ -691,8 +685,6 @@ class PrepareBuild(CommandLineApp): self.configure_args.append('-DUSE_DOXYGEN=1') if self.options.python: self.configure_args.append('-DUSE_PYTHON=1') - if self.options.no_python: - self.configure_args.remove('-DUSE_PYTHON=1') if self.options.use_ninja: self.configure_args.append('-GNinja') @@ -742,7 +734,7 @@ class PrepareBuild(CommandLineApp): def option_local(self, option=None, opt_str=None, value=None, parser=None): self.log.debug('Saw option --local') - self.build_dir = self.source_dir + self.options.build_dir = self.source_dir def option_help(self, option=None, opt_str=None, value=None, parser=None): self.phase_help() @@ -843,7 +835,7 @@ class PrepareBuild(CommandLineApp): try: os.chdir(build_dir) - need_to_config = not isfile('Makefile') + need_to_config = not isfile('rules.ninja' if self.options.use_ninja else 'Makefile') if need_to_config: self.log.debug('Source => ' + self.source_dir) self.log.debug('Build => ' + build_dir) @@ -882,7 +874,7 @@ class PrepareBuild(CommandLineApp): make_args = [] for arg in args: - if arg.startswith('--'): + if arg.startswith('--') or arg.startswith('-D'): config_args.append(arg) else: make_args.append(arg) @@ -947,10 +939,10 @@ class PrepareBuild(CommandLineApp): ######################################################################### def configure_flavor(self, flavor, reset=True): - self.initialize() # reset everything - self.build_dir = None # use the build/ tree + self.initialize() # reset everything self.current_flavor = flavor - self.prefix_dir = None + self.options.build_dir = None # use the build/ tree + self.options.prefix_dir = None if reset and exists(self.build_directory()) and \ isdir(self.build_directory()): @@ -1075,12 +1067,17 @@ typical user: submodule Updates Git submodules (better to use 'pull') version Output current HEAD version to version.m4 -NOTE: If you wish to pass options to configure or make, add "--" followed by -your options. Here are some real-world examples: +NOTE: If you wish to pass options to CMake or make, add "--" followed by +your options. Those starting with "-D" or "--" will be passed on to CMake, +positional arguments and other options will be passed to make. +For the 'config' and 'configure' phase everything will be passed to CMake. + +Here are some real-world examples: ./acprep - ./acprep opt -- make -j3 - ./acprep --enable-doxygen""" + ./acprep --python + ./acprep opt make + ./acprep make doc -- -DBUILD_WEB_DOCS=1""" sys.exit(0) PrepareBuild().run() |