From 8e1407de5453c459fa387d8044b6c8cb6a5e306a Mon Sep 17 00:00:00 2001 From: James Morris Date: Tue, 28 Jul 2020 12:52:17 -0400 Subject: [PATCH] Added some more package metadata, bumped version in preparation of new release, tweaked setup.py --- .travis.yml | 2 +- pgpy/_author.py | 2 +- pyproject.toml | 2 +- setup.cfg | 4 +++- setup.py | 38 ++++++++++++++++++-------------------- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5cb747b..bf4d6ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,7 +54,7 @@ install: - sed -i -e 's/^/#/' tests/gnupghome/gpg-agent.conf - ./install_dependencies.${TRAVIS_OS_NAME}.sh # ensure tox and coveralls are installed. pin PyYAML until we drop Python 3.4 - - pip install tox python-coveralls 'PyYAML==5.2; python_version == "3.4"' 'pathlib2; python_version < "3"' + - pip install tox python-coveralls 'PyYAML==5.2; python_version == "3.4"' # set TOXENV if it isn't yet before_script: diff --git a/pgpy/_author.py b/pgpy/_author.py index 5394ff2..15cdb98 100644 --- a/pgpy/_author.py +++ b/pgpy/_author.py @@ -15,4 +15,4 @@ __all__ = ['__author__', __author__ = "Michael Greene" __copyright__ = "Copyright (c) 2014-2019 Security Innovation, Inc" __license__ = "BSD" -__version__ = str(LooseVersion("0.5.2")) +__version__ = str(LooseVersion("0.5.3")) diff --git a/pyproject.toml b/pyproject.toml index ee0337c..9787c3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools", "wheel", "pathlib2 ; python_version < '3'"] +requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg index a3ef065..25cc878 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,8 @@ [metadata] name = PGPy author_email = mgreene@securityinnovation.com +maintainer = Security Innovation +maintainer_email = opensource@securityinnovation.com description = Pretty Good Privacy for Python keywords = OpenPGP, PGP, Pretty Good Privacy, GPG, GnuPG, openpgp, pgp, gnupg, gpg, encryption, signature url = https://github.com/SecurityInnovation/PGPy @@ -39,7 +41,7 @@ install_requires = setup_requires = setuptools wheel - pathlib2 ; python_version < '3' +python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* # doc_requires = # sphinx diff --git a/setup.py b/setup.py index b6c8b82..dd78d20 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,8 @@ -#!/usr/bin/python3 -# from distutils.core import setup import ast +import os.path + from setuptools import setup -try: - from pathlib import Path -except ImportError: - from pathlib2 import Path def extract_value(v): if isinstance(v, ast.Str): @@ -19,7 +15,8 @@ def extract_value(v): if r is not None: return r -def extract_vars_from_python_AST(a): + +def extract_vars_from_python_ast(a): res = {} for e in a.body: if isinstance(e, ast.Assign) and len(e.targets) == 1: @@ -28,17 +25,18 @@ def extract_vars_from_python_AST(a): res[n.id] = extract_value(e.value) return res -def extract_vars_from_python_source(p): - with p.open("rt", encoding="utf-8") as f: - t = f.read() - return extract_vars_from_python_AST(ast.parse(t)) -if __name__ == "__main__": - thisDir = Path(__file__).parent.absolute() - authorInfo = extract_vars_from_python_source(Path(thisDir / "pgpy" / "_author.py")) - setup( - version = authorInfo["__version__"], - author = authorInfo["__author__"], - license = authorInfo["__license__"], - download_url = "https://github.com/SecurityInnovation/PGPy/archive/{pgpy_ver}.tar.gz".format(pgpy_ver=authorInfo["__version__"]), - ) +def extract_vars_from_python_source(p): + with open(p) as f: + t = f.read() + return extract_vars_from_python_ast(ast.parse(t)) + + +this_dir = os.path.dirname(os.path.abspath(__file__)) +author_info = extract_vars_from_python_source(os.path.join(this_dir, "pgpy", "_author.py")) +setup( + version=author_info["__version__"], + author=author_info["__author__"], + license=author_info["__license__"], + download_url="https://github.com/SecurityInnovation/PGPy/archive/{pgpy_ver}.tar.gz".format(pgpy_ver=author_info["__version__"]), +)