5 new revisions:

Revision: 8cc5bce197f4
Author:   Pekka Klärck
Date:     Mon Jan 30 11:35:04 2012
Log: 1) moved cliapp -> utils.application, 2) use relative imports in utils...
http://code.google.com/p/robotframework/source/detail?r=8cc5bce197f4

Revision: dde65d893bdc
Author:   Pekka Klärck
Date:     Mon Jan 30 11:47:05 2012
Log:      fix where DataError is imported
http://code.google.com/p/robotframework/source/detail?r=dde65d893bdc

Revision: d13ff400dff2
Author:   Pekka Klärck
Date:     Mon Jan 30 11:49:14 2012
Log: 1) moved run methods to run module and rebot methods to rebot module, ...
http://code.google.com/p/robotframework/source/detail?r=d13ff400dff2

Revision: 5150b7e7a319
Author:   Pekka Klärck
Date:     Mon Jan 30 11:51:13 2012
Log:      rm not needed properties
http://code.google.com/p/robotframework/source/detail?r=5150b7e7a319

Revision: a6cf2192a90a
Author:   Pekka Klärck
Date:     Mon Jan 30 11:52:37 2012
Log:      Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=a6cf2192a90a

==============================================================================
Revision: 8cc5bce197f4
Author:   Pekka Klärck
Date:     Mon Jan 30 11:35:04 2012
Log: 1) moved cliapp -> utils.application, 2) use relative imports in utils.__init__
http://code.google.com/p/robotframework/source/detail?r=8cc5bce197f4

Added:
 /src/robot/utils/application.py
Deleted:
 /src/robot/cliapp.py
Modified:
 /src/robot/__init__.py
 /src/robot/utils/__init__.py

