From 6e69b01475f1c052b2aa7ab8a9013123cd95bdea Mon Sep 17 00:00:00 2001 From: Joel Bender Date: Thu, 21 Apr 2016 10:26:58 -0400 Subject: [PATCH] extract the package metadata from the __init__.py file --- setup.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 90b9644..e43f956 100755 --- a/setup.py +++ b/setup.py @@ -2,6 +2,9 @@ # -*- coding: utf-8 -*- +import os +import re + try: from setuptools import setup except ImportError: @@ -16,19 +19,24 @@ test_requirements = [ # TODO: put package test requirements here ] +# read in the __init__.py file, extract the metadata +init_py = open(os.path.join('modpypes', '__init__.py')).read() +metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", init_py)) + setup( name='modpypes', - version='0.4', + version=metadata['version'], description="Python library for MODBUS based on BACpypes", long_description="See GitHub for more information", - author="Joel Bender", - author_email='joel@carrickbender.com', + author=metadata['author'], + author_email=metadata['email'], url='https://github.com/JoelBender/modpypes', packages=[ 'modpypes', ], - package_dir={'modpypes': - 'modpypes'}, + package_dir={ + 'modpypes': 'modpypes', + }, include_package_data=True, install_requires=requirements, license="MIT",