From cdebd4028064bca85d78103e7c9d94d2ae4923ad Mon Sep 17 00:00:00 2001 From: "v.kaukin" Date: Tue, 28 Apr 2020 13:39:31 +0500 Subject: [PATCH] add __version__ var to package --- README.rst | 1 + imap_tools/__init__.py | 2 ++ release_notes.rst | 4 ++++ setup.py | 11 ++++++++++- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 979e4eb..d247560 100644 --- a/README.rst +++ b/README.rst @@ -259,3 +259,4 @@ Thanks to: * `audemed44 `_ * `mkalioby `_ * `atlas0fd00m `_ +* `unqx `_ diff --git a/imap_tools/__init__.py b/imap_tools/__init__.py index 8ac8adf..6d1531f 100644 --- a/imap_tools/__init__.py +++ b/imap_tools/__init__.py @@ -3,3 +3,5 @@ from .message import * from .folder import * from .utils import * + +__version__ = '0.14.3' diff --git a/release_notes.rst b/release_notes.rst index 564af22..e387026 100644 --- a/release_notes.rst +++ b/release_notes.rst @@ -1,3 +1,7 @@ +0.14.3 +====== +* Fixed multiple encodings case for attachment name + 0.14.2 ====== * Fixed bug in folder.MailBoxFolderManager.exists/list on folder names with " and \ chars diff --git a/setup.py b/setup.py index 9b85e1b..46b6a16 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,20 @@ +import os +import re import setuptools + +def get_version(package: str) -> str: + """Return package version as listed in __version__ variable at __init__.py""" + init_py = open(os.path.join(package, '__init__.py')).read() + return re.search(r"__version__\s*=\s*['\"]([^'\"]+)['\"]", init_py).group(1) + + with open("README.rst", "r", encoding='utf-8') as fh: long_description = fh.read() setuptools.setup( name='imap_tools', - version='0.14.2', + version=get_version('imap_tools'), packages=setuptools.find_packages(), url='https://github.com/ikvk/imap_tools', license='Apache-2.0',