=======================================
--- /dev/null
+++ /src/robot/utils/application.py     Mon Jan 30 11:35:04 2012
@@ -0,0 +1,87 @@
+#  Copyright 2008-2011 Nokia Siemens Networks Oyj
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+import sys
+
+from robot.errors import (INFO_PRINTED, DATA_ERROR, STOPPED_BY_USER,
+                          FRAMEWORK_ERROR, Information, DataError)
+
+from .argumentparser import ArgumentParser
+from .encoding import encode_output
+from .error import get_error_details
+
+
+class Application(object):
+
+ def __init__(self, usage, name=None, version=None, arg_limits=None, exit=True,
+                 logger=None):
+        self._ap = ArgumentParser(usage, name, version, arg_limits)
+        self._exit = exit
+        if not logger:
+            from robot.output import LOGGER as logger  # Hack
+        self._logger = logger
+        self._logger.register_file_logger()
+        self._logger.info('%s %s' % (self.name, self.version))
+
+    @property
+    def name(self):
+        return self._ap.name
+
+    @property
+    def version(self):
+        return self._ap.version
+
+    def parse_arguments(self, cli_args, check_args=True):
+        try:
+            options, arguments = self._ap.parse_args(cli_args, check_args)
+        except Information, msg:
+            return self._report_info(unicode(msg))
+        except DataError, err:
+            return self._report_error(unicode(err), help=True)
+        else:
+            self._logger.info('Arguments: %s' % ','.join(arguments))
+            return options, arguments
+
+    def execute(self, method, options, arguments):
+        try:
+            rc = method(*arguments, **options)
+        except DataError, err:
+            return self._report_error(unicode(err), help=True)
+        except (KeyboardInterrupt, SystemExit):
+            return self._report_error('Execution stopped by user.',
+                                      rc=STOPPED_BY_USER)
+        except:
+            error, details = get_error_details()
+            return self._report_error('Unexpected error: %s' % error,
+                                      details, rc=FRAMEWORK_ERROR)
+        else:
+            return rc
+
+    def _report_info(self, msg):
+        print encode_output(unicode(msg))
+        return self.exit(INFO_PRINTED)
+
+ def _report_error(self, message, details=None, help=False, rc=DATA_ERROR):
+        if help:
+            message += '\n\nTry --help for usage information.'
+        if details:
+            message += '\n' + details
+        self._logger.error(message)
+        return self.exit(rc)
+
+    def exit(self, rc):
+        self._logger.close()
+        if self._exit:
+            sys.exit(rc)
+        return rc
=======================================
--- /src/robot/cliapp.py        Mon Jan 30 09:26:41 2012
+++ /dev/null
@@ -1,81 +0,0 @@
-#  Copyright 2008-2011 Nokia Siemens Networks Oyj
-#
-#  Licensed under the Apache License, Version 2.0 (the "License");
-#  you may not use this file except in compliance with the License.
-#  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-
-import sys
-
-from robot.output import LOGGER
-from robot import utils
-from robot.errors import (INFO_PRINTED, DATA_ERROR, STOPPED_BY_USER,
-                          FRAMEWORK_ERROR, Information, DataError)
-
-
-class CommandLineApplication(object):
-
- def __init__(self, usage, name=None, version=None, arg_limits=None, exit=True):
-        self._ap = utils.ArgumentParser(usage, name, version, arg_limits)
-        self._exit = exit
-        LOGGER.register_file_logger()
-        LOGGER.info('%s %s' % (self.name, self.version))
-
-    @property
-    def name(self):
-        return self._ap.name
-
-    @property
-    def version(self):
-        return self._ap.version
-
-    def parse_arguments(self, cli_args, check_args=True):
-        try:
-            options, arguments = self._ap.parse_args(cli_args, check_args)
-        except Information, msg:
-            return self._report_info(unicode(msg))
-        except DataError, err:
-            return self._report_error(unicode(err), help=True)
-        else:
-            LOGGER.info('Arguments: %s' % utils.seq2str(arguments))
-            return options, arguments
-
-    def execute(self, method, options, arguments):
-        try:
-            rc = method(*arguments, **options)
-        except DataError, err:
-            return self._report_error(unicode(err), help=True)
-        except (KeyboardInterrupt, SystemExit):
-            return self._report_error('Execution stopped by user.',
-                                      rc=STOPPED_BY_USER)
-        except:
-            error, details = utils.get_error_details()
-            return self._report_error('Unexpected error: %s' % error,
-                                      details, rc=FRAMEWORK_ERROR)
-        else:
-            return rc
-
-    def _report_info(self, msg):
-        print utils.encode_output(unicode(msg))
-        return self.exit(INFO_PRINTED)
-
- def _report_error(self, message, details=None, help=False, rc=DATA_ERROR):
-        if help:
-            message += '\n\nTry --help for usage information.'
-        if details:
-            message += '\n' + details
-        LOGGER.error(message)
-        return self.exit(rc)
-
-    def exit(self, rc):
-        LOGGER.close()
-        if self._exit:
-            sys.exit(rc)
-        return rc
=======================================
--- /src/robot/__init__.py      Mon Jan 30 09:26:41 2012
+++ /src/robot/__init__.py      Mon Jan 30 11:35:04 2012
@@ -27,20 +27,19 @@
 from robot.variables import init_global_variables
 from robot.version import get_version, get_full_version
 from robot import utils
-from robot.cliapp import CommandLineApplication


 __version__ = get_version()


 def run_from_cli(cli_args, usage):
-    app = CommandLineApplication(usage)
+    app = utils.Application(usage)
     opts, args = app.parse_arguments(cli_args)
     rc = app.execute(_run, opts, args)
     app.exit(rc)

 def rebot_from_cli(cli_args, usage):
-    app = CommandLineApplication(usage)
+    app = utils.Application(usage)
     opts, args = app.parse_arguments(cli_args)
     rc = app.execute(_rebot, opts, args)
     app.exit(rc)
