Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Commit

Permalink
将版本信息从 libtakiyasha.__init__.__VERSION__ 移动到 `takiyasha.constants._…
Browse files Browse the repository at this point in the history
…_VERSION__`
  • Loading branch information
nukemiko committed Jul 11, 2022
1 parent 5b1191e commit b79445d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = takiyasha
version = attr: libtakiyasha.__VERSION__
version = attr: takiyasha.constants.__VERSION__
description = Python 版本的音乐解密工具
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down
14 changes: 4 additions & 10 deletions src/libtakiyasha/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from __future__ import annotations

__VERSION__ = '0.6.3'

import re
from typing import Type, Union

Expand All @@ -15,17 +13,13 @@
SupportsCrypter = Union[NCM, NCMCache, QMCv1, QMCv2]


def get_version() -> str:
return __VERSION__


def extensions_crypters() -> dict[str, Type[SupportsCrypter]]:
return {
r'^\.qmc[\da-z]{1,4}$': QMCv1,
r'^\.mflac[\da-z]?$': QMCv2,
r'^\.mgg[\da-z]?$': QMCv2,
r'^\.ncm$': NCM,
r'^\.uc!$': NCMCache
r'^\.mflac[\da-z]?$' : QMCv2,
r'^\.mgg[\da-z]?$' : QMCv2,
r'^\.ncm$' : NCM,
r'^\.uc!$' : NCMCache
}


Expand Down
5 changes: 2 additions & 3 deletions src/takiyasha/argdefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import sys
from pathlib import Path

from libtakiyasha import get_version
from .constants import DESCRIPTION, EPILOG, PROGNAME
from .constants import DESCRIPTION, EPILOG, PROGNAME, __VERSION__


class ShowSupportedFormatsAndExit(argparse.Action):
Expand Down Expand Up @@ -52,7 +51,7 @@ def __call__(self, parser, namespace, values, option_string=None):
)
help_options.add_argument('-V', '--version',
action='version',
version=f'%(prog)s {get_version()}',
version=f'%(prog)s {__VERSION__}',
help='显示版本信息并退出'
)
help_options.add_argument('--formats',
Expand Down
2 changes: 2 additions & 0 deletions src/takiyasha/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from pathlib import Path

__VERSION__ = '0.6.3'

PROGNAME = Path(__file__).parent.name
DESCRIPTION = f' 将加密音乐文件的内容输出到指定的目录。\n' \
f' 如果未指定输出目录,输出文件将会在当前工作目录下产生。\n' \
Expand Down

0 comments on commit b79445d

Please sign in to comment.