From 64bb6bde3f5294e682883dacb690a55404e63d7c Mon Sep 17 00:00:00 2001 From: Anthony Forsberg Date: Tue, 2 Jul 2024 21:28:31 -0400 Subject: [PATCH] Move version to a permanent init --- .gitignore | 1 - bandcamp_dl/__init__.py | 2 ++ bandcamp_dl/__main__.py | 4 +--- bandcamp_dl/bandcamp.py | 4 +--- bandcamp_dl/bandcampdownloader.py | 3 +-- bandcamp_dl/config.py | 3 +-- 6 files changed, 6 insertions(+), 11 deletions(-) create mode 100644 bandcamp_dl/__init__.py diff --git a/.gitignore b/.gitignore index b714a94..a4eb5f8 100644 --- a/.gitignore +++ b/.gitignore @@ -46,5 +46,4 @@ bandcamp_dl/asyncdownloader.py .flake8 .local.vimrc -bandcamp_dl/__init__\.py venv/ diff --git a/bandcamp_dl/__init__.py b/bandcamp_dl/__init__.py new file mode 100644 index 0000000..4325970 --- /dev/null +++ b/bandcamp_dl/__init__.py @@ -0,0 +1,2 @@ +import importlib.metadata +__version__ = importlib.metadata.version("bandcamp-downloader") \ No newline at end of file diff --git a/bandcamp_dl/__main__.py b/bandcamp_dl/__main__.py index 007d662..320d590 100644 --- a/bandcamp_dl/__main__.py +++ b/bandcamp_dl/__main__.py @@ -23,13 +23,11 @@ import os import sys +from bandcamp_dl import __version__ from bandcamp_dl.bandcamp import Bandcamp from bandcamp_dl.bandcampdownloader import BandcampDownloader from bandcamp_dl import config -import importlib.metadata -__version__ = importlib.metadata.version("bandcamp-downloader") - def main(): parser = argparse.ArgumentParser() diff --git a/bandcamp_dl/bandcamp.py b/bandcamp_dl/bandcamp.py index 6b48150..c21cb9b 100644 --- a/bandcamp_dl/bandcamp.py +++ b/bandcamp_dl/bandcamp.py @@ -6,9 +6,7 @@ import bs4 import requests -import importlib.metadata -__version__ = importlib.metadata.version("bandcamp-downloader") - +from bandcamp_dl import __version__ from bandcamp_dl.bandcampjson import BandcampJSON diff --git a/bandcamp_dl/bandcampdownloader.py b/bandcamp_dl/bandcampdownloader.py index a0e07f5..adf2cfe 100644 --- a/bandcamp_dl/bandcampdownloader.py +++ b/bandcamp_dl/bandcampdownloader.py @@ -7,8 +7,7 @@ import requests import slugify -import importlib.metadata -__version__ = importlib.metadata.version("bandcamp-downloader") +from bandcamp_dl import __version__ def print_clean(msg): diff --git a/bandcamp_dl/config.py b/bandcamp_dl/config.py index 982a5ef..9458296 100644 --- a/bandcamp_dl/config.py +++ b/bandcamp_dl/config.py @@ -3,8 +3,7 @@ import logging import os -import importlib.metadata -__version__ = importlib.metadata.version("bandcamp-downloader") +from bandcamp_dl import __version__ TEMPLATE = '%{artist}/%{album}/%{track} - %{title}' OK_CHARS = '-_~'