Debian Codegraph @

setup.py

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 import re
5 import sys
6 import os.path
7 import warnings
8
9
10 def read(fname):
11 path = os.path.join(os.path.dirname(__file__), fname)
12 with open(path, encoding="utf-8") as fp:
13 return fp.read()
14
15
16 def check_file(fname):
17 path = os.path.join(os.path.dirname(__file__), fname)
18 if os.path.exists(path):
19 return True
20 warnings.warn(
21 "Not including file '{}' since it is not present. "
22 "Run 'make' to build all automatically generated files.".format(fname)
23 )
24 return False
25
26
27 # get version without importing the package
28 VERSION = re.search(
29 r'__version__\s*=\s*"([^"]+)"',
30 read("gallery_dl/version.py"),
31 )[1]
32
33 FILES = [
34 (path, [f for f in files if check_file(f)])
35 for (path, files) in [
36 ("share/bash-completion/completions", ["data/completion/gallery-dl"]),
37 ("share/zsh/site-functions" , ["data/completion/_gallery-dl"]),
38 ("share/fish/vendor_completions.d" , ["data/completion/gallery-dl.fish"]),
39 ("share/man/man1" , ["data/man/gallery-dl.1"]),
40 ("share/man/man5" , ["data/man/gallery-dl.conf.5"]),
41 ]
42 ]
43
44 PACKAGES = [
45 "gallery_dl",
46 "gallery_dl.extractor",
47 "gallery_dl.extractor.utils",
48 "gallery_dl.downloader",
49 "gallery_dl.postprocessor",
50 ]
51
52 DESCRIPTION = ("Command-line program to download image galleries and "
53 "collections from several image hosting sites")
54 LONG_DESCRIPTION = read("README.rst").replace(
55 "<docs/", "<https://codeberg.org/mikf/gallery-dl/src/branch/master/docs/")
56
57
58 def build_py2exe():
59 from py2exe import freeze
60
61 # py2exe dislikes version specifiers with a trailing '-dev'
62 VERSION_ = VERSION.partition("-")[0]
63
64 freeze(
65 console=[{
66 "script" : "./gallery_dl/__main__.py",
67 "dest_base" : "gallery-dl",
68 }],
69 version_info={
70 "version" : VERSION_,
71 "description" : DESCRIPTION,
72 "comments" : LONG_DESCRIPTION,
73 "product_name" : "gallery-dl",
74 "product_version": VERSION_,
75 },
76 options={
77 "bundle_files" : 0,
78 "compressed" : 1,
79 "optimize" : 1,
80 "dist_dir" : "./dist",
81 "packages" : PACKAGES,
82 "includes" : ["youtube_dl"],
83 "dll_excludes" : ["w9xpopen.exe"],
84 },
85 zipfile=None,
86 )
87
88
89 def build_setuptools():
90 from setuptools import setup
91
92 setup(
93 name="gallery_dl",
94 version=VERSION,
95 description=DESCRIPTION,
96 long_description=LONG_DESCRIPTION,
97 long_description_content_type="text/x-rst",
98 url="https://codeberg.org/mikf/gallery-dl",
99 download_url="https://codeberg.org/mikf/gallery-dl/releases/latest",
100 author="Mike Fährmann",
101 author_email="[email protected]",
102 maintainer="Mike Fährmann",
103 maintainer_email="[email protected]",
104 license="GPL-2.0-only",
105 python_requires=">=3.8",
106 install_requires=[
107 "requests>=2.11.0",
108 ],
109 extras_require={
110 "video": [
111 "yt-dlp",
112 ],
113 "extra": [
114 "requests[socks]",
115 "yt-dlp[default]",
116 "jinja2",
117 "pyyaml",
118 "toml; python_version < '3.11'",
119 "truststore; python_version >= '3.10'",
120 "secretstorage; sys_platform == 'linux'",
121 ],
122 },
123 entry_points={
124 "console_scripts": [
125 "gallery-dl = gallery_dl:main",
126 ],
127 },
128 packages=PACKAGES,
129 data_files=FILES,
130 test_suite="test",
131 keywords="image gallery downloader crawler scraper",
132 classifiers=[
133 "Development Status :: 5 - Production/Stable",
134 "Environment :: Console",
135 "Intended Audience :: End Users/Desktop",
136 "License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
137 "Operating System :: OS Independent",
138 "Programming Language :: Python",
139 "Programming Language :: Python :: 3",
140 "Programming Language :: Python :: 3 :: Only",
141 "Programming Language :: Python :: 3.8",
142 "Programming Language :: Python :: 3.9",
143 "Programming Language :: Python :: 3.10",
144 "Programming Language :: Python :: 3.11",
145 "Programming Language :: Python :: 3.12",
146 "Programming Language :: Python :: 3.13",
147 "Programming Language :: Python :: 3.14",
148 "Programming Language :: Python :: Implementation :: CPython",
149 "Programming Language :: Python :: Implementation :: PyPy",
150 "Topic :: Internet :: WWW/HTTP",
151 "Topic :: Multimedia :: Graphics",
152 "Topic :: Utilities",
153 ],
154 )
155
156
157 if "py2exe" in sys.argv:
158 build_py2exe()
159 else:
160 build_setuptools()