3 # Copyright (C) 2010-2012 CEA/DEN
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # Define all possible option for log command : sat log <options>
22 parser = src.options.Options()
23 parser.add_option('m', 'module', 'list2', 'modules',
24 _('modules to prepare. This option can be'
25 ' passed several time to prepare several modules.'))
26 parser.add_option('', 'no_sample', 'boolean', 'no_sample',
27 _("do not prepare sample modules."))
28 parser.add_option('f', 'force', 'boolean', 'force',
29 _("force to prepare the modules in development mode."))
32 '''method that is called when salomeTools is called with --help option.
34 :return: The text to display for the prepare command description.
37 return _("The prepare command apply the patches on the sources of "
38 "the application modules if there is any")
40 def run(args, runner, logger):
41 '''method that is called when salomeTools is called with prepare parameter.
45 (options, args) = parser.parse_args(args)
47 # check that the command has been called with an application
48 src.check_config_has_application( runner.cfg )
50 # Construct the option to pass to the source command
51 args_source = runner.cfg.VARS.application + ' '
54 args_source += '--module ' + ','.join(options.modules)
57 args_source += ' --no_sample'
60 args_source += ' --force'
62 # Call the source command that gets the source
63 msg = src.printcolors.printcHeader(
64 _('Get the sources of the desired modules\n'))
66 res_source = runner.source(args_source)
68 # Construct the option to pass to the patch command
69 args_patch = args_source.replace(' --force', '')
71 # Call the source command that gets the source
72 msg = src.printcolors.printcHeader(
73 _('\nApply the patches to the sources of the modules\n'))
75 res_patch = runner.patch(args_patch)
77 return res_source + res_patch