def ibuilder_status(status): s = status print "%sibuilder:%s" % (st.yellow, st.white) if not INTERNET_AVAILABLE: print "\tInternet not available, unable to check for remote platform packages" else: sm = site_manager.SiteManager(status) board_dict = sm.get_remote_board_dict() print "\t%sRemote Platform Packages Available:%s" % (st.purple, st.white) for name in board_dict: print "\t\t%s%s%s" % (st.blue, name, st.white) #print "args.name: %s" % args.name ps = PlatformScanner(s) platforms = ps.get_platforms() if len(platforms) == 0: print "\t%sNo Platforms installed!%s" % (st.red, st.white) print "\t\tuse %s'nysa install-platforms'%s to view all available remote platforms" % ( st.blue, st.white) print "\t\tuse %s'nysa install-platforms <platform name>'%s to install a platform" % ( st.green, st.white) else: print "\t%sPlatforms:%s" % (st.purple, st.white) for platform in platforms: print "\t\t%s%s%s" % (st.blue, platform, st.white) p = ps.get_platforms()[platform](status) print "\t\t\tChecking build tool...", if not p.test_build_tools(): print "%s%s%s" % (st.red, "Failed!", st.white) else: print "%s%s%s" % (st.green, "Passed!", st.white) print ""
def nysa_paths(args, status): sm = site_manager.SiteManager(status) verilog_packages = sm.get_local_verilog_package_names() board_packages = sm.get_local_board_names() if args.user: print_user_project_path(sm, args.silent, status) if args.cocotb: print_cocotb_path(sm, args.silent, status) if args.verilog != "nothing": vp = args.verilog if vp is None: vp = verilog_packages elif isinstance(vp, str): vp = [vp] print_verilog_paths(sm, vp, args.silent, status) if args.platform != "nothing": bp = args.platform if bp is None: bp = board_packages elif isinstance(bp, str): bp = [bp] print_platform_paths(sm, bp, args.silent, status) if args.xilinx: print_xilinx_paths(args.silent, status)
def cbuilder_status(status): s = status sm = site_manager.SiteManager(status) verilog_packages = sm.get_local_verilog_package_names() print "%scbuilder:%s" % (st.yellow, st.white) if not INTERNET_AVAILABLE: print "\tInternet not available, unable to check for remote verilog repositories" else: vdict = sm.get_remote_verilog_dict() print "\t%sRemote Verilog Modules Available%s" % (st.purple, st.white) for name in vdict: print "\t\t%s%s%s" % (st.blue, name, st.white) print "\t%sInstalled Verilog Modules%s" % (st.purple, st.white) for vp in verilog_packages: print "\t\t%s%s%s" % (st.blue, vp, st.white) print "" print "\tchecking for iverilog...", result = subprocess.call(["iverilog", "-V"], stdout=subprocess.PIPE) #print "Result: %s" % str(type(result)) if result == 0: print "%sFound!%s" % (st.green, st.white) else: print "%sNot Found!%s" % (st.red, st.white) print "\tchecking for gtkwave...", result = subprocess.call(["gtkwave", "-V"], stdout=subprocess.PIPE) if result == 0: print "%sFound!%s" % (st.green, st.white) else: print "%sNot Found!%s" % (st.red, st.white) print ""
def install(args, status): s = status sm = site_manager.SiteManager(status) names = [] if s: s.Verbose("Args: %s" % str(args)) repo_dict = sm.get_remote_verilog_dict() if args.name == "list": if s: s.Info("Get a list of the remote repositories") print "%sVerilog Repositories:%s" % (sts.purple, sts.white) for vmod in repo_dict: print "\t%s%s%s" % (sts.blue, vmod, sts.white) print "\t\t%sAdded: %s%s" % ( sts.green, repo_dict[vmod]["timestamp"], sts.white) print "\t\t%sRepo: %s%s" % ( sts.green, repo_dict[vmod]["repository"], sts.white) sys.exit(0) if args.name == "all": if s: s.Info("Install all repositories") names = repo_dict.keys() else: names = [args.name] #print "%sInstalling repositories:%s " % (sts.purple, sts.white), #sm.install_verilog_module(names) for name in names: print "%sInstalling Reposity: %s%s" % (sts.purple, name, sts.white) sm.install_verilog_module(name)
def install(args, status): s = status sm = site_manager.SiteManager(status) names = [] if s: s.Verbose("Args: %s" % str(args)) user_path = None try: user_path = sm.get_nysa_user_base_directory() except SiteManagerError as ex: print "%sError: %s%s" % (sts.red, str(ex), sts.white) sys.exit(-1) ex_dict = sm.get_remote_example_dict() if args.name == "list": if s: s.Info("Get a list of the remote examples") print "%sExample packages:%s" % (sts.purple, sts.white) for name in ex_dict: print "\t%s%s%s" % (sts.blue, name, sts.white) print "\t\t%sAdded: %s%s" % (sts.green, ex_dict[name]["timestamp"], sts.white) print "\t\t%sRepo: %s%s" % (sts.green, ex_dict[name]["repository"], sts.white) sys.exit(0) if args.name == "all": if s: s.Info("Install all platforms") names = ex_dict.keys() else: names = [args.name] print "%sInstalling platforms examples%s " % (sts.purple, sts.white) for name in names: dest = os.path.join(user_path, "examples", name) print "%s\tInstalling %s to: %s%s" % (sts.blue, name, dest, sts.white) sm.install_examples(name, dest)
def get_platform_path(name): sm = site_manager.SiteManager() return sm.get_board_directory(name)
def get_verilog_path(name): sm = site_manager.SiteManager() return sm.get_local_verilog_package_path(name)
def init(args, status): s = status #base_path = site_manager.DEFAULT_USER_BASE base_path = utils.get_user_project_dir() sm = site_manager.SiteManager(status) paths_dict = sm.get_paths_dict() #Check if the base that is in the paths dictionary exists or the user is forcing a new dictionary if (not os.path.exists(paths_dict["nysa_user_base"])) or args.force or args.reset: if s: s.Important("User base directory doesn't exists or a force or reset is detected") #base_path = paths_dict["nysa_user_base"] #base_path = site_manager.DEFAULT_USER_BASE base_path = utils.get_user_project_dir() #This is uniitializes nysa base if args.output is not None: base_path = os.path.expanduser(args.output[0]) paths_dict["nysa_user_base"] = base_path elif args.output is not None: if args.output[0] != paths_dict["nysa_user_base"]: if s: s.Error("Specifying an output directory when one already exists!, use -F or -R to force a new directory") sys.exit(-1) paths_dict["nysa_user_base"] = base_path if s: s.Debug("Paths dict:\n%s" % json.dumps(paths_dict, sort_keys = True, indent = 2, separators=(",", ": "))) #Check to see if the final directory has been generated #Verilog Path #vpath = os.path.join(base_path, utils.USER_BASE_VERILOG_DIR) vpath = utils.get_user_verilog_dir() #Examples Path #epath = os.path.join(base_path, utils.USER_BASE_EXAMPLES_DIR) epath = utils.get_user_examples_dir() #Dev Path #dev_path = os.path.join(base_path, utils.USER_BASE_DEV_DIR) dev_path = utils.get_user_dev_dir() #Apps Path #app_path = os.path.join(base_path, utils.USER_BASE_APPS_DIR) app_path = utils.get_user_app_dir() #Ibuilder projects #user_ibuilder_path = os.path.join(base_path, utils.USER_BASE_IBUILDER_DIR) user_ibuilder_path = utils.get_user_ibuilder_project_dir() #Cbuilder projects #user_cbuilder_path = os.path.join(base_path, utils.USER_BASE_CBUILDER_DIR) user_cbuilder_path = utils.get_user_cbuilder_project_dir() if not os.path.exists(base_path): if s: s.Important("Generating nysa base directory") os.makedirs(base_path) if not os.path.exists(vpath): #Make the verilog directory if s: s.Important("Generating verilog directory") vpath = os.path.join(base_path, "verilog") os.makedirs(vpath) if not os.path.exists(epath): #Make the examples directory if s: s.Important("Generating examples directory") epath = os.path.join(base_path, "examples") os.makedirs(epath) if not os.path.exists(dev_path): #make the dev directory if s: s.Important("Generating dev directory") dev_path = os.path.join(base_path, "dev") os.makedirs(dev_path) if not os.path.exists(app_path): #Make the application directory if s: s.Important("Generating apps directory") app_path = os.path.join(base_path, "apps") os.makedirs(app_path) if not os.path.exists(user_ibuilder_path): #Make the user ibuilder project directory if s: s.Important("Generating user ibuilder directory") os.makedirs(user_ibuilder_path) if not os.path.exists(user_cbuilder_path): #Make the user cbuilder probject directory if s: s.Important("Generating user cbuilder directory") os.makedirs(user_cbuilder_path) #Adding Default Verilog Packages sm.install_verilog_module() #Adding Default boards sm.install_remote_board_package() sm.install_cocotb()
def setUp(self): self.sm = site_manager.SiteManager()