diff --git a/setup.py b/setup.py index b923a59..f8bd8ac 100644 --- a/setup.py +++ b/setup.py @@ -1,57 +1,65 @@ -from setuptools import setup -from os import path as os_path -from re import search as re_search - -_readme = 'README.md' +# coding: utf-8 +from setuptools import ( + setup, + find_packages +) +from re import search as re_search +from os import path as os_path -with open(_readme, 'r', encoding='utf-8') as f: - long_description = f.read() -_extras_path = 'extras' -with open(_extras_path+'/.env', 'r', encoding='utf-8') as f: - for line in f: - if line.startswith('PACKAGE='): - _package = line.splitlines()[0].split('=')[1].lower() - if line.startswith('URL='): - _url = line.splitlines()[0].split('=')[1].lower() - if line.startswith('AUTHORS='): - _authors = line.splitlines()[0].split('=')[1].lower() - if line.startswith('DESCR='): - _descr = line.splitlines()[0].split('=')[1].lower() - if line.startswith('CORR_AUTHOR='): - _corr_author = line.splitlines()[0].split('=')[1].lower() +## INFOS ## +package = 'retropath2_wrapper' +descr = 'Python wrapper of the KNIME retropath2.0 workflow' +url = 'https://github.com/brsynth/retropath2-wrapper' +authors = 'Joan Hérisson, Melchior du Lac, Thomas Duigou' +corr_author = 'joan.herisson@univ-evry.fr' -_release = 'RELEASE' -_version = os_path.join( - _package, - '_version.py' -) -# with open(_release, 'r') as f: -# _version = f.readline().split()[0] -with open(_version, 'r') as f: - m = re_search('"(.+)"', f.readline().split('=')[1]) - if m: - version = m.group(1) +## LONG DESCRIPTION +with open( + os_path.join( + os_path.dirname(os_path.realpath(__file__)), + 'README.md' + ), + 'r', + encoding='utf-8' +) as f: + long_description = f.read() +def get_version(): + with open( + os_path.join( + os_path.dirname(os_path.realpath(__file__)), + 'CHANGELOG.md' + ), + 'r' + ) as f: + lines = f.readlines() + for line in lines: + if line.startswith('##'): + from re import search + m = search("\[(.+)\]", line) + if m: + return m.group(1) setup( - name = _package, - version = version, - author = _authors, - author_email = _corr_author, - description = _descr, + name = package, + version = get_version(), + author = authors, + author_email = corr_author, + description = descr, long_description = long_description, long_description_content_type = 'text/markdown', - url = _url, - packages = [_package], - package_dir = {_package: _package}, + url = url, + packages = find_packages(), + package_dir = {package: package}, include_package_data = True, test_suite = 'pytest', license = 'MIT', - classifiers=[ + classifiers = [ 'Programming Language :: Python :: 3', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', ], - python_requires = '>=3.6', + python_requires = '>=3.7', ) +