예제 #1
0
파일: __init__.py 프로젝트: Patater/htrun
    def __init__(self, options=None):
        """! ctor
        """
        self.options = options

        # Handle extra command from
        if options:

            if options.enum_host_tests:
                path = self.options.enum_host_tests
                enum_host_tests(path, verbose=options.verbose)

            if options.list_reg_hts:    # --list option
                self.print_ht_list()
                sys.exit(0)

            if options.list_plugins:    # --plugins option
                host_tests_plugins.print_plugin_info()
                sys.exit(0)

            if options.version:         # --version
                import pkg_resources    # part of setuptools
                version = pkg_resources.require("mbed-host-tests")[0].version
                print version
                sys.exit(0)

            if options.send_break_cmd:  # -b with -p PORT (and optional -r RESET_TYPE)
                self.handle_send_break_cmd(port=options.port,
                    disk=options.disk,
                    reset_type=options.forced_reset_type,
                    verbose=options.verbose)
                sys.exit(0)

        DefaultTestSelectorBase.__init__(self, options)
예제 #2
0
파일: mbedflsh.py 프로젝트: u-blox/htrun
def main():
    """! Function wrapping flashing (copy) plugin
    @details USers can use mbedflsh command to flash mbeds from command line
    """
    errorlevel_flag = 0
    (opts, args) = cmd_parser_setup()

    if opts.version:
        import pkg_resources  # part of setuptools
        version = pkg_resources.require("mbed-host-tests")[0].version
        print version
        sys.exit(0)
    elif opts.list_plugins:    # --plugins option
        host_tests_plugins.print_plugin_info()
        sys.exit(0)
    else:
        pass

    if opts.filename:
        print "mbedflsh: opening file %s..."% opts.filename
        result = host_tests_plugins.call_plugin('CopyMethod',
            opts.copy_method,
            image_path=opts.filename,
            destination_disk=opts.disk)
        errorlevel_flag = result == True

    return errorlevel_flag
예제 #3
0
    def __init__(self, options):
        """! ctor
        """
        self.options = options

        # Handle extra command from
        if options:
            if options.enum_host_tests:
                path = self.options.enum_host_tests
                enum_host_tests(path, verbose=options.verbose)

            if options.list_reg_hts:  # --list option
                self.print_ht_list()
                sys.exit(0)

            if options.list_plugins:  # --plugins option
                host_tests_plugins.print_plugin_info()
                sys.exit(0)

            if options.version:  # --version
                import pkg_resources  # part of setuptools
                version = pkg_resources.require("mbed-host-tests")[0].version
                print version
                sys.exit(0)

            if options.send_break_cmd:  # -b with -p PORT (and optional -r RESET_TYPE)
                self.handle_send_break_cmd(
                    port=options.port,
                    disk=options.disk,
                    reset_type=options.forced_reset_type,
                    verbose=options.verbose)
                sys.exit(0)

        DefaultTestSelectorBase.__init__(self, options)
예제 #4
0
파일: __init__.py 프로젝트: iriark01/htrun
    def __init__(self, options=None):
        """! ctor
        """
        self.options = options

        # Handle extra command from
        if options:
            if options.list_reg_hts:    # --list option
                self.print_ht_list()
                sys.exit(0)

            if options.list_plugins:    # --plugins option
                host_tests_plugins.print_plugin_info()
                sys.exit(0)

            if options.version:         # --version
                import pkg_resources  # part of setuptools
                version = pkg_resources.require("mbed-host-tests")[0].version
                print version
                sys.exit(0)

        DefaultTestSelectorBase.__init__(self, options)
예제 #5
0
    def __init__(self, options):
        """! ctor
        """
        self.options = options

        # Handle extra command from
        if options:
            if options.enum_host_tests:
                path = self.options.enum_host_tests
                enum_host_tests(path, verbose=options.verbose)

            if options.list_reg_hts:    # --list option
                self.print_ht_list()
                sys.exit(0)

            if options.list_plugins:    # --plugins option
                host_tests_plugins.print_plugin_info()
                sys.exit(0)

            if options.version:         # --version
                import pkg_resources    # part of setuptools
                version = pkg_resources.require("mbed-host-tests")[0].version
                print version
                sys.exit(0)

            if options.send_break_cmd:  # -b with -p PORT (and optional -r RESET_TYPE)
                self.handle_send_break_cmd(port=options.port,
                    disk=options.disk,
                    reset_type=options.forced_reset_type,
                    verbose=options.verbose)
                sys.exit(0)

        DefaultTestSelectorBase.__init__(self, options)

        # Following flag is to indicate to this selector that parent process wants it to abort.
        # It would to set by self.abort() by parent_monitor_thread() thread in mbedhtrun.py.
        # Since this selector does not employ a loop and immediate exit is not necessary we don't need locking around it
        self.aborted = False