def __init__(self, args): folder = abspath(expanduser(args.skill_folder)) self.entry = SkillEntry.from_folder(folder) skills_dir = abspath(expanduser(self.msm.skills_dir)) if join(skills_dir, basename(folder)) != folder: raise MskException('Skill folder, {}, not directly within skills directory, {}.'.format( args.skill_folder, self.msm.skills_dir ))
def build_global_id(directory, config): """ Create global id for the skill. TODO: Handle dirty skill Arguments: directory: skill directory config: config for the device to fetch msm setup """ # Update the msm object if it's more than an hour old global msm global msm_creation_time if msm is None or time.time() - msm_creation_time > 60 * 60: msm_creation_time = time.time() msm = create_msm(config) s = SkillEntry.from_folder(directory, msm) # If modified prepend the device uuid return s.skill_gid, s.meta_info.get('display_name')
def test_from_folder(self): entry = SkillEntry.from_folder('test/folder') assert entry.name == 'folder' assert entry.url == ''