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.7'
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():
48 # Also parse only first digit, because 3.2.1 can't be parsed nicely
49 if l.startswith('Xcode') and int(l.split()[1].split('.')[0]) >= 4:
50 os.environ['ARCHFLAGS'] = ''
55 setup_kwargs['test_suite'] = 'dulwich.tests.test_suite'
58 description='Python Git Library',
60 version=dulwich_version_string,
61 url='https://samba.org/~jelmer/dulwich',
62 license='GPLv2 or later',
63 author='Jelmer Vernooij',
64 author_email='jelmer@samba.org',
66 Python implementation of the Git file formats and protocols,
67 without the need to have git installed.
69 All functionality is available in pure Python. Optional
70 C extensions can be built for improved performance.
72 The project is named after the part of London that Mr. and Mrs. Git live in
73 in the particular Monty Python sketch.
75 packages=['dulwich', 'dulwich.tests', 'dulwich.tests.compat'],
76 scripts=['bin/dulwich', 'bin/dul-daemon', 'bin/dul-web', 'bin/dul-receive-pack', 'bin/dul-upload-pack'],
78 Extension('dulwich._objects', ['dulwich/_objects.c'],
79 include_dirs=include_dirs),
80 Extension('dulwich._pack', ['dulwich/_pack.c'],
81 include_dirs=include_dirs),
82 Extension('dulwich._diff_tree', ['dulwich/_diff_tree.c'],
83 include_dirs=include_dirs),
85 distclass=DulwichDistribution,
86 include_package_data=True,
88 convert_2to3_doctests=['../docs/*', '../docs/tutorial/*', ],