-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
116 lines (99 loc) · 3.17 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/env python
# encoding: utf-8
"""
setup.py
Setup the Keyring Lib for Python.
"""
import sys
import codecs
try:
import setuptools
setup_mod = setuptools
"where to find setup()"
except ImportError:
import distutils.core
setup_mod = distutils.core
def load(filename):
"""
Read a text file and decode it.
"""
f = codecs.open(filename, encoding='utf-8')
try:
result = f.read()
finally:
f.close()
if not encodes_as_ascii(result):
# see https://bitbucket.org/kang/python-keyring-lib/issue/55
raise ValueError("distutils requires ASCII")
return result
def encodes_as_ascii(string):
try:
string.encode('ascii')
except UnicodeEncodeError:
return False
return True
test_requirements = [
'pytest',
'gdata',
'python-keyczar',
'fs',
'mock',
'pycrypto',
]
"dependencies for running tests"
if sys.version_info < (2, 7) or (
sys.version_info >= (3, 0) and sys.version_info < (3, 1)):
# Require unittest2 for Python which doesn't contain the new unittest
# module (appears in Python 2.7 and Python 3.1)
test_requirements.append('unittest2')
if sys.version_info >= (3, 0):
# the fs lib doesn't currently install on Python 3. Omit it for now.
# See http://code.google.com/p/pyfilesystem/issues/detail?id=135
test_requirements.remove('fs')
# gdata doesn't currently install on Python 3. Omit it also.
# http://code.google.com/p/gdata-python-client/issues/detail?id=229
test_requirements.remove('gdata')
# keyczar doesn't currently install on Python 3. Omit it also.
# http://code.google.com/p/keyczar/issues/detail?id=125
test_requirements.remove('python-keyczar')
# only request pytest_runner when command-line indicates invocation
pytest_runner = ['pytest-runner'] if 'ptr' in sys.argv else []
setup_params = dict(
name = 'keyring',
version = "2.0",
description = "Store and access your passwords safely.",
url = "http://bitbucket.org/kang/python-keyring-lib",
keywords = "keyring Keychain GnomeKeyring Kwallet password storage",
author = "Kang Zhang",
author_email = "[email protected]",
maintainer = 'Jason R. Coombs',
maintainer_email = '[email protected]',
license = "PSF",
long_description = load('README.rst') + load('CHANGES.rst'),
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Programming Language :: Python :: 2.5",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
],
platforms = ["Many"],
packages = ['keyring', 'keyring.tests', 'keyring.util',
'keyring.backends', 'keyring.tests.backends'],
extras_require = {'test': test_requirements},
tests_require = test_requirements,
setup_requires = [
] + pytest_runner,
entry_points = {
'console_scripts': [
'keyring=keyring.cli:main',
],
},
)
if sys.version_info >= (3, 0):
setup_params.update(
use_2to3=True,
)
if __name__ == '__main__':
setup_mod.setup(**setup_params)