def render_versions(conf=None): if is_processed('versions', conf): return conf else: conf = lazy_conf(conf) version_config_file = os.path.join(conf.paths.builddata, 'published_branches.yaml') if conf.git.branches.current == 'master'and not os.path.exists(version_config_file): return conf try: vconf_data = get_file_from_branch(version_config_file, 'master') except CommandError: setup_config_remote('master', conf) vconf_data = get_file_from_branch(version_config_file, 'master') except CommandError: return conf vconf = AttributeDict(yaml.load(vconf_data)) conf.version.update(vconf.version) conf.git.branches.update(vconf.git.branches) conf.system.processed.versions = True return conf
def render_versions(conf=None): if is_processed('versions', conf): return conf else: conf = lazy_conf(conf) version_config_file = os.path.join(conf.paths.builddata, 'published_branches.yaml') if conf.git.branches.current == 'master' and not os.path.exists( version_config_file): return conf try: vconf_data = get_file_from_branch(version_config_file, 'master') except CommandError: setup_config_remote('master', conf) vconf_data = get_file_from_branch(version_config_file, 'master') except CommandError: return conf vconf = AttributeDict(yaml.load(vconf_data)) conf.version.update(vconf.version) conf.git.branches.update(vconf.git.branches) conf.system.processed.versions = True return conf
def render_versions(conf=None): if is_processed('versions', conf): return conf else: conf = lazy_conf(conf) if 'branches' not in conf.git: conf.git.branches = AttributeDict() version_config_file = os.path.join(conf.paths.builddata, 'published_branches.yaml') try: vconf_data = get_file_from_branch(version_config_file, 'master') except CommandError: if get_branch() == 'master': return conf remotes = command('git remote', capture=True).out.split('\n') if 'origin' in remotes: return conf if 'config-upstream' not in remotes: command('git remote add config-upstream git://github.com/{0}.git'.format(conf.git.remote.upstream)) command('git fetch config-upstream') if 'master' not in command('git branch', capture=True).out.split('\n'): command('git branch master config-upstream/master') vconf_data = get_file_from_branch(version_config_file, 'master') except CommandError: return conf vconf = AttributeDict(yaml.load(vconf_data)) conf.version.update(vconf.version) conf.git.branches.update(vconf.git.branches) conf.system.processed.versions = True return conf