| 1 |
try: |
| 2 |
from setuptools import setup, find_packages |
| 3 |
except ImportError: |
| 4 |
from ez_setup import use_setuptools |
| 5 |
use_setuptools() |
| 6 |
from setuptools import setup, find_packages |
| 7 |
|
| 8 |
from distutils.command.build_py import build_py as _build_py |
| 9 |
from setuptools.command.sdist import sdist as _sdist |
| 10 |
import os |
| 11 |
from os import path |
| 12 |
|
| 13 |
v = open(path.join(path.dirname(__file__), 'VERSION')) |
| 14 |
VERSION = v.readline().strip() |
| 15 |
v.close() |
| 16 |
|
| 17 |
class build_py(_build_py): |
| 18 |
def run(self): |
| 19 |
init = path.join(self.build_lib, 'git', '__init__.py') |
| 20 |
if path.exists(init): |
| 21 |
os.unlink(init) |
| 22 |
_build_py.run(self) |
| 23 |
_stamp_version(init) |
| 24 |
self.byte_compile([init]) |
| 25 |
|
| 26 |
class sdist(_sdist): |
| 27 |
def make_release_tree (self, base_dir, files): |
| 28 |
_sdist.make_release_tree(self, base_dir, files) |
| 29 |
orig = path.join('lib', 'git', '__init__.py') |
| 30 |
assert path.exists(orig) |
| 31 |
dest = path.join(base_dir, orig) |
| 32 |
if hasattr(os, 'link') and path.exists(dest): |
| 33 |
os.unlink(dest) |
| 34 |
self.copy_file(orig, dest) |
| 35 |
_stamp_version(dest) |
| 36 |
|
| 37 |
def _stamp_version(filename): |
| 38 |
found, out = False, [] |
| 39 |
f = open(filename, 'r') |
| 40 |
for line in f: |
| 41 |
if '__version__ =' in line: |
| 42 |
line = line.replace("'git'", "'%s'" % VERSION) |
| 43 |
found = True |
| 44 |
out.append(line) |
| 45 |
f.close() |
| 46 |
|
| 47 |
if found: |
| 48 |
f = open(filename, 'w') |
| 49 |
f.writelines(out) |
| 50 |
f.close() |
| 51 |
|
| 52 |
|
| 53 |
setup(name = "GitPython", |
| 54 |
cmdclass={'build_py': build_py, 'sdist': sdist}, |
| 55 |
version = VERSION, |
| 56 |
description = "Python Git Library", |
| 57 |
author = "Michael Trier", |
| 58 |
author_email = "mtrier@gmail.com", |
| 59 |
url = "http://gitorious.org/projects/git-python/", |
| 60 |
packages = find_packages('lib'), |
| 61 |
package_dir = {'':'lib'}, |
| 62 |
license = "BSD License", |
| 63 |
long_description = """\ |
| 64 |
GitPython is a python library used to interact with Git repositories. |
| 65 |
|
| 66 |
GitPython provides object model access to your git repository. Once you have |
| 67 |
created a repository object, you can traverse it to find parent commit(s), |
| 68 |
trees, blobs, etc. |
| 69 |
|
| 70 |
GitPython is a port of the grit library in Ruby created by |
| 71 |
Tom Preston-Werner and Chris Wanstrath. |
| 72 |
""", |
| 73 |
classifiers = [ |
| 74 |
"Development Status :: 3 - Alpha", |
| 75 |
"Intended Audience :: Developers", |
| 76 |
"License :: OSI Approved :: BSD License", |
| 77 |
"Operating System :: OS Independent", |
| 78 |
"Programming Language :: Python", |
| 79 |
"Programming Language :: Python :: 2.5", |
| 80 |
"Programming Language :: Python :: 2.6", |
| 81 |
"Topic :: Software Development :: Libraries :: Python Modules", |
| 82 |
] |
| 83 |
) |