Move the last of the metadata to setup.cfg
This commit is contained in:
@@ -17,6 +17,7 @@ import sys
|
|||||||
import os
|
import os
|
||||||
# this needs sphinx-better-theme
|
# this needs sphinx-better-theme
|
||||||
from better import better_theme_path
|
from better import better_theme_path
|
||||||
|
from setuptools.config import read_configuration
|
||||||
|
|
||||||
# If extensions (or modules to document with autodoc) are in another directory,
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
# add these directories to sys.path here. If the directory is relative to the
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
@@ -25,7 +26,7 @@ _docsrcdir = os.path.dirname(os.path.abspath(__file__))
|
|||||||
sys.path.insert(0, _docsrcdir)
|
sys.path.insert(0, _docsrcdir)
|
||||||
sys.path.insert(0, os.path.dirname(os.path.dirname(_docsrcdir)))
|
sys.path.insert(0, os.path.dirname(os.path.dirname(_docsrcdir)))
|
||||||
|
|
||||||
from pgpy._author import __version__
|
__version__ = read_configuration(os.path.join('..', '..', 'setup.cfg'))['metadata']['version']
|
||||||
|
|
||||||
# -- General configuration ------------------------------------------------
|
# -- General configuration ------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
""" PGPy :: Pretty Good Privacy for Python
|
""" PGPy :: Pretty Good Privacy for Python
|
||||||
"""
|
"""
|
||||||
from ._author import *
|
|
||||||
|
|
||||||
from .pgp import PGPKey
|
from .pgp import PGPKey
|
||||||
from .pgp import PGPKeyring
|
from .pgp import PGPKeyring
|
||||||
@@ -8,11 +7,7 @@ from .pgp import PGPMessage
|
|||||||
from .pgp import PGPSignature
|
from .pgp import PGPSignature
|
||||||
from .pgp import PGPUID
|
from .pgp import PGPUID
|
||||||
|
|
||||||
__all__ = ['__author__',
|
__all__ = ['constants',
|
||||||
'__copyright__',
|
|
||||||
'__license__',
|
|
||||||
'__version__',
|
|
||||||
'constants',
|
|
||||||
'errors',
|
'errors',
|
||||||
'PGPKey',
|
'PGPKey',
|
||||||
'PGPKeyring',
|
'PGPKeyring',
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
"""_author.py
|
|
||||||
|
|
||||||
Canonical location for authorship information
|
|
||||||
__version__ is a PEP-386 compliant version string,
|
|
||||||
making use of distutils.version.LooseVersion
|
|
||||||
"""
|
|
||||||
|
|
||||||
from distutils.version import LooseVersion
|
|
||||||
|
|
||||||
__all__ = ['__author__',
|
|
||||||
'__copyright__',
|
|
||||||
'__license__',
|
|
||||||
'__version__']
|
|
||||||
|
|
||||||
__author__ = "Michael Greene"
|
|
||||||
__copyright__ = "Copyright (c) 2014-2021 Security Innovation, Inc"
|
|
||||||
__license__ = "BSD"
|
|
||||||
__version__ = str(LooseVersion("0.6.0-dev"))
|
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = PGPy
|
name = PGPy
|
||||||
|
version = 0.6.0-dev
|
||||||
|
author = Michael Greene
|
||||||
author_email = mgreene@securityinnovation.com
|
author_email = mgreene@securityinnovation.com
|
||||||
maintainer = Security Innovation
|
maintainer = Security Innovation
|
||||||
maintainer_email = opensource@securityinnovation.com
|
maintainer_email = opensource@securityinnovation.com
|
||||||
|
license = BSD
|
||||||
description = Pretty Good Privacy for Python
|
description = Pretty Good Privacy for Python
|
||||||
keywords = OpenPGP, PGP, Pretty Good Privacy, GPG, GnuPG, openpgp, pgp, gnupg, gpg, encryption, signature
|
keywords = OpenPGP, PGP, Pretty Good Privacy, GPG, GnuPG, openpgp, pgp, gnupg, gpg, encryption, signature
|
||||||
url = https://github.com/SecurityInnovation/PGPy
|
url = https://github.com/SecurityInnovation/PGPy
|
||||||
|
|||||||
40
setup.py
40
setup.py
@@ -1,41 +1,3 @@
|
|||||||
import ast
|
|
||||||
import os.path
|
|
||||||
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
|
setup()
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
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 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__"],
|
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user