From 69f9c73745292e2b8dbe2e8a5eb22b5b4cd44c88 Mon Sep 17 00:00:00 2001 From: Jesse Schwartzentruber Date: Fri, 7 Jul 2023 12:00:33 -0400 Subject: [PATCH] * Drop Python 3.7 * Update CI --- .pre-commit-config.yaml | 12 ++++++------ .taskcluster.yml | 4 ---- setup.cfg | 7 +------ src/fuzzfetch/core.py | 20 +++++++------------- tox.ini | 6 +++--- 5 files changed, 17 insertions(+), 32 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 12e3c1ff..d9dddd05 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,14 +4,14 @@ repos: hooks: - id: isort - repo: https://github.com/asottile/yesqa - rev: v1.4.0 + rev: v1.5.0 hooks: - id: yesqa - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.8.0 hooks: - id: pyupgrade - args: ['--py37-plus'] + args: ['--py38-plus'] - repo: https://github.com/ambv/black rev: 23.3.0 hooks: @@ -37,17 +37,17 @@ repos: args: ['--django'] - id: check-json - repo: https://github.com/codespell-project/codespell - rev: v2.2.4 + rev: v2.2.5 hooks: - id: codespell exclude_types: [json] exclude: ^tests/mock-+ - repo: https://github.com/marco-c/taskcluster_yml_validator - rev: v0.0.9 + rev: v0.0.10 hooks: - id: taskcluster_yml - repo: https://github.com/MozillaSecurity/orion - rev: v0.0.6 + rev: v0.0.7 hooks: - id: orion_ci - repo: meta diff --git a/.taskcluster.yml b/.taskcluster.yml index 6eda455d..f9e75c7f 100644 --- a/.taskcluster.yml +++ b/.taskcluster.yml @@ -20,10 +20,6 @@ tasks: - tox; tox -e codecov jobs: include: - - name: tests python 3.7 - version: "3.7" - env: - TOXENV: py37 - name: tests python 3.8 version: "3.8" env: diff --git a/setup.cfg b/setup.cfg index 230a27cd..18938e4d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,10 +4,6 @@ classifiers = Intended Audience :: Developers License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0) Programming Language :: Python :: 3 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 Topic :: Security Topic :: Software Development :: Testing description = Downloader for firefox/jsshell builds. @@ -23,7 +19,6 @@ url = https://github.com/MozillaSecurity/fuzzfetch [options] install_requires = - importlib_metadata; python_version < '3.8' pytz requests package_dir = @@ -31,7 +26,7 @@ package_dir = packages = fuzzfetch zip_safe = False -python_requires = >=3.7 +python_requires = >=3.8 [options.entry_points] console_scripts = diff --git a/src/fuzzfetch/core.py b/src/fuzzfetch/core.py index d4bebef8..2162a64c 100644 --- a/src/fuzzfetch/core.py +++ b/src/fuzzfetch/core.py @@ -11,8 +11,8 @@ import shutil import tempfile from datetime import datetime, timedelta +from importlib.metadata import PackageNotFoundError, version from pathlib import Path -from sys import version_info from typing import Any, Dict, Optional, Sequence, Tuple, Union from pytz import timezone @@ -25,18 +25,11 @@ from .path import PathArg from .path import rmtree as junction_rmtree -if version_info[:2] < (3, 8): - # pylint: disable=import-error - from importlib_metadata import PackageNotFoundError, version -else: - # pylint: disable=import-error - from importlib.metadata import PackageNotFoundError, version - try: __version__ = version("fuzzfetch") except PackageNotFoundError: # package is not installed - __version__ = None + __version__ = "unknown" LOG = logging.getLogger("fuzzfetch") BUG_URL = "https://github.com/MozillaSecurity/fuzzfetch/issues/" @@ -745,12 +738,13 @@ def from_args( """ parser = FetcherArgs() parser.parser.add_argument( - "-V", "--version", action="store_true", help="print version and exit" + "-V", + "--version", + action="version", + version=__version__, + help="print version and exit", ) args = parser.parse_args(argv) - if args.version: - print(f"fuzzfetch {__version__}") - raise SystemExit(0) # do this default manually so we can error if combined with --build namespace # parser.set_defaults(branch='central') diff --git a/tox.ini b/tox.ini index e6c21ce6..c6fdf573 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{37,38,39,310,311},lint +envlist = py{38,39,310,311},lint minversion = 3.2 skip_missing_interpreters = true tox_pip_extensions_ext_venv_update = true @@ -43,14 +43,14 @@ skip_install = true commands = mypy --install-types --non-interactive {posargs} deps = - mypy==v1.2.0 + mypy==v1.3.0 usedevelop = true [testenv:pylint] commands = pylint {posargs} deps = - pylint==2.17.2 + pylint==2.17.4 usedevelop = true [testenv:pypi]