-
Notifications
You must be signed in to change notification settings - Fork 112
/
Copy pathsetup.py
212 lines (189 loc) · 7.22 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019-2024 A S Lewis
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Standard python setup file."""
# Import modules
import glob
import os
import setuptools
import sys
# Set a standard long_description, modified only for Debian/RPM packages
long_description = \
"""Tartube is a GUI front-end for youtube-dl, yt-dlp and other compatible video
downloaders.
.
- You can fetch a list of videos from your favourite channels and playlists on
YouTube, BitChute, and hundreds of other websites
- In buffering is an issue, you can download a temporary copy of a video
before automatically opening it in your favourite media player
- Tartube will organise your videos into convenient folders (if that's what
you want)
- Tartube can alert you when livestreams and debut videos are starting
(YouTube only)
- If you think the censors will remove a video, against the wishes of its
creators and before you've had a chance to watch it, Tartube can make an
archive copy
- Tartube won't manipulate search results, unsubscribe you from your favourite
channels or deliberately conceal videos
- Tartube is free and open-source software"""
# data_files for setuptools.setup are added here
param_list = []
# For Debian/RPM packaging, use environment variables
# For example, the package maintainer might use any of the following:
# TARTUBE_PKG=1 python3 setup.py build
# TARTUBE_PKG_STRICT=1 python3 setup.py build
# TARTUBE_PKG_NO_DOWNLOAD=1 python3 setup.py build
#
# There are four executables: the default one in ../tartube, and alternative
# ones in ../pack/bin, ../pack/bin_strict and ../pack/bin_no_download
#
# If TARTUBE_PKG is specified, then ../pack/bin/pkg/tartube is the executable,
# which means that youtube-dl updates are enabled. Also, icon files are
# copied into /usr/share/tartube/icons
pkg_var = 'TARTUBE_PKG'
pkg_value = os.environ.get( pkg_var, None )
# If TARTUBE_PKG_STRICT is specified, then ../pack/bin/strict/tartube is the
# executable, which means that youtube-dl updates are disabled. Also, icon
# files are copied into /usr/share/tartube/icons
pkg_strict_var = 'TARTUBE_PKG_STRICT'
pkg_strict_value = os.environ.get( pkg_strict_var, None )
# TARTUBE_PKG_NO_DOWNLOAD has all the features of TARTUBE_PKG_STRICT and, in
# addition, videos cannot be downloaded. Tartube can still fetch a list of
# videos in channels/playlists, monitor when livestreams start, and so on.
# The executable is ../pack/bin/no_download/tartube
pkg_no_download_var = 'TARTUBE_PKG_NO_DOWNLOAD'
pkg_no_download_value = os.environ.get( pkg_no_download_var, None )
script_exec = os.path.join('tartube', 'tartube')
icon_path = '/tartube/icons/'
sound_path = '/tartube/sounds/'
pkg_flag = False
if pkg_no_download_value is not None:
if pkg_no_download_value == '1':
script_exec = os.path.join('pack', 'bin', 'no_download', 'tartube')
sys.stderr.write('youtube-dl updates are disabled in this version\n')
pkg_flag = True
else:
sys.stderr.write(
"Unrecognised '%s=%s' environment variable!\n" % (
pkg_no_download_var,
pkg_no_download_value,
),
)
elif pkg_strict_value is not None:
if pkg_strict_value == '1':
script_exec = os.path.join('pack', 'bin', 'strict', 'tartube')
sys.stderr.write('youtube-dl updates are disabled in this version\n')
pkg_flag = True
else:
sys.stderr.write(
"Unrecognised '%s=%s' environment variable!\n" % (
pkg_strict_var,
pkg_strict_value,
),
)
elif pkg_value is not None:
if pkg_value == '1':
script_exec = os.path.join('pack', 'bin', 'pkg', 'tartube')
pkg_flag = True
else:
sys.stderr.write(
"Unrecognised '%s=%s' environment variable!\n" % (
pkg_var,
pkg_value,
),
)
# Apply changes if either environment variable was specified
if pkg_flag:
# Icons/sounds must be copied into the right place
icon_path = '/usr/share/tartube/icons/'
sound_path = '/usr/share/tartube/sounds/'
# Add a desktop file
param_list.append(('share/applications', ['pack/tartube.desktop']))
param_list.append(('share/pixmaps', ['pack/tartube.png']))
param_list.append(('share/pixmaps', ['pack/tartube.xpm']))
# Add a manpage
param_list.append(('share/man/man1', ['pack/tartube.1']))
# For PyPI installations and Debian/RPM packaging, copy everything in ../icons
# and ../sounds into a suitable location
subdir_list = [
'dialogue',
'external',
'ico',
'large',
'locale',
'overlays',
'small',
'status',
'stock',
'thumbas',
'toolbar',
'win',
]
for subdir in subdir_list:
for path in glob.glob('icons/' + subdir + '/*'):
param_list.append((icon_path + subdir + '/', [path]))
for path in glob.glob('sounds/*'):
param_list.append((sound_path + '/', [path]))
# Setup
setuptools.setup(
name = 'tartube',
version = '2.5.066',
description = 'GUI front-end for youtube-dl and yt-dlp',
long_description = long_description,
long_description_content_type = 'text/plain',
url = 'https://tartube.sourceforge.io',
author = 'A S Lewis',
author_email = '[email protected]',
license = """LGPLv2.1+""",
classifiers = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: End Users/Desktop',
'Topic :: Multimedia :: Video',
'License :: OSI Approved' \
+ ' :: GNU Lesser General Public License v2 or later (LGPLv2+)',
'Programming Language :: Python :: 3',
'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.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
],
keywords = 'tartube video download youtube',
packages = setuptools.find_packages(
exclude = ('docs', 'icons', 'nsis', 'tests'),
),
include_package_data = True,
python_requires = '>=3.0, <4',
install_requires = [
'feedparser',
# 'pgi',
'pygobject',
# 'matplotlib',
# 'playsound',
'requests',
],
scripts = [script_exec],
project_urls = {
'Bug Reports': 'https://github.com/axcore/tartube/issues',
'Source': 'https://github.com/axcore/tartube',
},
data_files = param_list,
)