3 # Setup file for dulwich
4 # Copyright (C) 2008-2016 Jelmer Vernooij <jelmer@jelmer.uk>
7 from setuptools import setup, Extension
9 from distutils.core import setup, Extension
10 from distutils.core import Distribution
12 dulwich_version_string = '0.17.3'
15 # Windows MSVC support
18 if sys.platform == 'win32':
19 include_dirs.append('dulwich')
21 class DulwichDistribution(Distribution):
27 def has_ext_modules(self):
30 global_options = Distribution.global_options + [
31 ('pure', None, "use pure Python code instead of C "
32 "extensions (slower on CPython)")]
36 if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'):
37 # XCode 4.0 dropped support for ppc architecture, which is hardcoded in
41 ['/usr/bin/xcodebuild', '-version'], stdout=subprocess.PIPE,
42 stderr=subprocess.PIPE, env={})
43 out, err = p.communicate()
44 for l in out.splitlines():
46 # Also parse only first digit, because 3.2.1 can't be parsed nicely
47 if l.startswith('Xcode') and int(l.split()[1].split('.')[0]) >= 4:
48 os.environ['ARCHFLAGS'] = ''
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'])
55 if sys.version_info[0] > 2 and sys.platform == 'win32':
56 # C Modules don't build for python3 windows, and prevent tests from running
60 Extension('dulwich._objects', ['dulwich/_objects.c'],
61 include_dirs=include_dirs),
62 Extension('dulwich._pack', ['dulwich/_pack.c'],
63 include_dirs=include_dirs),
64 Extension('dulwich._diff_tree', ['dulwich/_diff_tree.c'],
65 include_dirs=include_dirs),
70 description='Python Git Library',
72 version=dulwich_version_string,
73 url='https://www.dulwich.io/',
74 license='Apachev2 or later or GPLv2',
75 author='Jelmer Vernooij',
76 author_email='jelmer@jelmer.uk',
78 Python implementation of the Git file formats and protocols,
79 without the need to have git installed.
81 All functionality is available in pure Python. Optional
82 C extensions can be built for improved performance.
84 The project is named after the part of London that Mr. and Mrs. Git live in
85 in the particular Monty Python sketch.
87 packages=['dulwich', 'dulwich.tests', 'dulwich.tests.compat', 'dulwich.contrib'],
88 package_data={'': ['../docs/tutorial/*.txt']},
89 scripts=['bin/dulwich', 'bin/dul-receive-pack', 'bin/dul-upload-pack'],
91 'Development Status :: 4 - Beta',
92 'License :: OSI Approved :: Apache Software License',
93 'Programming Language :: Python :: 2.7',
94 'Programming Language :: Python :: 3.4',
95 'Programming Language :: Python :: 3.5',
96 'Programming Language :: Python :: Implementation :: CPython',
97 'Programming Language :: Python :: Implementation :: PyPy',
98 'Operating System :: POSIX',
99 'Topic :: Software Development :: Version Control',
101 ext_modules=ext_modules,
102 test_suite='dulwich.tests.test_suite',
103 tests_require=tests_require,
104 distclass=DulwichDistribution,
105 include_package_data=True,