@@ -66,7 +65,7 @@
     pybot path/to/tests.html
     pybot --report r.html --log NONE t1.txt t2.txt > stdout.txt
     """
-    app = CommandLineApplication('xxx', exit=False)
+    app = utils.Application('xxx', exit=False)
     rc = app.execute(_run, options, datasources)
     return app.exit(rc)

@@ -112,7 +111,7 @@
     rebot path/to/output.xml
     rebot --report r.html --log NONE o1.xml o2.xml > stdout.txt
     """
-    app = CommandLineApplication('xxx', exit=False)
+    app = utils.Application('xxx', exit=False)
     rc = app.execute(_rebot, options, datasources)
     return app.exit(rc)

=======================================
--- /src/robot/utils/__init__.py        Fri Dec 23 10:42:38 2011
+++ /src/robot/utils/__init__.py        Mon Jan 30 11:35:04 2012
@@ -12,30 +12,31 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.

-from argumentparser import ArgumentParser
-from compress import compress_text
-from connectioncache import ConnectionCache
-from encoding import decode_output, encode_output, decode_from_file_system
-from error import (get_error_message, get_error_details, ErrorDetails,
-                   RERAISED_EXCEPTIONS)
-from escaping import escape, unescape
-from etreewrapper import ET, ETSource
-from htmlutils import html_format, html_escape, html_attr_escape
-from htmlwriter import HtmlWriter
-from importer import Importer
-from match import eq, matches, matches_any, Matcher
-from misc import plural_or_not, printable_name, seq2str, seq2str2, getdoc
-from normalizing import normalize, normalize_tags, NormalizedDict
-from robotpath import normpath, abspath, get_link_path
-from robottime import (get_timestamp, get_start_timestamp, format_time,
-                       get_time, get_elapsed_time, elapsed_time_to_string,
-                       timestr_to_secs, secs_to_timestr, secs_to_timestamp,
-                       timestamp_to_secs, parse_time)
-from setter import setter
-from text import (cut_long_message, format_assign_message,
+from .argumentparser import ArgumentParser
+from .application import Application
+from .compress import compress_text
+from .connectioncache import ConnectionCache
+from .encoding import decode_output, encode_output, decode_from_file_system
+from .error import (get_error_message, get_error_details, ErrorDetails,
+                    RERAISED_EXCEPTIONS)
+from .escaping import escape, unescape
+from .etreewrapper import ET, ETSource
+from .htmlutils import html_format, html_escape, html_attr_escape
+from .htmlwriter import HtmlWriter
+from .importer import Importer
+from .match import eq, matches, matches_any, Matcher
+from .misc import plural_or_not, printable_name, seq2str, seq2str2, getdoc
+from .normalizing import normalize, normalize_tags, NormalizedDict
+from .robotpath import normpath, abspath, get_link_path
+from .robottime import (get_timestamp, get_start_timestamp, format_time,
+                        get_time, get_elapsed_time, elapsed_time_to_string,
+ timestr_to_secs, secs_to_timestr, secs_to_timestamp,
+                        timestamp_to_secs, parse_time)
+from .setter import setter
+from .text import (cut_long_message, format_assign_message,
                   pad_console_length, get_console_length)
-from unic import unic, safe_repr
-from xmlwriter import XmlWriter
+from .unic import unic, safe_repr
+from .xmlwriter import XmlWriter

 import sys
 is_jython = sys.platform.startswith('java')

==============================================================================
Revision: dde65d893bdc
Author:   Pekka Klärck
Date:     Mon Jan 30 11:47:05 2012
Log:      fix where DataError is imported
http://code.google.com/p/robotframework/source/detail?r=dde65d893bdc

Modified:
 /utest/result/test_resultbuilder.py
 /utest/writer/test_write_configuration.py

=======================================
--- /utest/result/test_resultbuilder.py Thu Dec  1 12:40:32 2011
+++ /utest/result/test_resultbuilder.py Mon Jan 30 11:47:05 2012
@@ -3,7 +3,7 @@
 from os.path import join, dirname
 import unittest
 from StringIO import StringIO
-from robot import DataError
+from robot.errors import DataError

 from robot.result import ResultFromXml
 from robot.utils.asserts import assert_equals, assert_true, assert_raises
=======================================
--- /utest/writer/test_write_configuration.py   Tue Jan 24 20:55:20 2012
+++ /utest/writer/test_write_configuration.py   Mon Jan 30 11:47:05 2012
@@ -1,7 +1,7 @@
 import unittest
 import os

-from robot import DataError
+from robot.errors import DataError
 from robot.writer.datafilewriter import WritingContext
 from robot.parsing.model import TestCaseFile
 from robot.utils.asserts import assert_equals, assert_raises

==============================================================================
Revision: d13ff400dff2
Author:   Pekka Klärck
Date:     Mon Jan 30 11:49:14 2012
Log: 1) moved run methods to run module and rebot methods to rebot module, 2) renamed xxx_from_cli -> xxx_cli
http://code.google.com/p/robotframework/source/detail?r=d13ff400dff2

