2019-11-01 21:33:48 +01:00
|
|
|
#!/usr/bin/env python3
|
2016-10-08 11:37:47 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
2015-03-27 18:26:09 +01:00
|
|
|
|
2019-11-01 21:33:48 +01:00
|
|
|
import re
|
2017-01-17 21:44:54 +01:00
|
|
|
import sys
|
2015-11-04 00:07:03 +01:00
|
|
|
import os.path
|
2019-03-24 18:05:54 +01:00
|
|
|
import warnings
|
2015-11-04 00:07:03 +01:00
|
|
|
|
2015-03-27 18:26:09 +01:00
|
|
|
|
2015-11-04 00:07:03 +01:00
|
|
|
def read(fname):
|
2018-10-24 14:43:37 +02:00
|
|
|
path = os.path.join(os.path.dirname(__file__), fname)
|
2024-06-14 01:22:00 +02:00
|
|
|
with open(path, encoding="utf-8") as fp:
|
|
|
|
return fp.read()
|
2015-11-04 00:07:03 +01:00
|
|
|
|
2022-02-23 22:47:05 +01:00
|
|
|
|
2019-03-24 18:05:54 +01:00
|
|
|
def check_file(fname):
|
2019-11-01 21:33:48 +01:00
|
|
|
path = os.path.join(os.path.dirname(__file__), fname)
|
|
|
|
if os.path.exists(path):
|
2019-03-24 18:05:54 +01:00
|
|
|
return True
|
|
|
|
warnings.warn(
|
|
|
|
"Not including file '{}' since it is not present. "
|
|
|
|
"Run 'make' to build all automatically generated files.".format(fname)
|
|
|
|
)
|
|
|
|
return False
|
|
|
|
|
2017-01-17 21:44:54 +01:00
|
|
|
|
2016-10-08 11:37:47 +02:00
|
|
|
# get version without importing the package
|
2019-11-01 21:33:48 +01:00
|
|
|
VERSION = re.search(
|
|
|
|
r'__version__\s*=\s*"([^"]+)"',
|
|
|
|
read("gallery_dl/version.py"),
|
|
|
|
).group(1)
|
2017-01-17 21:44:54 +01:00
|
|
|
|
2019-11-01 21:33:48 +01:00
|
|
|
FILES = [
|
2019-03-24 18:05:54 +01:00
|
|
|
(path, [f for f in files if check_file(f)])
|
|
|
|
for (path, files) in [
|
2019-11-09 00:00:40 +01:00
|
|
|
("share/bash-completion/completions", ["data/completion/gallery-dl"]),
|
2020-07-04 18:05:31 +02:00
|
|
|
("share/zsh/site-functions" , ["data/completion/_gallery-dl"]),
|
2022-03-09 18:33:06 +01:00
|
|
|
("share/fish/vendor_completions.d" , ["data/completion/gallery-dl.fish"]),
|
2019-11-09 00:00:40 +01:00
|
|
|
("share/man/man1" , ["data/man/gallery-dl.1"]),
|
|
|
|
("share/man/man5" , ["data/man/gallery-dl.conf.5"]),
|
2019-03-24 18:05:54 +01:00
|
|
|
]
|
|
|
|
]
|
|
|
|
|
2022-10-25 11:20:04 +02:00
|
|
|
PACKAGES = [
|
|
|
|
"gallery_dl",
|
|
|
|
"gallery_dl.extractor",
|
|
|
|
"gallery_dl.downloader",
|
|
|
|
"gallery_dl.postprocessor",
|
|
|
|
]
|
|
|
|
|
2021-09-29 18:41:11 +02:00
|
|
|
DESCRIPTION = ("Command-line program to download image galleries and "
|
|
|
|
"collections from several image hosting sites")
|
2023-01-25 12:32:40 +01:00
|
|
|
LONG_DESCRIPTION = read("README.rst").replace(
|
|
|
|
"<docs/", "<https://github.com/mikf/gallery-dl/blob/master/docs/")
|
2021-09-29 18:41:11 +02:00
|
|
|
|
|
|
|
|
2022-10-25 11:20:04 +02:00
|
|
|
def build_py2exe():
|
|
|
|
from py2exe import freeze
|
2021-09-29 18:41:11 +02:00
|
|
|
|
|
|
|
# py2exe dislikes version specifiers with a trailing '-dev'
|
2022-10-25 11:20:04 +02:00
|
|
|
VERSION_ = VERSION.partition("-")[0]
|
2021-09-29 18:41:11 +02:00
|
|
|
|
2022-10-25 11:20:04 +02:00
|
|
|
freeze(
|
|
|
|
console=[{
|
2021-09-29 18:41:11 +02:00
|
|
|
"script" : "./gallery_dl/__main__.py",
|
|
|
|
"dest_base" : "gallery-dl",
|
2022-10-25 11:20:04 +02:00
|
|
|
}],
|
|
|
|
version_info={
|
|
|
|
"version" : VERSION_,
|
2021-09-29 18:41:11 +02:00
|
|
|
"description" : DESCRIPTION,
|
|
|
|
"comments" : LONG_DESCRIPTION,
|
|
|
|
"product_name" : "gallery-dl",
|
2022-10-25 11:20:04 +02:00
|
|
|
"product_version": VERSION_,
|
|
|
|
},
|
|
|
|
options={
|
|
|
|
"bundle_files" : 0,
|
|
|
|
"compressed" : 1,
|
|
|
|
"optimize" : 1,
|
|
|
|
"dist_dir" : "./dist",
|
|
|
|
"packages" : PACKAGES,
|
|
|
|
"includes" : ["youtube_dl"],
|
|
|
|
"dll_excludes" : ["w9xpopen.exe"],
|
|
|
|
},
|
|
|
|
zipfile=None,
|
|
|
|
)
|
2021-09-29 18:41:11 +02:00
|
|
|
|
2022-10-25 11:20:04 +02:00
|
|
|
|
|
|
|
def build_setuptools():
|
|
|
|
from setuptools import setup
|
|
|
|
|
|
|
|
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="mike_faehrmann@web.de",
|
|
|
|
maintainer="Mike Fährmann",
|
|
|
|
maintainer_email="mike_faehrmann@web.de",
|
|
|
|
license="GPLv2",
|
|
|
|
python_requires=">=3.4",
|
|
|
|
install_requires=[
|
|
|
|
"requests>=2.11.0",
|
2019-11-01 21:33:48 +01:00
|
|
|
],
|
2022-10-25 11:20:04 +02:00
|
|
|
extras_require={
|
|
|
|
"video": [
|
|
|
|
"youtube-dl",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
entry_points={
|
|
|
|
"console_scripts": [
|
|
|
|
"gallery-dl = gallery_dl:main",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
packages=PACKAGES,
|
|
|
|
data_files=FILES,
|
|
|
|
test_suite="test",
|
|
|
|
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)",
|
2022-10-25 14:57:31 +02:00
|
|
|
"Operating System :: OS Independent",
|
|
|
|
"Programming Language :: Python",
|
|
|
|
"Programming Language :: Python :: 3",
|
|
|
|
"Programming Language :: Python :: 3 :: Only",
|
2022-10-25 11:20:04 +02:00
|
|
|
"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",
|
2022-10-25 14:57:31 +02:00
|
|
|
"Programming Language :: Python :: 3.10",
|
|
|
|
"Programming Language :: Python :: 3.11",
|
2023-12-02 17:57:24 +01:00
|
|
|
"Programming Language :: Python :: 3.12",
|
2024-10-20 15:01:37 +02:00
|
|
|
"Programming Language :: Python :: 3.13",
|
2022-10-25 14:57:31 +02:00
|
|
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
|
|
"Programming Language :: Python :: Implementation :: PyPy",
|
2022-10-25 11:20:04 +02:00
|
|
|
"Topic :: Internet :: WWW/HTTP",
|
|
|
|
"Topic :: Multimedia :: Graphics",
|
|
|
|
"Topic :: Utilities",
|
2019-11-01 21:33:48 +01:00
|
|
|
],
|
2022-10-25 11:20:04 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if "py2exe" in sys.argv:
|
|
|
|
build_py2exe()
|
|
|
|
else:
|
|
|
|
build_setuptools()
|