edx-oauth2-wordpress-backend/setup.py

90 lines
2.6 KiB
Python
Raw Normal View History

2022-10-03 19:46:35 +03:00
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=C0111,W6005,W6100
import os
2022-10-03 20:07:35 +03:00
import io
from setuptools import find_packages, setup
2022-10-03 19:46:35 +03:00
2022-10-03 20:07:35 +03:00
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
2022-10-03 19:46:35 +03:00
2022-10-03 20:07:35 +03:00
HERE = os.path.abspath(os.path.dirname(__file__))
2022-10-03 19:46:35 +03:00
2022-10-03 20:07:35 +03:00
def load_readme():
with io.open(os.path.join(HERE, "README.md"), "rt", encoding="utf8") as f:
return f.read()
def load_about():
about = {}
with io.open(
2022-10-03 20:15:26 +03:00
os.path.join(HERE, "wp_oauth_backend", "__about__.py"),
2022-10-03 20:07:35 +03:00
"rt",
encoding="utf-8",
) as f:
exec(f.read(), about) # pylint: disable=exec-used
return about
def load_requirements(*requirements_paths):
2022-10-03 19:46:35 +03:00
"""
2022-10-03 20:07:35 +03:00
Load all requirements from the specified requirements files.
Returns:
list: Requirements file relative path strings
2022-10-03 19:46:35 +03:00
"""
2022-10-03 20:07:35 +03:00
requirements = set()
for path in requirements_paths:
requirements.update(
line.split("#")[0].strip() for line in open(path).readlines() if is_requirement(line.strip())
)
return list(requirements)
2022-10-03 19:46:35 +03:00
2022-10-03 20:07:35 +03:00
def is_requirement(line):
"""
Return True if the requirement line is a package requirement.
Returns:
bool: True if the line is not blank, a comment, a URL, or an included file
"""
return not (
line == ""
or line.startswith("-c")
or line.startswith("-r")
or line.startswith("#")
or line.startswith("-e")
or line.startswith("git+")
)
2022-10-03 19:46:35 +03:00
2022-10-03 20:07:35 +03:00
README = load_readme()
ABOUT = load_about()
VERSION = ABOUT["__version__"]
2022-10-03 19:46:35 +03:00
setup(
2022-10-03 20:53:02 +03:00
name='wp-oauth-backend',
2022-10-03 19:46:35 +03:00
version=VERSION,
description=('An OAuth backend for the WP OAuth Plugin, '
'mostly used for Open edX but can be used elsewhere.'),
long_description=README,
author='Lawrence McDaniel, lpm0073@gmail.com',
author_email='lpm0073@gmail.com',
2022-10-03 20:15:26 +03:00
url='https://github.com/StepwiseMath/wp-oauth-backend',
2022-10-03 20:07:35 +03:00
project_urls={
2022-10-03 20:15:26 +03:00
"Code": "https://github.com/StepwiseMath/wp-oauth-backend",
"Issue tracker": "https://github.com/StepwiseMath/wp-oauth-backend/issues",
2022-10-03 20:07:35 +03:00
"Community": "https://stepwisemath.ai",
},
2022-10-03 19:46:35 +03:00
packages=[
2022-10-03 20:15:26 +03:00
'wp_oauth_backend',
2022-10-03 19:46:35 +03:00
],
2022-10-03 20:07:35 +03:00
packages=find_packages(),
2022-10-03 19:46:35 +03:00
include_package_data=True,
2022-10-03 20:15:26 +03:00
package_data={"": ["*.html"]}, # include any templates found in this repo.
2022-10-03 19:46:35 +03:00
zip_safe=False,
keywords='WP OAuth',
2022-10-03 20:07:35 +03:00
python_requires=">=3.7",
install_requires=load_requirements("stable-psa.txt"),
2022-10-03 19:46:35 +03:00
classifiers=[
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
],
)