-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsetup.py
63 lines (54 loc) · 1.69 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
"""A setuptools based setup module.
See:
https://packaging.python.org/guides/distributing-packages-using-setuptools/
https://github.com/pypa/sampleproject
"""
try:
# pip >=20
from pip._internal.network.session import PipSession
from pip._internal.req import parse_requirements
except ImportError:
try:
# 10.0.0 <= pip <= 19.3.1
from pip._internal.req import parse_requirements
from pip._internal.download import PipSession
except ImportError:
# for pip <= 9.0.3
from pip.req import parse_requirements
from pip.download import PipSession
from os import path
from setuptools import find_packages, setup
here = path.abspath(path.dirname(__file__))
links = []
requires = []
try:
# new versions of pip requires a session
requirements = parse_requirements(
path.join(here, 'requirements.txt'), session=PipSession())
except Exception as exc:
requirements = parse_requirements(path.join(here, 'requirements.txt'))
for item in requirements:
# we want to handle package names and also repo urls
if getattr(item, 'url', None): # older pip has url
links.append(str(item.url))
if getattr(item, 'link', None): # newer pip has link
links.append(str(item.link))
try:
if item.req:
requires.append(str(item.req))
except AttributeError:
if item.requirement:
requires.append(str(item.requirement))
setup(
name='ksnap',
version='2.1.0',
packages=find_packages(),
python_requires='>=3.6, <4',
install_requires=requires,
entry_points={
"console_scripts": [
"ksnap = ksnap.__main__:main"
]
},
license_files = ('LICENSE',),
)