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