diff --git a/VERSION b/VERSION deleted file mode 120000 index 5846b7b..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -rfd/VERSION \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index a5567e9..a79e360 100644 --- a/poetry.lock +++ b/poetry.lock @@ -94,11 +94,15 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [[package]] name = "click" -version = "7.1.2" +version = "8.0.1" description = "Composable command line interface toolkit" category = "main" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +python-versions = ">=3.6" + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} +importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} [[package]] name = "colorama" @@ -147,7 +151,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" name = "importlib-metadata" version = "4.0.1" description = "Read metadata from Python packages" -category = "dev" +category = "main" optional = false python-versions = ">=3.6" @@ -390,7 +394,7 @@ python-versions = "*" name = "typing-extensions" version = "3.10.0.0" description = "Backported and Experimental Type Hints for Python 3.5+" -category = "dev" +category = "main" optional = false python-versions = "*" @@ -439,7 +443,7 @@ python-versions = "*" name = "zipp" version = "3.4.1" description = "Backport of pathlib-compatible object wrapper for zip files" -category = "dev" +category = "main" optional = false python-versions = ">=3.6" @@ -491,8 +495,8 @@ chardet = [ {file = "chardet-4.0.0.tar.gz", hash = "sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa"}, ] click = [ - {file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"}, - {file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"}, + {file = "click-8.0.1-py3-none-any.whl", hash = "sha256:fba402a4a47334742d782209a7c79bc448911afe1149d07bdabdf480b3e2f4b6"}, + {file = "click-8.0.1.tar.gz", hash = "sha256:8c04c11192119b1ef78ea049e0a6f0463e4c48ef00a30160c704337586f3ad7a"}, ] colorama = [ {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, diff --git a/pyproject.toml b/pyproject.toml index 5a4d1a7..facd09b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "rfd" -version = "0.7.1" +version = "0.7.2" description = "view RedFlagDeals.com from the command line" authors = ["Dave Gallant "] license = "GPL-3.0-or-later" diff --git a/rfd/VERSION b/rfd/VERSION deleted file mode 100644 index 39e898a..0000000 --- a/rfd/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.7.1 diff --git a/rfd/__version__.py b/rfd/__version__.py deleted file mode 100644 index 8ba6c2a..0000000 --- a/rfd/__version__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from os.path import dirname, abspath, join - - -def load_version(): - with open(join(dirname(abspath(__file__)), "VERSION")) as handle: - return handle.read() - - -version = load_version() diff --git a/rfd/cli.py b/rfd/cli.py index b45e300..32f5685 100644 --- a/rfd/cli.py +++ b/rfd/cli.py @@ -4,11 +4,15 @@ from __future__ import unicode_literals import logging import sys import click +try: + from importlib import metadata +except ImportError: # for Python<3.8 + import importlib_metadata as metadata from colorama import init from .api import get_threads, get_posts from .threads import parse_threads, search_threads, sort_threads, generate_thread_output from .posts import generate_posts_output -from .__version__ import version as current_version + init() @@ -18,12 +22,12 @@ logging.getLogger().addHandler(logging.StreamHandler()) def get_version(): - return "rfd v" + current_version + return "rfd v" + metadata.version("rfd") -def print_version(ctx, value): +def print_version(ctx, _, value): if not value or ctx.resilient_parsing: return - click.echo(get_version(), nl=False) + click.echo(get_version(), nl=True) ctx.exit()