<s> import os , sys <EOL> def get_root ( ) : pass <EOL> def get_config_from_root ( ) : pass <EOL> def versions_from_file ( ) : pass <EOL> def versions_from_parentdir ( ) : pass <EOL> def render ( ) : pass <EOL> HANDLERS = { } <EOL> class NotThisMethod ( Exception ) : pass <EOL> class VersioneerBadRootError ( Exception ) : <EOL> """<STR_LIT>""" <EOL> def get_versions ( verbose = False ) : <EOL> """<STR_LIT>""" <EOL> if "<STR_LIT>" in sys . modules : <EOL> del sys . modules [ "<STR_LIT>" ] <EOL> root = get_root ( ) <EOL> cfg = get_config_from_root ( root ) <EOL> assert cfg . VCS is not None , "<STR_LIT>" <EOL> handlers = HANDLERS . get ( cfg . VCS ) <EOL> assert handlers , "<STR_LIT>" % cfg . VCS <EOL> verbose = verbose or cfg . verbose <EOL> assert cfg . versionfile_source is not None , "<STR_LIT>" <EOL> assert cfg . tag_prefix is not None , "<STR_LIT>" <EOL> versionfile_abs = os . path . join ( root , cfg . versionfile_source ) <EOL> get_keywords_f = handlers . get ( "<STR_LIT>" ) <EOL> from_keywords_f = handlers . get ( "<STR_LIT>" ) <EOL> if get_keywords_f and from_keywords_f : <EOL> try : <EOL> keywords = get_keywords_f ( versionfile_abs ) <EOL> ver = from_keywords_f ( keywords , cfg . tag_prefix , verbose ) <EOL> if verbose : <EOL> print ( "<STR_LIT>" % ver ) <EOL> return ver <EOL> except NotThisMethod : <EOL> pass <EOL> try : <EOL> ver = versions_from_file ( versionfile_abs ) <EOL> if verbose : <EOL> print ( "<STR_LIT>" % ( versionfile_abs , ver ) ) <EOL> return ver <EOL> except NotThisMethod : <EOL> pass <EOL> from_vcs_f = handlers . get ( "<STR_LIT>" ) <EOL> if from_vcs_f : <EOL> try : <EOL> pieces = from_vcs_f ( cfg . tag_prefix , root , verbose ) <EOL> ver = render ( pieces , cfg . style ) <EOL> if verbose : <EOL> print ( "<STR_LIT>" % ver ) <EOL> return ver <EOL> except NotThisMethod : <EOL> pass <EOL> try : <EOL> if cfg . parentdir_prefix : <EOL> ver = versions_from_parentdir ( cfg . parentdir_prefix , root , verbose ) <EOL> if verbose : <EOL> print ( "<STR_LIT>" % ver ) <EOL> return ver <EOL> except NotThisMethod : <EOL> pass <EOL> if verbose : <EOL> print ( "<STR_LIT>" ) <EOL> return { "<STR_LIT:version>" : "<STR_LIT>" , "<STR_LIT>" : None , <EOL> "<STR_LIT>" : None , "<STR_LIT:error>" : "<STR_LIT>" } <EOL> def get_version ( ) : <EOL> """<STR_LIT>""" <EOL> return get_versions ( ) [ "<STR_LIT:version>" ] </s>
