aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Logan <clpo13@gmail.com>2021-10-12 15:32:21 -0700
committerCody Logan <clpo13@gmail.com>2021-10-12 15:32:21 -0700
commiteab733409fb4fa0f0cba1ebeb1c2c706ef794bf5 (patch)
tree86e84215ce14f4a36fdf639acf9e831e2a88ac5d
parenta013dffd8685f029668ca7cc322bcb5050ce9364 (diff)
downloadwikiget-eab733409fb4fa0f0cba1ebeb1c2c706ef794bf5.tar.gz
wikiget-eab733409fb4fa0f0cba1ebeb1c2c706ef794bf5.zip
Drop support for EOL Python 3.5
-rw-r--r--.travis.yml3
-rw-r--r--README.md4
-rw-r--r--setup.py6
-rw-r--r--test/test_validations.py6
-rw-r--r--wikiget/dl.py27
-rw-r--r--wikiget/wikiget.py6
6 files changed, 24 insertions, 28 deletions
diff --git a/.travis.yml b/.travis.yml
index e9adf84..c1ca29c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,12 +1,11 @@
language: python
dist: xenial
python:
- - '3.5'
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- - '3.10'
+ - '3.10-dev'
install:
- pip install -U pip
- pip install .
diff --git a/README.md b/README.md
index 1d9de8b..575bb05 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ Something like wget for downloading a file from MediaWiki sites (like Wikipedia
or Wikimedia Commons) using only the file name or the URL of its description
page.
-Requires Python 3.5+. Get it with `pip install --user wikiget`.
+Requires Python 3.6+. Get it with `pip install --user wikiget`.
## Usage
@@ -95,7 +95,7 @@ executable script. Unit tests can be run with `python setup.py test`.
## License
-Copyright (C) 2018, 2019, 2020 Cody Logan and contributors
+Copyright (C) 2018-2021 Cody Logan and contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/setup.py b/setup.py
index 5fedd36..ab809e2 100644
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,5 @@
# wikiget - CLI tool for downloading files from Wikimedia sites
-# Copyright (C) 2018, 2019, 2020 Cody Logan
+# Copyright (C) 2018-2021 Cody Logan
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Wikiget is free software: you can redistribute it and/or modify
@@ -51,10 +51,10 @@ setup(
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
- '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',
'Topic :: Internet',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Multimedia',
@@ -63,7 +63,7 @@ setup(
'Topic :: Multimedia :: Video',
'Topic :: Utilities',
],
- python_requires='>=3.5',
+ python_requires='>=3.6',
install_requires=['mwclient>=0.10.0', 'requests', 'tqdm'],
setup_requires=['pytest-runner'],
tests_require=['pytest', 'pytest-cov'],
diff --git a/test/test_validations.py b/test/test_validations.py
index f2d2611..5b7d4fc 100644
--- a/test/test_validations.py
+++ b/test/test_validations.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# wikiget - CLI tool for downloading files from Wikimedia sites
-# Copyright (C) 2018, 2019, 2020 Cody Logan
+# Copyright (C) 2018-2021 Cody Logan
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Wikiget is free software: you can redistribute it and/or modify
@@ -88,6 +88,4 @@ def test_verify_hash(tmp_path):
tmp_file = tmp_path / file_name
tmp_file.write_text(file_contents)
- # Convert tmp_file from PosixPath to string so this test works with
- # Python 3.5 (see https://stackoverflow.com/a/42694113).
- assert verify_hash(str(tmp_file)) == file_sha1
+ assert verify_hash(tmp_file) == file_sha1
diff --git a/wikiget/dl.py b/wikiget/dl.py
index 6cbe8df..0ac8fec 100644
--- a/wikiget/dl.py
+++ b/wikiget/dl.py
@@ -1,5 +1,5 @@
# wikiget - CLI tool for downloading files from Wikimedia sites
-# Copyright (C) 2018, 2019, 2020 Cody Logan and contributors
+# Copyright (C) 2018-2021 Cody Logan and contributors
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Wikiget is free software: you can redistribute it and/or modify
@@ -49,7 +49,7 @@ def download(dl, args):
filename = file_match.group(2)
else:
# no file extension and/or prefix, probably an article
- print("Could not parse input '{}' as a file. ".format(filename))
+ print(f"Could not parse input '{filename}' as a file. ")
sys.exit(1)
filename = unquote(filename) # remove URL encoding for special characters
@@ -57,11 +57,11 @@ def download(dl, args):
dest = args.output or filename
if args.verbose >= 2:
- print('User agent: {}'.format(USER_AGENT))
+ print(f'User agent: {USER_AGENT}')
# connect to site and identify ourselves
if args.verbose >= 1:
- print('Site name: {}'.format(site_name))
+ print(f'Site name: {site_name}')
try:
site = Site(site_name, path=args.path, clients_useragent=USER_AGENT)
if args.username and args.password:
@@ -111,18 +111,18 @@ def download(dl, args):
file_sha1 = file.imageinfo['sha1']
if args.verbose >= 1:
- print("Info: downloading '{}' "
- "({} bytes) from {}".format(filename, file_size, site.host),
+ print(f"Info: downloading '{filename}' "
+ f"({file_size} bytes) from {site.host}",
end='')
if args.output:
- print(" to '{}'".format(dest))
+ print(f" to '{dest}'")
else:
print('\n', end='')
- print('Info: {}'.format(file_url))
+ print(f'Info: {file_url}')
if os.path.isfile(dest) and not args.force:
- print("File '{}' already exists, skipping download "
- "(use -f to ignore)".format(dest))
+ print(f"File '{dest}' already exists, skipping download "
+ "(use -f to ignore)")
else:
try:
fd = open(dest, 'wb')
@@ -151,8 +151,8 @@ def download(dl, args):
dl_sha1 = verify_hash(dest)
if args.verbose >= 1:
- print('Info: downloaded file SHA1 is {}'.format(dl_sha1))
- print('Info: server file SHA1 is {}'.format(file_sha1))
+ print(f'Info: downloaded file SHA1 is {dl_sha1}')
+ print(f'Info: server file SHA1 is {file_sha1}')
if dl_sha1 == file_sha1:
if args.verbose >= 1:
print('Info: hashes match!')
@@ -163,6 +163,5 @@ def download(dl, args):
else:
# no file information returned
- print("Target '{}' does not appear to be a valid file."
- .format(filename))
+ print(f"Target '{filename}' does not appear to be a valid file.")
sys.exit(1)
diff --git a/wikiget/wikiget.py b/wikiget/wikiget.py
index 03f2890..d24087e 100644
--- a/wikiget/wikiget.py
+++ b/wikiget/wikiget.py
@@ -1,5 +1,5 @@
# wikiget - CLI tool for downloading files from Wikimedia sites
-# Copyright (C) 2018, 2019, 2020 Cody Logan and contributors
+# Copyright (C) 2018-2021 Cody Logan and contributors
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Wikiget is free software: you can redistribute it and/or modify
@@ -49,7 +49,7 @@ def main():
prefix, or the URL of its file description page
""")
parser.add_argument('-V', '--version', action='version',
- version='%(prog)s {}'.format(wikiget_version))
+ version=f'%(prog)s {wikiget_version}')
message_options = parser.add_mutually_exclusive_group()
message_options.add_argument('-q', '--quiet',
help='suppress warning messages',
@@ -91,7 +91,7 @@ def main():
# batch download mode
input_file = args.FILE
if args.verbose >= 1:
- print("Info: using batch file '{}'".format(input_file))
+ print(f"Info: using batch file '{input_file}'")
try:
fd = open(input_file, 'r')
except IOError as e: