def version_keyword(dist, attr, value):
if value == "<STR_LIT>":<EOL><INDENT>from pbr.util import setup_cfg_to_setup_kwargs<EOL>path = "<STR_LIT>"<EOL>parser = ConfigParser()<EOL>if not os.path.exists(path):<EOL><INDENT>raise ValueError("<STR_LIT>" % os.path.abspath(path))<EOL><DEDENT>parser.read(path)<EOL>config = {}<EOL>for section in parser.sections():<EOL><INDENT>config[section] = dict(parser.items(section))<EOL><DEDENT>attrs = setup_cfg_to_setup_kwargs(config)<EOL>version = str(Version(attrs["<STR_LIT:name>"]))<EOL>os.environ["<STR_LIT>"] = version<EOL><DEDENT>else:<EOL><INDENT>version = str(Version(dist.metadata.get_name()))<EOL><DEDENT>dist.metadata.version = version<EOL>
Implements the actual version setup() keyword.