-
Notifications
You must be signed in to change notification settings - Fork 89
/
setup.py
83 lines (68 loc) · 2.4 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/python
# Copyright 2014 Aaron O'Mullan <[email protected]>
# Copyright 2013 Jace Browning <[email protected]>
#
# This program is free software; you can redistribute it and/or
# modify it only under the terms of the GNU GPLv2 and/or the Apache
# License, Version 2.0. See the COPYING file for further details.
"""
Setup script for Gittle.
"""
import platform
windows = platform.system() == 'Windows'
try:
from setuptools import setup
except ImportError:
has_setuptools = False
from distutils.core import setup
else:
has_setuptools = True
version_string = '0.5.0'
setup_kwargs = {
'name': 'gittle',
'description': 'A high level pure python git implementation',
'keywords': 'git dulwich pure python gittle',
'version': version_string,
'url': 'https://github.com/FriendCode/gittle',
'license': 'MIT',
'author': "Aaron O'Mullan",
'author_email': '[email protected]',
'long_description': """
Gittle is a wrapper around dulwich. It provides an easy and familiar interface to git.
It's pure python (no dependency on the ``git`` binary) and has no other dependencies besides
the python stdlib, dulwich and paramiko (optional).
""",
'packages': ['gittle', 'gittle.utils'],
'install_requires': [
# PyPI
'paramiko>=1.10.0',
'pycrypto==2.6',
'dulwich>=0.9.7',
'funky>=0.0.2',
],
}
try:
# Run setup with C extensions
setup(**setup_kwargs)
except SystemExit as exc:
import logging
logging.exception(exc)
logging.info("retrying installation without VisualStudio...")
# Remove C dependencies
install_requires = [r for r in setup_kwargs['install_requires']
if r.split('=')[0] not in ('paramiko', 'pycrypto')]
# Install dulwich as pure Python
if windows and has_setuptools:
from setuptools.command.easy_install import easy_install
run_setup = easy_install.run_setup
def _run_setup(self, setup_script, setup_base, args):
"""Alternate run_setup function to pass '--pure' to the
Dulwich installer on Windows.
"""
if 'dulwich' in setup_script:
args.insert(0, '--pure')
run_setup(self, setup_script, setup_base, args)
easy_install.run_setup = _run_setup
# Run setup without C extensions
setup_kwargs['install_requires'] = install_requires
setup(**setup_kwargs)