Merge pull request #308 from KOLANICH/setup.cfg

Moved the metadata from setup.py to setup.cfg
This commit is contained in:
James Morris
2020-07-28 11:38:35 -04:00
committed by GitHub
4 changed files with 91 additions and 88 deletions

View File

@@ -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"'
- pip install tox python-coveralls 'PyYAML==5.2; python_version == "3.4"' 'pathlib2; python_version < "3"'
# set TOXENV if it isn't yet
before_script:

3
pyproject.toml Normal file
View File

@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "wheel", "pathlib2 ; python_version < '3'"]
build-backend = "setuptools.build_meta"

View File

@@ -1,3 +1,51 @@
[metadata]
name = PGPy
author_email = mgreene@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
#bugtrack_url = https://github.com/SecurityInnovation/PGPy/issues",
long_description = file: README.rst
classifiers =
Development Status :: 4 - Beta
Operating System :: POSIX :: Linux
Operating System :: MacOS :: MacOS X
Operating System :: Microsoft :: Windows
Intended Audience :: Developers
Programming Language :: Python
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.4
Programming Language :: Python :: 2.7
Programming Language :: Python :: Implementation :: CPython
Topic :: Security
Topic :: Security :: Cryptography
Topic :: Software Development :: Libraries
Topic :: Software Development :: Libraries :: Python Modules
License :: OSI Approved :: BSD License
[options]
packages =
pgpy
pgpy.packet
pgpy.packet.subpackets
install_requires =
cryptography>=2.6
pyasn1
six>=1.9.0
singledispatch; python_version < '3.4'
enum34; python_version < '3.4'
setup_requires =
setuptools
wheel
pathlib2 ; python_version < '3'
# doc_requires =
# sphinx
# sphinx-better-theme
[build_sphinx]
source-dir = docs/source
build-dir = docs/build

122
setup.py
View File

@@ -1,92 +1,44 @@
#!/usr/bin/python
#!/usr/bin/python3
# from distutils.core import setup
import sys
import ast
from setuptools import setup
if sys.version_info[:2] >= (3, 3):
# on Python 3.3+, we can import a file directly using importlib.machinery.SourceFileLoader
import importlib.machinery
_loader = importlib.machinery.SourceFileLoader('_author', 'pgpy/_author.py')
_author = _loader.load_module()
try:
from pathlib import Path
except ImportError:
from pathlib2 import Path
else:
# on Python 2 and 3.2, importlib.machinery.SourceFileLoader doesn't exist
# so we have to use imp to accomplish the same thing
import imp
_author = imp.load_source('_author', 'pgpy/_author.py')
def extract_value(v):
if isinstance(v, ast.Str):
return v.s
elif isinstance(v, ast.Num):
return v.n
elif isinstance(v, ast.Call):
for a in v.args:
r = extract_value(a)
if r is not None:
return r
# long_description is the contents of README.rst
with open('README.rst') as readme:
long_desc = readme.read()
def extract_vars_from_python_AST(a):
res = {}
for e in a.body:
if isinstance(e, ast.Assign) and len(e.targets) == 1:
n = e.targets[0]
if isinstance(n, ast.Name):
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))
_requires = [
'cryptography>=2.6',
'pyasn1',
'six>=1.9.0',
]
_doc_requires = [
'sphinx',
'sphinx-better-theme'
]
if sys.version_info[:2] < (3, 4):
# only depend on enum34 and singledispatch if Python is older than 3.4
_requires += ['singledispatch']
_requires += ['enum34']
setup(
# metadata
name = 'PGPy',
version = _author.__version__,
description = 'Pretty Good Privacy for Python',
long_description = long_desc,
author = _author.__author__,
author_email = "mgreene@securityinnovation.com",
license = _author.__license__,
classifiers = ['Development Status :: 4 - Beta',
'Operating System :: POSIX :: Linux',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Intended Audience :: Developers',
'Programming Language :: Python',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Security',
'Topic :: Security :: Cryptography',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
'License :: OSI Approved :: BSD License'],
keywords = ["OpenPGP",
"PGP",
"Pretty Good Privacy",
"GPG",
"GnuPG",
"openpgp",
"pgp",
"gnupg",
"gpg",
"encryption",
"signature", ],
# dependencies
install_requires = _requires,
# urls
url = "https://github.com/SecurityInnovation/PGPy",
download_url = "https://github.com/SecurityInnovation/PGPy/archive/{pgpy_ver}.tar.gz".format(pgpy_ver=_author.__version__),
# bugtrack_url = "https://github.com/SecurityInnovation/PGPy/issues",
# package hierarchy
packages = [
"pgpy",
"pgpy.packet",
"pgpy.packet.subpackets"
],
)
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__"]),
)