forked from thp/urlwatch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
65 lines (51 loc) · 1.86 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
#!/usr/bin/env python3
from setuptools import setup
from distutils import cmd
import os
import re
import sys
main_py = open(os.path.join('lib', 'urlwatch', '__init__.py')).read()
m = dict(re.findall("\n__([a-z]+)__ = '([^']+)'", main_py))
docs = re.findall('"""(.*?)"""', main_py, re.DOTALL)
if sys.version_info < (3, 3):
sys.exit('urlwatch requires Python 3.3 or newer')
m['name'] = 'urlwatch'
m['author'], m['author_email'] = re.match(r'(.*) <(.*)>', m['author']).groups()
m['description'], m['long_description'] = docs[0].strip().split('\n\n', 1)
m['install_requires'] = ['minidb', 'PyYAML', 'requests', 'keyring', 'pycodestyle', 'appdirs', 'lxml', 'cssselect']
if sys.version_info < (3, 4):
m['install_requires'].extend(['enum34'])
if sys.platform == 'win32':
m['install_requires'].extend(['colorama'])
m['entry_points'] = {"console_scripts": ["urlwatch=urlwatch.cli:main"]}
m['package_dir'] = {'': 'lib'}
m['packages'] = ['urlwatch']
m['python_requires'] = '>3.3.0'
m['data_files'] = [
('share/man/man1', ['share/man/man1/urlwatch.1']),
('share/urlwatch/examples', [
'share/urlwatch/examples/hooks.py.example',
'share/urlwatch/examples/urls.yaml.example',
]),
]
class InstallDependencies(cmd.Command):
"""Install dependencies only"""
description = 'Only install required packages using pip'
user_options = []
def initialize_options(self):
...
def finalize_options(self):
...
def run(self):
global m
try:
from pip._internal import main
except ImportError:
from pip import main
try:
main(['install', '--upgrade'] + m['install_requires'])
except TypeError: # recent pip
main.main(['install', '--upgrade'] + m['install_requires'])
m['cmdclass'] = {'install_dependencies': InstallDependencies}
del m['copyright']
setup(**m)