| 28a33ca by Sebastian Thiel at 2010-07-01 |
1 |
#!/usr/bin/env python |
| 3942cdf by Christos Trochalakis at 2008-12-15 |
2 |
try: |
| 83a9e4a by Sebastian Thiel at 2010-11-21 |
3 |
from setuptools import setup, find_packages |
| 3942cdf by Christos Trochalakis at 2008-12-15 |
4 |
except ImportError: |
| 83a9e4a by Sebastian Thiel at 2010-11-21 |
5 |
from ez_setup import use_setuptools |
|
6 |
use_setuptools() |
|
7 |
from setuptools import setup, find_packages |
| 3942cdf by Christos Trochalakis at 2008-12-15 |
8 |
|
| 33ebe7a by Michael Trier at 2008-05-07 |
9 |
from distutils.command.build_py import build_py as _build_py |
|
10 |
from setuptools.command.sdist import sdist as _sdist |
|
11 |
import os |
| 9004e3a by Sebastian Thiel at 2010-11-25 |
12 |
import sys |
| 33ebe7a by Michael Trier at 2008-05-07 |
13 |
from os import path |
|
14 |
|
|
15 |
v = open(path.join(path.dirname(__file__), 'VERSION')) |
|
16 |
VERSION = v.readline().strip() |
|
17 |
v.close() |
|
18 |
|
| 83a9e4a by Sebastian Thiel at 2010-11-21 |
19 |
|
| 33ebe7a by Michael Trier at 2008-05-07 |
20 |
class build_py(_build_py): |
| 83a9e4a by Sebastian Thiel at 2010-11-21 |
21 |
def run(self): |
|
22 |
init = path.join(self.build_lib, 'git', '__init__.py') |
|
23 |
if path.exists(init): |
|
24 |
os.unlink(init) |
|
25 |
_build_py.run(self) |
|
26 |
_stamp_version(init) |
|
27 |
self.byte_compile([init]) |
|
28 |
|
| 33ebe7a by Michael Trier at 2008-05-07 |
29 |
|
|
30 |
class sdist(_sdist): |
| 83a9e4a by Sebastian Thiel at 2010-11-21 |
31 |
def make_release_tree (self, base_dir, files): |
|
32 |
_sdist.make_release_tree(self, base_dir, files) |
| 0cfe75d by Sebastian Thiel at 2010-11-25 |
33 |
orig = path.join('git', '__init__.py') |
|
34 |
assert path.exists(orig), orig |
| 83a9e4a by Sebastian Thiel at 2010-11-21 |
35 |
dest = path.join(base_dir, orig) |
|
36 |
if hasattr(os, 'link') and path.exists(dest): |
|
37 |
os.unlink(dest) |
|
38 |
self.copy_file(orig, dest) |
|
39 |
_stamp_version(dest) |
|
40 |
|
| 33ebe7a by Michael Trier at 2008-05-07 |
41 |
|
|
42 |
def _stamp_version(filename): |
| 5eb7fd3 by Sebastian Thiel at 2011-01-17 |
43 |
found, out = False, list() |
| 9004e3a by Sebastian Thiel at 2010-11-25 |
44 |
try: |
|
45 |
f = open(filename, 'r') |
|
46 |
except (IOError, OSError): |
|
47 |
print >> sys.stderr, "Couldn't find file %s to stamp version" % filename |
|
48 |
return |
|
49 |
#END handle error, usually happens during binary builds |
| 83a9e4a by Sebastian Thiel at 2010-11-21 |
50 |
for line in f: |
|
51 |
if '__version__ =' in line: |
|
52 |
line = line.replace("'git'", "'%s'" % VERSION) |
|
53 |
found = True |
|
54 |
out.append(line) |
|
55 |
f.close() |
| 33ebe7a by Michael Trier at 2008-05-07 |
56 |
|
| 83a9e4a by Sebastian Thiel at 2010-11-21 |
57 |
if found: |
|
58 |
f = open(filename, 'w') |
|
59 |
f.writelines(out) |
|
60 |
f.close() |
|
61 |
else: |
|
62 |
print >> sys.stderr, "WARNING: Couldn't find version line in file %s" % filename |
| 33ebe7a by Michael Trier at 2008-05-07 |
63 |
|
|
64 |
setup(name = "GitPython", |
| 83a9e4a by Sebastian Thiel at 2010-11-21 |
65 |
cmdclass={'build_py': build_py, 'sdist': sdist}, |
|
66 |
version = VERSION, |
|
67 |
description = "Python Git Library", |
|
68 |
author = "Sebastian Thiel, Michael Trier", |
|
69 |
author_email = "byronimo@gmail.com, mtrier@gmail.com", |
|
70 |
url = "http://gitorious.org/projects/git-python/", |
| 5eb7fd3 by Sebastian Thiel at 2011-01-17 |
71 |
packages = find_packages('.'), |
|
72 |
py_modules = ['git.'+f[:-3] for f in os.listdir('./git') if f.endswith('.py')], |
| 9ca0f89 by Sebastian Thiel at 2010-11-21 |
73 |
package_data = {'git.test' : ['fixtures/*']}, |
| 5eb7fd3 by Sebastian Thiel at 2011-01-17 |
74 |
package_dir = {'git':'git'}, |
| 83a9e4a by Sebastian Thiel at 2010-11-21 |
75 |
license = "BSD License", |
|
76 |
requires=('gitdb (>=0.5.1)',), |
|
77 |
install_requires='gitdb >= 0.5.1', |
|
78 |
zip_safe=False, |
|
79 |
long_description = """\ |
| 28a33ca by Sebastian Thiel at 2010-07-01 |
80 |
GitPython is a python library used to interact with Git repositories""", |
| 83a9e4a by Sebastian Thiel at 2010-11-21 |
81 |
classifiers = [ |
|
82 |
"Development Status :: 4 - Beta", |
|
83 |
"Intended Audience :: Developers", |
|
84 |
"License :: OSI Approved :: BSD License", |
|
85 |
"Operating System :: OS Independent", |
|
86 |
"Programming Language :: Python", |
|
87 |
"Programming Language :: Python :: 2.5", |
|
88 |
"Programming Language :: Python :: 2.6", |
|
89 |
"Topic :: Software Development :: Libraries :: Python Modules", |
|
90 |
] |
|
91 |
) |