def generate(self): sysConf = SYSConf() if self.path and LocalOperation.exist(self.path): Log.fatal(Status["STAT_GPM_CONF_EXIST"]) #key prompt default verify sections = [("name", "project name", self.name or None, VerifyName), ("language", "project language", self.language or None, VerifyName), ("author", "author name", self.author or sysConf.author, None), ("version", "initial version", self.version or 0.1, None), ("email", "author email", self.email or sysConf.email, VerifyEmail), ("description", "project description", self.description or "", None), ("git_url", "git url[[email protected]:name/project.git]", sysConf.git_url or None, None)] for section in sections: while (1): self._content[section[0]] = gets("Input %s" % section[1], section[2]) if section[3] and not self._content[section[0]]: Log.warn(Status["STAT_INPUT_EMPTY"] % section[0]) continue elif section[3] and not VerifyName(self._content[section[0]]): Log.warn(Status["STAT_INPUT_INVALID"] % section[0]) continue else: break pkg_path = os.path.join(LocalOperation.pwd(), self.name) self._path = os.path.join(pkg_path, GPM_YML) self.write(self._path, self._content)
def generate(self): sysConf = SYSConf() if self.path and LocalOperation.exist(self.path): Log.fatal(Status["STAT_GPM_CONF_EXIST"]) #key prompt default verify sections = [("name", "project name", self.name or None, VerifyName), ("language", "project language", self.language or None, VerifyName), ("author", "author name", self.author or sysConf.author, None), ("version", "initial version", self.version or 0.1, None), ("email", "author email", self.email or sysConf.email, VerifyEmail), ("description", "project description", self.description or "", None), ("git_url", "git url[[email protected]:name/project.git]", sysConf.git_url or None, None)] for section in sections: while(1): self._content[section[0]] = gets("Input %s" % section[1], section[2]) if section[3] and not self._content[section[0]]: Log.warn(Status["STAT_INPUT_EMPTY"] % section[0]) continue elif section[3] and not VerifyName(self._content[section[0]]): Log.warn(Status["STAT_INPUT_INVALID"] % section[0]) continue else: break pkg_path = os.path.join(LocalOperation.pwd(), self.name) self._path = os.path.join(pkg_path, GPM_YML) self.write(self._path, self._content)
def _mods(): mods = {} for loader, module_name, is_pkg in pkgutil.walk_packages(__path__): mod = loader.find_module(module_name).load_module(module_name) try: mods[module_name] = mod._MOD except: Log.warn(Status["STAT_LOAD_MOD_ERROR"] % module_name) return mods
def generate(self): #key prompt default verify sections = [("author", "user name", self.author or LocalOperation.get_user(), VerifyName), ("email", "user email", self.email, VerifyEmail), ("git_url", "git url[[email protected]:name]", self.git_url, VerifyGit)] for section in sections: while(1): self._content[section[0]] = gets("Input %s" % section[1], section[2]) if section[3] and not self._content[section[0]]: Log.warn(Status["STAT_INPUT_EMPTY"] % section[0]) continue elif section[3] and not section[3](self._content[section[0]]): Log.warn(Status["STAT_INPUT_INVALID"] % section[0]) continue else: break self.write(self._path, self._content)
def generate(self): #key prompt default verify sections = [("author", "user name", self.author or LocalOperation.get_user(), VerifyName), ("email", "user email", self.email, VerifyEmail), ("git_url", "git url[[email protected]:name]", self.git_url, VerifyGit)] for section in sections: while (1): self._content[section[0]] = gets("Input %s" % section[1], section[2]) if section[3] and not self._content[section[0]]: Log.warn(Status["STAT_INPUT_EMPTY"] % section[0]) continue elif section[3] and not section[3](self._content[section[0]]): Log.warn(Status["STAT_INPUT_INVALID"] % section[0]) continue else: break self.write(self._path, self._content)