Modified:
 /src/robot/__init__.py
 /src/robot/rebot.py
 /src/robot/run.py

=======================================
--- /src/robot/__init__.py      Mon Jan 30 11:35:04 2012
+++ /src/robot/__init__.py      Mon Jan 30 11:49:14 2012
@@ -15,121 +15,14 @@
 import sys

 if 'pythonpathsetter' not in sys.modules:
-    from robot import pythonpathsetter
+    from robot import pythonpathsetter as _
 if sys.platform.startswith('java'):
-   from robot import jythonworkarounds
-from robot.conf import RobotSettings, RebotSettings
-from robot.errors import (DataError, Information, INFO_PRINTED, DATA_ERROR,
-                          STOPPED_BY_USER, FRAMEWORK_ERROR)
-from robot.reporting import ResultWriter
-from robot.running import TestSuite, STOP_SIGNAL_MONITOR
-from robot.output import Output, LOGGER, pyloggingconf
-from robot.variables import init_global_variables
-from robot.version import get_version, get_full_version
-from robot import utils
-
-
-__version__ = get_version()
-
-
-def run_from_cli(cli_args, usage):
-    app = utils.Application(usage)
-    opts, args = app.parse_arguments(cli_args)
-    rc = app.execute(_run, opts, args)
-    app.exit(rc)
-
-def rebot_from_cli(cli_args, usage):
-    app = utils.Application(usage)
-    opts, args = app.parse_arguments(cli_args)
-    rc = app.execute(_rebot, opts, args)
-    app.exit(rc)
-
-def run(*datasources, **options):
-    """Executes given Robot data sources with given options.
-
- Data sources are paths to files and directories, similarly as when running - pybot/jybot from command line. Options are given as keywords arguments and
-    their names are same as long command line options without hyphens.
-
-    To capture stdout and/or stderr streams, pass open file objects in as
-    keyword arguments `stdout` and `stderr`, respectively.
-
- A return code is returned similarly as when running on the command line.
-
-    Examples:
-    run('path/to/tests.html')
-    with open('stdout.txt', 'w') as stdout:
-        run('t1.txt', 't2.txt', report='r.html', log='NONE', stdout=stdout)
-
-    Equivalent command line usage:
-    pybot path/to/tests.html
-    pybot --report r.html --log NONE t1.txt t2.txt > stdout.txt
-    """
-    app = utils.Application('xxx', exit=False)
-    rc = app.execute(_run, options, datasources)
-    return app.exit(rc)
-
-def _run(*datasources, **options):
-    STOP_SIGNAL_MONITOR.start()
-    settings = RobotSettings(options)
-    pyloggingconf.initialize(settings['LogLevel'])
-    LOGGER.register_console_logger(width=settings['MonitorWidth'],
-                                   colors=settings['MonitorColors'],
-                                   stdout=settings['StdOut'],
-                                   stderr=settings['StdErr'])
-    init_global_variables(settings)
-    suite = TestSuite(datasources, settings)
-    output = Output(settings)
-    suite.run(output)
-    LOGGER.info("Tests execution ended. Statistics:\n%s"
-                % suite.get_stat_message())
-    output.close(suite)
-    if settings.is_rebot_needed():
-        output, settings = settings.get_rebot_datasource_and_settings()
-        ResultWriter(output).write_results(settings)
-    return suite.return_code
-
-
-def rebot(*datasources, **options):
- """Creates reports/logs from given Robot output files with given options.
-
- Given input files are paths to Robot output files similarly as when running
-    rebot from command line. Options are given as keywords arguments and
-    their names are same as long command line options without hyphens.
-
-    To capture stdout and/or stderr streams, pass open file objects in as
-    keyword arguments `stdout` and `stderr`, respectively.
-
- A return code is returned similarly as when running on the command line.
-
-    Examples:
-    rebot('path/to/output.xml')
-    with open('stdout.txt', 'w') as stdout:
- rebot('o1.xml', 'o2.xml', report='r.html', log='NONE', stdout=stdout)
-
-    Equivalent command line usage:
-    rebot path/to/output.xml
-    rebot --report r.html --log NONE o1.xml o2.xml > stdout.txt
-    """
-    app = utils.Application('xxx', exit=False)
-    rc = app.execute(_rebot, options, datasources)
-    return app.exit(rc)
-
-def _rebot(*datasources, **options):
-    settings = RebotSettings(options)
-    LOGGER.register_console_logger(colors=settings['MonitorColors'],
-                                   stdout=settings['StdOut'],
-                                   stderr=settings['StdErr'])
-    LOGGER.disable_message_cache()
-    rc = ResultWriter(*datasources).write_results(settings)
-    if rc < 0:
-        raise DataError('No outputs created.')
-    return rc
-
-
-def _report_error(message, details=None, help=False):
-    if help:
-        message += '\n\nTry --help for usage information.'
-    if details:
-        message += '\n' + details
-    LOGGER.error(message)
+    from robot import jythonworkarounds as _
+
+from robot.rebot import rebot, rebot_cli
+from robot.run import run, run_cli
+from robot.version import get_version
+
+
+__all__ = ['run', 'run_cli', 'rebot', 'rebot_cli']
+__version__ = get_version()
=======================================
--- /src/robot/rebot.py Sun Jan 29 13:32:23 2012
+++ /src/robot/rebot.py Mon Jan 30 11:49:14 2012
@@ -14,7 +14,7 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.

