def do_init(self):

        log.i(TAG, "Project initialization started.")

        signal.signal(signal.SIGINT, self.do_shutdown)

        if os.path.isfile(utils.CONFIG_FILE_NAME):
            log.e(TAG, "Configuration file already exists!")
            return -1

        raw_input("\nPlease connect the test device (press Enter to continue) ")

        # This might get in the way.
        try:
            del os.environ['ANDROID_SERIAL']
        except KeyError:
            pass

        self.adb = DtfAdb.DtfAdb(no_serial=True)

        log.i(TAG, "Restarting adb...")
        self.adb.kill_server()
        self.adb.start_server()

        log.i(TAG, "Waiting for a device to be connected...")

        time.sleep(1)

        devices = self.get_devices()

        if len(devices) == 0:
            log.e(TAG, "No devices found, exiting.")
            return -2

        elif len(devices) == 1:
            serial = devices[0]
            res = raw_input("Got serial '%s', is this correct? [Y/n] "
                                % serial)
            if res.lower() == 'n':
                log.e(TAG, "Initialization aborted.")
                return -3
        else:
            print "Found many devices. Please select from the following list:"

            i = 1
            for device in devices:
                print "#%d. %s" % (i, device)
                i += 1

            res = raw_input("\nWhich device #? ")

            try:
                int_res = int(res)
                serial = devices[int_res - 1]
            except (ValueError, IndexError):
                log.e(TAG, "Invalid input!")
                return -4

        if self.initialize_device(serial) != 0:
            log.e(TAG, "Error initializing device!")
            return -5
        else:
            log.i(TAG, "Device initialization complete!")
            return 0
Regression test for a bug that occurred when a bundle
dataset/ETHPy150Open jakev/dtf/src/dtf/core/cmds/init.py/init.do_init--crossover with--dataset/ETHPy150Open miracle2k/webassets/tests/test_bundle_build.py/TestBuildVarious.test_rebuild