2 # Setup file for dulwich
3 # Copyright (C) 2008-2011 Jelmer Vernooij <jelmer@jelmer.uk>
6 from setuptools import setup, Extension
8 from distutils.core import setup, Extension
9 from distutils.core import Distribution
11 dulwich_version_string = '0.12.1'
14 # Windows MSVC support
17 if sys.platform == 'win32':
18 include_dirs.append('dulwich')
20 class DulwichDistribution(Distribution):
26 def has_ext_modules(self):
29 global_options = Distribution.global_options + [
30 ('pure', None, "use pure Python code instead of C "
31 "extensions (slower on CPython)")]
35 if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'):
36 # XCode 4.0 dropped support for ppc architecture, which is hardcoded in
40 ['/usr/bin/xcodebuild', '-version'], stdout=subprocess.PIPE,
41 stderr=subprocess.PIPE, env={})
42 out, err = p.communicate()
43 for l in out.splitlines():
45 # Also parse only first digit, because 3.2.1 can't be parsed nicely
46 if l.startswith('Xcode') and int(l.split()[1].split('.')[0]) >= 4:
47 os.environ['ARCHFLAGS'] = ''
49 if sys.version_info[0] == 2:
50 tests_require = ['fastimport']
51 if not '__pypy__' in sys.modules and not sys.platform == 'win32':
52 tests_require.extend([
53 'gevent', 'geventhttpclient', 'mock', 'setuptools>=17.1'])
54 if sys.version_info < (2, 7):
55 tests_require.append('unittest2')
57 # fastimport, gevent, geventhttpclient are not available for PY3
58 # mock only used for test_swift, which requires gevent/geventhttpclient
61 if sys.version_info[0] > 2 and sys.platform == 'win32':
62 # C Modules don't build for python3 windows, and prevent tests from running
66 Extension('dulwich._objects', ['dulwich/_objects.c'],
67 include_dirs=include_dirs),
68 Extension('dulwich._pack', ['dulwich/_pack.c'],
69 include_dirs=include_dirs),
70 Extension('dulwich._diff_tree', ['dulwich/_diff_tree.c'],
71 include_dirs=include_dirs),
76 description='Python Git Library',
78 version=dulwich_version_string,
79 url='https://www.dulwich.io/',
80 license='GPLv2 or later',
81 author='Jelmer Vernooij',
82 author_email='jelmer@jelmer.uk',
84 Python implementation of the Git file formats and protocols,
85 without the need to have git installed.
87 All functionality is available in pure Python. Optional
88 C extensions can be built for improved performance.
90 The project is named after the part of London that Mr. and Mrs. Git live in
91 in the particular Monty Python sketch.
93 packages=['dulwich', 'dulwich.tests', 'dulwich.tests.compat', 'dulwich.contrib'],
94 package_data={'': ['../docs/tutorial/*.txt']},
95 scripts=['bin/dulwich', 'bin/dul-receive-pack', 'bin/dul-upload-pack'],
97 'Development Status :: 4 - Beta',
98 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)',
99 'Programming Language :: Python :: 2.6',
100 'Programming Language :: Python :: 2.7',
101 'Programming Language :: Python :: 3.4',
102 'Programming Language :: Python :: Implementation :: CPython',
103 'Programming Language :: Python :: Implementation :: PyPy',
104 'Operating System :: POSIX',
105 'Topic :: Software Development :: Version Control',
107 ext_modules=ext_modules,
108 test_suite='dulwich.tests.test_suite',
109 tests_require=tests_require,
110 distclass=DulwichDistribution,
111 include_package_data=True,