def do_run(self, args, user_args): # manifest.path is not supposed to be set during init, thus clear it # for the session and update it to correct location when complete. if config.get('manifest', 'path', fallback=None) is not None: config.remove_option('manifest', 'path') manifest_file = os.path.join(args.local or args.cache, 'west.yml') projects = Manifest.from_file(manifest_file).projects manifest_project = projects[MANIFEST_PROJECT_INDEX] if args.local is not None: rel_manifest = os.path.relpath(args.local, util.west_topdir()) update_config('manifest', 'path', rel_manifest) else: if manifest_project.path == '': url_path = urlparse(args.manifest_url).path manifest_project.path = posixpath.basename(url_path) manifest_project.abspath = os.path.realpath( os.path.join(util.west_topdir(), manifest_project.path)) manifest_project.name = manifest_project.path shutil.move(args.cache, manifest_project.abspath) update_config('manifest', 'path', manifest_project.path) for project in projects: if project.path == 'zephyr': update_config('zephyr', 'base', project.path)
def do_run(self, args, ignored): if self.topdir: zb = os.environ.get('ZEPHYR_BASE') if zb: msg = textwrap.dedent(''' Note: In your environment, ZEPHYR_BASE is set to: {} This forces west to search for an installation there. Try unsetting ZEPHYR_BASE and re-running this command.'''. format(zb)) else: msg = '' log.die('already initialized in {}, aborting.{}'.format( self.topdir, msg)) if args.local and (args.manifest_url or args.manifest_rev): log.die('-l cannot be combined with -m or --mr') if shutil.which('git') is None: log.die("can't find git; install it or ensure it's on your PATH") # west.manifest will try to read manifest.path and use it when # parsing the manifest. Clear it out for now so we can parse # the manifest without it; local() or bootstrap() will set it # properly. if config.get('manifest', 'path', fallback=None) is not None: config.remove_option('manifest', 'path') if args.local: projects, manifest_dir = self.local(args) else: projects, manifest_dir = self.bootstrap(args) self.fixup_zephyr_base(projects) log.banner('Initialized. Now run "west update" inside {}.'.format( self.topdir))
def do_run(self, args, ignored): if self.topdir: log.die('already in an installation ({}), aborting'. format(self.topdir)) if shutil.which('git') is None: log.die("can't find git; install it or ensure it's on your PATH") # west.manifest will try to read manifest.path and use it when # parsing the manifest. Clear it out for now so we can parse # the manifest without it; local() or bootstrap() will set it # properly. if config.get('manifest', 'path', fallback=None) is not None: config.remove_option('manifest', 'path') if args.local: projects, manifest_dir = self.local(args) else: projects, manifest_dir = self.bootstrap(args) self.fixup_zephyr_base(projects) _banner('Initialized. Now run "west update" inside {}.'. format(self.topdir))