""" 
    core.version
"""
import commands
import ConfigParser
import os


def get_version_base__release_type__provides():
    """
        get_version_base ... get version string base from the setup.cfg
    """
    config = ConfigParser.ConfigParser()
    config.read(os.path.dirname(os.path.realpath(__file__)) + '/setup.cfg')
    version_base = config.get("global", "version")
    release_type = config.get("global", "release_type")
    provides = config.get("bdist_rpm", "provides")
    return (version_base, release_type, provides,)


def get_svn_version():
    """
        get version of this svn commit
    """
    dir = os.path.dirname(os.path.realpath(__file__))
    ### get last revision ID, short version
    last_rev_id = ''
    try:
        last_rev_id = commands.getoutput(' svnversion core/ ')
    except:
        pass
    return str('.dev-r' + last_rev_id)


def get_version_provides():
#    __version__ = get_svn_version()
#    __provides__ = get_version_base__release_type__provides()
#    return (__version__, __provides__,)
    isStable = False
    version_base, release_type, provides = get_version_base__release_type__provides()
    if release_type == 'stable':
        isStable = True
    __version__ = version_base
    if not isStable:
        __version__ += get_svn_version()
    __provides__ = provides
    return (__version__, __provides__,)


__version__, __provides__ = get_version_provides()



@@ -6,20 +6,21 @@
     
-core
+atlas
 .version
 %0A%22%22%22
@@ -15,16 +15,17 @@
 .version
+ 
 %0A%22%22%22%0Aimp
@@ -537,27 +537,27 @@
 )%0A%0A%0Adef get_
-svn
+git
 _version():%0A
@@ -592,19 +592,19 @@
 of this 
-svn
+git
  commit%0A
@@ -677,332 +677,697 @@
 ### 
-get last revision ID, short version%0A    last_rev_id = ''%0A    try:%0A        last_rev_id = commands.getoutput(' svnversion core/ ')%0A    except:%0A        pass%0A    return str('.dev-r' + last_rev_id)%0A%0A%0Adef get_version_provides():%0A#    __version__ = get_svn_version()%0A#    __provides__ = get_version_base__release_type__provides(
+count cap of total number of commits in this repository%0A    ncommits = 1%0A    try:%0A        ncommits = commands.getoutput('git shortlog %7C wc -l')%0A    except:%0A        pass%0A    ### get last revision ID, short version%0A    last_rev_id = ''%0A    try:%0A        last_rev_id = commands.getoutput('git show -s --pretty=format:%25h ')%0A    except:%0A        pass%0A    ### get number of revisions on this branch%0A    nrevs = 1%0A    try:%0A        nrevs = commands.getoutput('git reflog %7C wc -l')%0A    except:%0A        pass%0A    if ncommits %3C 19000:%0A        retstr = str('.dev-' + ncommits + '-' + last_rev_id + '-' + nrevs)%0A    else:%0A        retstr = str('.dev-' + nrevs + '-' + last_rev_id + '-' + ncommits + nrevs
 )%0A
-#
     
@@ -1365,34 +1365,48 @@
 evs)%0A    return 
-(_
+retstr%0A%0A%0Adef get
 _version__, __pr
@@ -1394,37 +1394,32 @@
 get_version_
-_, __
 provides
 __,)%0A    isS
@@ -1406,20 +1406,19 @@
 provides
-__,)
+():
 %0A    isS
@@ -1657,11 +1657,11 @@
 get_
-svn
+git
 _ver
@@ -1737,16 +1737,17 @@
 s__,)%0A%0A%0A
+%0A
 __versio
@@ -1787,12 +1787,13 @@
 rovides()%0A%0A%0A
+%0A

Version string fixing.