def _guildfile(path): from guild import guildfile try: return guildfile.for_file(path) except guildfile.GuildfileError as e: cli.error(str(e))
def _try_acc_modeldefs(path, acc): try: models = guildfile.for_file(path) except Exception as e: log.error("unable to load models from %s: %s", path, e) else: for modeldef in models.models.values(): acc.append(modeldef)
def _load_pkgdef(): path = os.environ["PACKAGE_FILE"] try: gf = guildfile.for_file(path) except (IOError, guildfile.GuildfileError) as e: _exit("error reading %s\n%s" % (path, e)) else: if not gf.package: return _default_pkgdef(gf) else: return gf.package
def _check_upload_config(package_file): gf = guildfile.for_file(package_file) if not gf.package.author_email: cli.error( "missing package author-email in %s - cannot upload\n" "Specify a valid email for package.author-email and try again." % package_file) if not _valid_email(gf.package.author_email): cli.error( "invalid package author-email %r in %s - cannot upload\n" "Specify a valid email for package.author-email and try again." % (gf.package.author_email, package_file))