-DOC = """Rebot -- Robot Framework Report and Log Generator
+USAGE = """Rebot -- Robot Framework Report and Log Generator

 Version: <VERSION>

@@ -253,10 +253,58 @@
 if 'robot' not in sys.modules:
     import pythonpathsetter  # running robot/rebot.py as a script

-import robot
+from robot.conf import RebotSettings
+from robot.errors import DataError
+from robot.reporting import ResultWriter
+from robot.output import LOGGER
+from robot.utils import Application
+
+
+def rebot_cli(cli_args):
+    app = Application(USAGE)
+    opts, args = app.parse_arguments(cli_args)
+    rc = app.execute(_rebot, opts, args)
+    app.exit(rc)
+
+
+
+def rebot(*datasources, **options):
+ """Creates reports/logs from given Robot output files with given options.
+
+ Given input files are paths to Robot output files similarly as when running
+    rebot from command line. Options are given as keywords arguments and
+    their names are same as long command line options without hyphens.
+
+    To capture stdout and/or stderr streams, pass open file objects in as
+    keyword arguments `stdout` and `stderr`, respectively.
+
+ A return code is returned similarly as when running on the command line.
+
+    Examples:
+    rebot('path/to/output.xml')
+    with open('stdout.txt', 'w') as stdout:
+ rebot('o1.xml', 'o2.xml', report='r.html', log='NONE', stdout=stdout)
+
+    Equivalent command line usage:
+    rebot path/to/output.xml
+    rebot --report r.html --log NONE o1.xml o2.xml > stdout.txt
+    """
+    app = Application('xxx', exit=False)
+    rc = app.execute(_rebot, options, datasources)
+    return app.exit(rc)
+
+def _rebot(*datasources, **options):
+    settings = RebotSettings(options)
+    LOGGER.register_console_logger(colors=settings['MonitorColors'],
+                                   stdout=settings['StdOut'],
+                                   stderr=settings['StdErr'])
+    LOGGER.disable_message_cache()
+    rc = ResultWriter(*datasources).write_results(settings)
+    if rc < 0:
+        raise DataError('No outputs created.')
+    return rc


 if __name__ == '__main__':
