-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
76 lines (62 loc) · 2 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
import io
import os
import re
import sys
from codecs import open
from distutils.text_file import TextFile
from setuptools import find_packages, setup
__author__ = "benjamin.c.yan"
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
packages = [
'simplekit',
'simplekit.objson'
]
requires = ['six', 'furl', 'requests', 'python-ntlm==1.1.0']
home = os.path.abspath(os.path.dirname(__file__))
missing = object()
def read_description(*files, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = [io.open(name, encoding=encoding).read() for name in files]
return sep.join(buf)
def read_dependencies(requirements=missing):
if requirements is None:
return []
if requirements is missing:
requirements = 'requirements.txt'
if not os.path.isfile(requirements):
return []
text = TextFile(requirements, lstrip_ws=True)
try:
return text.readlines()
finally:
text.close()
def read_version(version_file):
with open(version_file, 'rb') as fd:
result = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE)
return result.group(1) if result else '0.0.1'
setup(
name='simplekit',
version=read_version('simplekit/__init__.py'),
description='A simple and brief utility tools framework',
long_description=read_description('README.md'),
author='Benjamin Yan',
author_email='ycs_ctbu_2010@126.com',
url='https://github.com/by46/simplekit',
packages=find_packages(),
include_package_data=True,
install_requires=read_dependencies(),
license='The MIT License',
zip_safe=False,
classifiers=(
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
),
)