anyvc / setup.py

#!/usr/bin/python
from __future__ import with_statement
import os, sys
from commands import getoutput
from distutils.core import setup
import time

def read_readme():
    with open('docs/source/readme.rst') as f:
        return f.read()

#XXX: anyvc should do that itself
def getversion():
    if not os.path.exists('.hg'):
        return None # not in a repository
    try:
        l = getoutput('hg id -it').split()
    except OSError, e:
        print "warning: could not establish Mercurial version: %s" % e
        return

    while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags
        l.pop()
    if l:
        version = l[-1] # latest tag or revision number
        if version.endswith('+'):
            version += time.strftime('%Y%m%d')
        return version

version = getversion()
if version:
    f = file("anyvc/__version__.py", "w")
    f.write('# this file is autogenerated by setup.py\n')
    f.write('version = "%s"\n' % version)
    f.close()
else:
    version = "unknown"


setup(
    version = version,
    name = 'anyvc',
    packages = [
        'anyvc',
        'anyvc.repository',
        'anyvc.workdir',
    ],
    scripts = ['bin/vc'],

    description='Library to access any version control system.',
    license='GNU LGPL2 (or later) as published by the FSF',
    url='http://www.bitbucket.org/RonnyPfannschmidt/anyvc/',
    author='Ronny Pfannschmidt',
    author_email='Ronny.Pfannschmidt@gmx.de',
    long_description=read_readme(),
    classifiers = [
        'Intended Audience :: Developers',
    ],
)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.