-    # TODO: rebot_from_cli should not need DOC
-    rc = robot.rebot_from_cli(sys.argv[1:], DOC)
-    sys.exit(rc)
+    rebot_cli(sys.argv[1:])
+
=======================================
--- /src/robot/run.py   Sun Jan 29 13:32:23 2012
+++ /src/robot/run.py   Mon Jan 30 11:49:14 2012
@@ -14,7 +14,7 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.

-DOC = """Robot Framework -- A keyword-driven test automation framework
+USAGE = """Robot Framework -- A keyword-driven test automation framework

 Version: <VERSION>

@@ -311,10 +311,68 @@
 if 'robot' not in sys.modules:
     import pythonpathsetter  # running robot/run.py as a script

-import robot
+from robot.conf import RobotSettings
+from robot.output import LOGGER, Output, pyloggingconf
+from robot.reporting import ResultWriter
+from robot.running import TestSuite, STOP_SIGNAL_MONITOR
+from robot.utils import Application
+from robot.variables import init_global_variables
+
+
+
+def run_cli(cli_args):
+    app = Application(USAGE)
+    opts, args = app.parse_arguments(cli_args)
+    rc = app.execute(_run, opts, args)
+    app.exit(rc)
+
+
+def run(*datasources, **options):
+    """Executes given Robot data sources with given options.
+
+ Data sources are paths to files and directories, similarly as when running + pybot/jybot from command line. Options are given as keywords arguments and
+    their names are same as long command line options without hyphens.
+
+    To capture stdout and/or stderr streams, pass open file objects in as
+    keyword arguments `stdout` and `stderr`, respectively.
+
+ A return code is returned similarly as when running on the command line.
+
+    Examples:
+    run('path/to/tests.html')
+    with open('stdout.txt', 'w') as stdout:
+        run('t1.txt', 't2.txt', report='r.html', log='NONE', stdout=stdout)
+
+    Equivalent command line usage:
+    pybot path/to/tests.html
+    pybot --report r.html --log NONE t1.txt t2.txt > stdout.txt
+    """
+    app = Application('xxx', exit=False)
+    rc = app.execute(_run, options, datasources)
+    return app.exit(rc)
+
+def _run(*datasources, **options):
+    STOP_SIGNAL_MONITOR.start()
+    settings = RobotSettings(options)
+    pyloggingconf.initialize(settings['LogLevel'])
+    LOGGER.register_console_logger(width=settings['MonitorWidth'],
+                                   colors=settings['MonitorColors'],
+                                   stdout=settings['StdOut'],
+                                   stderr=settings['StdErr'])
+    init_global_variables(settings)
+    suite = TestSuite(datasources, settings)
+    output = Output(settings)
+    suite.run(output)
+    LOGGER.info("Tests execution ended. Statistics:\n%s"
+    % suite.get_stat_message())
+    output.close(suite)
+    if settings.is_rebot_needed():
+        output, settings = settings.get_rebot_datasource_and_settings()
+        ResultWriter(output).write_results(settings)
+    return suite.return_code


 if __name__ == '__main__':
