2 # Setup file for dulwich
3 # Copyright (C) 2008-2011 Jelmer Vernooij <jelmer@samba.org>
6 from setuptools import setup, Extension
9 from distutils.core import setup, Extension
10 has_setuptools = False
11 from distutils.core import Distribution
13 dulwich_version_string = '0.9.1'
16 # Windows MSVC support
19 if sys.platform == 'win32':
20 include_dirs.append('dulwich')
23 class DulwichDistribution(Distribution):
29 def has_ext_modules(self):
30 return not self.pure and not '__pypy__' in sys.modules
32 global_options = Distribution.global_options + [
33 ('pure', None, "use pure Python code instead of C "
34 "extensions (slower on CPython)")]
38 if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'):
39 # XCode 4.0 dropped support for ppc architecture, which is hardcoded in
43 ['/usr/bin/xcodebuild', '-version'], stdout=subprocess.PIPE,
44 stderr=subprocess.PIPE, env={})
45 out, err = p.communicate()
46 for l in out.splitlines():
47 # Also parse only first digit, because 3.2.1 can't be parsed nicely
48 if l.startswith('Xcode') and int(l.split()[1].split('.')[0]) >= 4:
49 os.environ['ARCHFLAGS'] = ''
54 setup_kwargs['test_suite'] = 'dulwich.tests.test_suite'
57 description='Python Git Library',
59 version=dulwich_version_string,
60 url='http://samba.org/~jelmer/dulwich',
61 license='GPLv2 or later',
62 author='Jelmer Vernooij',
63 author_email='jelmer@samba.org',
65 Simple Python implementation of the Git file formats and
66 protocols. Dulwich is the place where Mr. and Mrs. Git live
67 in one of the Monty Python sketches.
69 All functionality is available in pure Python, but (optional)
70 C extensions are also available for better performance.
72 packages=['dulwich', 'dulwich.tests', 'dulwich.tests.compat'],
73 scripts=['bin/dulwich', 'bin/dul-daemon', 'bin/dul-web', 'bin/dul-receive-pack', 'bin/dul-upload-pack'],
75 Extension('dulwich._objects', ['dulwich/_objects.c'],
76 include_dirs=include_dirs),
77 Extension('dulwich._pack', ['dulwich/_pack.c'],
78 include_dirs=include_dirs),
79 Extension('dulwich._diff_tree', ['dulwich/_diff_tree.c'],
80 include_dirs=include_dirs),
82 distclass=DulwichDistribution,