forked from mikf/gallery-dl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
139 lines (124 loc) · 4.05 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import sys
import os.path
import warnings
from setuptools import setup
def read(fname):
path = os.path.join(os.path.dirname(__file__), fname)
with open(path, encoding="utf-8") as file:
return file.read()
def check_file(fname):
path = os.path.join(os.path.dirname(__file__), fname)
if os.path.exists(path):
return True
warnings.warn(
"Not including file '{}' since it is not present. "
"Run 'make' to build all automatically generated files.".format(fname)
)
return False
# get version without importing the package
VERSION = re.search(
r'__version__\s*=\s*"([^"]+)"',
read("gallery_dl/version.py"),
).group(1)
FILES = [
(path, [f for f in files if check_file(f)])
for (path, files) in [
("share/bash-completion/completions", ["data/completion/gallery-dl"]),
("share/zsh/site-functions" , ["data/completion/_gallery-dl"]),
("share/fish/vendor_completions.d" , ["data/completion/gallery-dl.fish"]),
("share/man/man1" , ["data/man/gallery-dl.1"]),
("share/man/man5" , ["data/man/gallery-dl.conf.5"]),
]
]
DESCRIPTION = ("Command-line program to download image galleries and "
"collections from several image hosting sites")
LONG_DESCRIPTION = read("README.rst")
if "py2exe" in sys.argv:
try:
import py2exe
except ImportError:
sys.exit("Error importing 'py2exe'")
# py2exe dislikes version specifiers with a trailing '-dev'
VERSION = VERSION.partition("-")[0]
params = {
"console": [{
"script" : "./gallery_dl/__main__.py",
"dest_base" : "gallery-dl",
"version" : VERSION,
"description" : DESCRIPTION,
"comments" : LONG_DESCRIPTION,
"product_name" : "gallery-dl",
"product_version": VERSION,
}],
"options": {"py2exe": {
"bundle_files": 0,
"compressed" : 1,
"optimize" : 1,
"dist_dir" : ".",
"packages" : ["gallery_dl"],
"includes" : ["youtube_dl"],
"dll_excludes": ["w9xpopen.exe"],
}},
"zipfile": None,
}
else:
params = {}
setup(
name="gallery_dl",
version=VERSION,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
url="https://github.com/mikf/gallery-dl",
download_url="https://github.com/mikf/gallery-dl/releases/latest",
author="Mike Fährmann",
author_email="[email protected]",
maintainer="Mike Fährmann",
maintainer_email="[email protected]",
license="GPLv2",
python_requires=">=3.4",
install_requires=[
"requests>=2.11.0",
],
extras_require={
"video": [
"youtube-dl",
],
},
packages=[
"gallery_dl",
"gallery_dl.extractor",
"gallery_dl.downloader",
"gallery_dl.postprocessor",
],
entry_points={
"console_scripts": [
"gallery-dl = gallery_dl:main",
],
},
data_files=FILES,
keywords="image gallery downloader crawler scraper",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: MacOS",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Multimedia :: Graphics",
"Topic :: Utilities",
],
test_suite="test",
**params,
)