-    # TODO: run_from_cli should not need DOC
-    rc = robot.run_from_cli(sys.argv[1:], DOC)
-    sys.exit(rc)
+    run_cli(sys.argv[1:])
+

==============================================================================
Revision: 5150b7e7a319
Author:   Pekka Klärck
Date:     Mon Jan 30 11:51:13 2012
Log:      rm not needed properties
http://code.google.com/p/robotframework/source/detail?r=5150b7e7a319

Modified:
 /src/robot/utils/application.py

=======================================
--- /src/robot/utils/application.py     Mon Jan 30 11:35:04 2012
+++ /src/robot/utils/application.py     Mon Jan 30 11:51:13 2012
@@ -32,15 +32,7 @@
             from robot.output import LOGGER as logger  # Hack
         self._logger = logger
         self._logger.register_file_logger()
-        self._logger.info('%s %s' % (self.name, self.version))
-
-    @property
-    def name(self):
-        return self._ap.name
-
-    @property
-    def version(self):
-        return self._ap.version
+        self._logger.info('%s %s' % (self._ap.name, self._ap.version))

     def parse_arguments(self, cli_args, check_args=True):
         try:

==============================================================================
Revision: a6cf2192a90a
Author:   Pekka Klärck
Date:     Mon Jan 30 11:52:37 2012
Log:      Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=a6cf2192a90a

Deleted:
 /src/robot/cliapp.py

=======================================
--- /src/robot/cliapp.py        Mon Jan 30 09:26:41 2012
+++ /dev/null
@@ -1,81 +0,0 @@
-#  Copyright 2008-2011 Nokia Siemens Networks Oyj
-#
-#  Licensed under the Apache License, Version 2.0 (the "License");
-#  you may not use this file except in compliance with the License.
-#  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-
-import sys
-
-from robot.output import LOGGER
-from robot import utils
-from robot.errors import (INFO_PRINTED, DATA_ERROR, STOPPED_BY_USER,
-                          FRAMEWORK_ERROR, Information, DataError)
-
-
-class CommandLineApplication(object):
-
- def __init__(self, usage, name=None, version=None, arg_limits=None, exit=True):
-        self._ap = utils.ArgumentParser(usage, name, version, arg_limits)
-        self._exit = exit
-        LOGGER.register_file_logger()
-        LOGGER.info('%s %s' % (self.name, self.version))
-
-    @property
-    def name(self):
-        return self._ap.name
-
-    @property
-    def version(self):
-        return self._ap.version
-
-    def parse_arguments(self, cli_args, check_args=True):
-        try:
-            options, arguments = self._ap.parse_args(cli_args, check_args)
-        except Information, msg:
-            return self._report_info(unicode(msg))
-        except DataError, err:
-            return self._report_error(unicode(err), help=True)
-        else:
-            LOGGER.info('Arguments: %s' % utils.seq2str(arguments))
-            return options, arguments
-
-    def execute(self, method, options, arguments):
-        try:
-            rc = method(*arguments, **options)
-        except DataError, err:
-            return self._report_error(unicode(err), help=True)
-        except (KeyboardInterrupt, SystemExit):
-            return self._report_error('Execution stopped by user.',
-                                      rc=STOPPED_BY_USER)
-        except:
-            error, details = utils.get_error_details()
-            return self._report_error('Unexpected error: %s' % error,
-                                      details, rc=FRAMEWORK_ERROR)
-        else:
-            return rc
-
-    def _report_info(self, msg):
-        print utils.encode_output(unicode(msg))
-        return self.exit(INFO_PRINTED)
-
- def _report_error(self, message, details=None, help=False, rc=DATA_ERROR):
-        if help:
-            message += '\n\nTry --help for usage information.'
-        if details:
-            message += '\n' + details
-        LOGGER.error(message)
-        return self.exit(rc)
-
-    def exit(self, rc):
-        LOGGER.close()
-        if self._exit:
-            sys.exit(rc)
-        return rc

Reply via email to