-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
90 lines (77 loc) · 2.62 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import sys
from os.path import dirname, join, abspath, split, splitext
from setuptools import find_packages, setup
from importlib import import_module
def _import_file(filepath):
abspath_ = abspath(filepath)
dirname, file = split(abspath_)
fname, fext = splitext(file)
if fext != '.py':
raise ValueError("Not a Python source file: %s" % abspath_)
if dirname:
sys.path = [dirname] + sys.path
try:
module = import_module(fname)
finally:
if dirname:
sys.path.pop(0)
return module
def main(argv):
description = 'Reddit Infobot'
long_description = description
try:
with open('README.md', 'r') as f:
long_description = f.read().strip()
except (IOError, OSError): pass
filename = join(dirname(__file__), 'reddit_info_bot/version.py')
version = _import_file(filename).__version__
requirements = []
try:
with open(join(dirname(__file__), 'requirements.txt'), 'r') as f:
for line in f:
requirements += [line.strip()]
except (IOError, OSError): pass
setup_args = {
'name': 'python-reddit-infobot',
'version': version,
'url': 'https://github.com/tek0011/reddit_info_bot',
'description': description,
'long_description': long_description,
'keywords': 'python reddit infobot',
'author': 'python-reddit-infobot developers',
'maintainer': 'python-reddit-infobot developers',
'packages': find_packages(),
'include_package_data': True,
'zip_safe': False, # for setuptools
'entry_points': {
'console_scripts': [
'reddit-infobot = reddit_info_bot.cli:execute'
],
},
'classifiers': [
'Development Status :: 3 - Alpha',
'Operating System :: Linux',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
],
'install_requires': [
# included from requirements.txt
],
'dependency_links': [
# imgurpython unreleased 1.1.8
'https://github.com/Imgur/imgurpython/zipball/1.1.8',
],
}
if requirements:
setup_args['install_requires'] = requirements
try:
from local_setup import local_setup_args
setup_args.update(local_setup_args)
except ImportError: pass
setup(**setup_args)
if __name__ == "__main__":
sys.exit(main(sys.argv))