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 has_setuptools = False
13 from distutils.core import Distribution
18 dulwich_version_string = '0.19.9'
21 # Windows MSVC support
22 if sys.platform == 'win32' and sys.version_info[:2] < (3, 6):
23 # Include dulwich/ for fallback stdint.h
24 include_dirs.append('dulwich')
27 class DulwichDistribution(Distribution):
33 def has_ext_modules(self):
36 global_options = Distribution.global_options + [
37 ('pure', None, "use pure Python code instead of C "
38 "extensions (slower on CPython)")]
43 if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'):
44 # XCode 4.0 dropped support for ppc architecture, which is hardcoded in
48 ['/usr/bin/xcodebuild', '-version'], stdout=subprocess.PIPE,
49 stderr=subprocess.PIPE, env={})
50 out, err = p.communicate()
51 for line in out.splitlines():
52 line = line.decode("utf8")
53 # Also parse only first digit, because 3.2.1 can't be parsed nicely
54 if (line.startswith('Xcode') and
55 int(line.split()[1].split('.')[0]) >= 4):
56 os.environ['ARCHFLAGS'] = ''
58 tests_require = ['fastimport']
61 if '__pypy__' not in sys.modules and not sys.platform == 'win32':
62 tests_require.extend([
63 'gevent', 'geventhttpclient', 'mock', 'setuptools>=17.1'])
67 Extension('dulwich._objects', ['dulwich/_objects.c'],
68 include_dirs=include_dirs),
69 Extension('dulwich._pack', ['dulwich/_pack.c'],
70 include_dirs=include_dirs),
71 Extension('dulwich._diff_tree', ['dulwich/_diff_tree.c'],
72 include_dirs=include_dirs),
78 setup_kwargs['extras_require'] = {
79 'fastimport': ['fastimport'],
80 'https': ['urllib3[secure]>=1.21'],
82 setup_kwargs['install_requires'] = ['urllib3>=1.21', 'certifi']
83 setup_kwargs['include_package_data'] = True
84 setup_kwargs['test_suite'] = 'dulwich.tests.test_suite'
85 setup_kwargs['tests_require'] = tests_require
87 with io.open(os.path.join(os.path.dirname(__file__), "README.md"),
88 encoding="utf-8") as f:
89 description = f.read()
92 author="Jelmer Vernooij",
93 author_email="jelmer@jelmer.uk",
94 url="https://www.dulwich.io/",
95 long_description=description,
96 description="Python Git Library",
97 version=dulwich_version_string,
98 license='Apachev2 or later or GPLv2',
100 "Bug Tracker": "https://github.com/dulwich/dulwich/issues",
101 "Repository": "https://www.dulwich.io/code/",
102 "GitHub": "https://github.com/dulwich/dulwich",
105 packages=['dulwich', 'dulwich.tests', 'dulwich.tests.compat',
107 package_data={'': ['../docs/tutorial/*.txt']},
108 scripts=['bin/dulwich', 'bin/dul-receive-pack', 'bin/dul-upload-pack'],
109 ext_modules=ext_modules,
110 distclass=DulwichDistribution,
112 'Development Status :: 4 - Beta',
113 'License :: OSI Approved :: Apache Software License',
114 'Programming Language :: Python :: 2.7',
115 'Programming Language :: Python :: 3.4',
116 'Programming Language :: Python :: 3.5',
117 'Programming Language :: Python :: 3.6',
118 'Programming Language :: Python :: Implementation :: CPython',
119 'Programming Language :: Python :: Implementation :: PyPy',
120 'Operating System :: POSIX',
121 'Operating System :: Microsoft :: Windows',
122 'Topic :: Software Development :: Version Control',