From 5976d1a2d3f9ace23865dcbb5d0f53cdcedfbaca Mon Sep 17 00:00:00 2001 From: Florian Mounier Date: Thu, 1 Jun 2017 17:29:57 +0200 Subject: [PATCH] Use a __about__.py --- pygal/__about__.py | 15 +++++++++++++++ pygal/__init__.py | 3 +-- setup.cfg | 2 +- setup.py | 24 ++++++++++++------------ 4 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 pygal/__about__.py diff --git a/pygal/__about__.py b/pygal/__about__.py new file mode 100644 index 0000000..ea6a0c9 --- /dev/null +++ b/pygal/__about__.py @@ -0,0 +1,15 @@ +__title__ = "pygal" +__version__ = "2.3.1" + +__summary__ = "A python svg graph plotting library" +__uri__ = "http://pygal.org/" +__author__ = "Florian Mounier" +__email__ = "florian.mounier@kozea.fr" + +__license__ = "GNU LGPL v3+" +__copyright__ = "Copyright 2017 %s" % __author__ + +__all__ = [ + '__title__', '__version__', '__summary__', '__uri__', '__author__', + '__email__', '__license__', '__copyright__' +] diff --git a/pygal/__init__.py b/pygal/__init__.py index 55ebb4c..ca01709 100644 --- a/pygal/__init__.py +++ b/pygal/__init__.py @@ -23,8 +23,7 @@ This package holds all available charts in pygal, the Config class and the maps extensions namespace module. """ - -__version__ = '2.3.1' +from .__about__ import * # noqa: F401,F403 import pkg_resources import sys diff --git a/setup.cfg b/setup.cfg index bdae69e..40a8157 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [wheel] universal = 1 -[tool:pytest] +[pytest] flake8-ignore = *.py E731 E402 pygal/__init__.py F401 diff --git a/setup.py b/setup.py index 7ba8b66..7f2fdcb 100644 --- a/setup.py +++ b/setup.py @@ -19,9 +19,8 @@ # along with pygal. If not, see . import os import sys -import re -from setuptools import setup, find_packages +from setuptools import find_packages, setup from setuptools.command.test import test as TestCommand @@ -56,18 +55,19 @@ tests_requirements = [ 'pytest' ] - -with open(os.path.join(ROOT, 'pygal', '__init__.py'), **kwargs) as fd: - __version__ = re.search("__version__ = '([^']+)'", fd.read()).group(1) +about = {} +with open(os.path.join( + os.path.dirname(__file__), "pygal", "__about__.py")) as f: + exec(f.read(), about) setup( - name="pygal", - version=__version__, - description="A python svg graph plotting library", - author="Kozea", - url="http://pygal.org/", - author_email="florian.mounier@kozea.fr", - license="GNU LGPL v3+", + name=about['__title__'], + version=about['__version__'], + description=about['__summary__'], + url=about['__uri__'], + author=about['__author__'], + author_email=about['__email__'], + license=about['__license__'], platforms="Any", packages=find_packages(), provides=['pygal'],