Skip to content

Commit 5b2bc33

Browse files
committed
Converts to about.py file strategy for metadata.
1 parent 59376aa commit 5b2bc33

File tree

4 files changed

+27
-23
lines changed

4 files changed

+27
-23
lines changed

mwoauth/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
"""Provides a collection of utilities for easily working with MediaWiki's
22
OAuth1.0a implementation."""
3-
from .version import __version__
43
from .handshaker import Handshaker
54
from .tokens import AccessToken, ConsumerToken, RequestToken
65
from .functions import initiate, complete, identify
6+
from .about import (__name__, __version__, __author__, __author_email__,
7+
__description__, __license__, __url__)
8+
79

810
__all__ = [
9-
__version__,
1011
AccessToken,
1112
complete,
1213
ConsumerToken,
1314
Handshaker,
1415
identify,
1516
initiate,
1617
RequestToken,
18+
__name__, __version__, __author__, __author_email__,
19+
__description__, __license__, __url__
1720
]

mwoauth/about.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
__name__ = "mwoauth"
2+
__version__ = "0.2.8"
3+
__author__ = "Aaron Halfaker / Filippo Valsorda"
4+
__author_email__ = "[email protected]"
5+
__description__ = "A generic MediaWiki OAuth handshake helper."
6+
__license__ = "MIT"
7+
__url__ = "https://github.com/mediawiki-utilities/python-mwoauth"
8+
9+
all = [__name__, __version__, __author__, __author_email__, __description__,
10+
__license__, __url__]

mwoauth/version.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

setup.py

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,23 @@
11
import os
2-
from setuptools import setup, find_packages
2+
3+
from setuptools import find_packages, setup
34

45

56
def read(fname):
67
return open(os.path.join(os.path.dirname(__file__), fname)).read()
78

8-
9-
def requirements(fname):
10-
for line in open(os.path.join(os.path.dirname(__file__), fname)):
11-
yield line.strip()
9+
about_path = os.path.join(os.path.dirname(__file__), "mwoauth/about.py")
10+
exec(compile(open(about_path).read(), about_path, "exec"))
1211

1312

14-
# Read version from file shared with the module using technique from
15-
# https://python-packaging-user-guide.readthedocs.io/en/latest/single_source_version/
16-
base_dir = os.path.dirname(__file__)
17-
version = {}
18-
with open(os.path.join(base_dir, 'mwoauth', 'version.py')) as fp:
19-
exec(fp.read(), version)
20-
2113
setup(
22-
name="mwoauth",
23-
version=version['__version__'],
24-
author="Aaron Halfaker / Filippo Valsorda",
25-
author_email="[email protected]",
26-
description=("A generic MediaWiki OAuth handshake helper."),
27-
license="MIT",
28-
url="https://github.com/halfak/MediaWiki-OAuth",
14+
name=__name__, # noqa
15+
version=__version__, # noqa
16+
author=__author__, # noqa
17+
author_email=__author_email__, # noqa
18+
description=__description__, # noqa
19+
url=__url__, # noqa
20+
license=__license__, # noqa
2921
packages=find_packages(),
3022
long_description=read('README.rst'),
3123
install_requires=[
@@ -40,5 +32,5 @@ def requirements(fname):
4032
"Topic :: Security",
4133
"License :: OSI Approved :: MIT License",
4234
"Topic :: Software Development :: Libraries :: Python Modules"
43-
],
35+
]
4436
)

0 commit comments

Comments
 (0)