2019-01-22 20:25:04 +00:00
|
|
|
import io
|
|
|
|
import os
|
2021-11-23 08:25:09 +00:00
|
|
|
from typing import Dict, List
|
2019-01-22 20:25:04 +00:00
|
|
|
|
2022-01-08 17:57:57 +00:00
|
|
|
from setuptools import find_packages, setup
|
|
|
|
|
2020-11-11 09:36:42 +00:00
|
|
|
HERE = os.path.abspath(os.path.dirname(__file__))
|
2019-01-22 20:25:04 +00:00
|
|
|
|
|
|
|
|
2021-11-23 08:25:09 +00:00
|
|
|
def load_readme() -> str:
|
2020-11-11 09:36:42 +00:00
|
|
|
with io.open(os.path.join(HERE, "README.rst"), "rt", encoding="utf8") as f:
|
2021-06-25 14:52:05 +00:00
|
|
|
readme = f.read()
|
|
|
|
# Replace img src for publication on pypi
|
2021-10-18 09:43:40 +00:00
|
|
|
return readme.replace(
|
|
|
|
"./docs/img/", "https://github.com/overhangio/tutor/raw/master/docs/img/"
|
|
|
|
)
|
2020-11-11 09:36:42 +00:00
|
|
|
|
|
|
|
|
2021-11-23 08:25:09 +00:00
|
|
|
def load_about() -> Dict[str, str]:
|
|
|
|
about: Dict[str, str] = {}
|
2020-11-11 09:36:42 +00:00
|
|
|
with io.open(
|
|
|
|
os.path.join(HERE, "tutor", "__about__.py"), "rt", encoding="utf-8"
|
|
|
|
) as f:
|
|
|
|
exec(f.read(), about) # pylint: disable=exec-used
|
|
|
|
return about
|
|
|
|
|
|
|
|
|
2021-11-23 08:25:09 +00:00
|
|
|
def load_requirements(filename: str) -> List[str]:
|
2020-11-11 09:36:42 +00:00
|
|
|
with io.open(
|
2021-10-18 09:43:40 +00:00
|
|
|
os.path.join(HERE, "requirements", filename), "rt", encoding="utf-8"
|
2020-11-11 09:36:42 +00:00
|
|
|
) as f:
|
|
|
|
return [line.strip() for line in f if is_requirement(line)]
|
|
|
|
|
2022-01-08 17:57:57 +00:00
|
|
|
|
2021-11-23 08:25:09 +00:00
|
|
|
def is_requirement(line: str) -> bool:
|
2020-11-11 09:36:42 +00:00
|
|
|
return not (line.strip() == "" or line.startswith("#"))
|
|
|
|
|
|
|
|
|
|
|
|
ABOUT = load_about()
|
Fix version information in bundle
`./dist/tutor --version` raises an error:
Traceback (most recent call last):
File "main", line 4, in <module>
File "tutor/cli.py", line 21, in main
File "click/core.py", line 764, in __call__
File "click/core.py", line 716, in main
File "click/core.py", line 641, in make_context
File "click/core.py", line 1089, in parse_args
File "click/core.py", line 940, in parse_args
File "click/core.py", line 1477, in handle_parse_result
File "click/core.py", line 96, in invoke_param_callback
File "click/decorators.py", line 270, in callback
RuntimeError: Could not determine version
[1659] Failed to execute script main
To address this, we pass the version value directly to click.
This is for issue #156.
2019-02-10 17:31:48 +00:00
|
|
|
|
2019-01-22 20:25:04 +00:00
|
|
|
setup(
|
2021-06-25 15:03:43 +00:00
|
|
|
name="tutor",
|
2022-03-31 13:36:30 +00:00
|
|
|
version=ABOUT["__package_version__"],
|
2019-02-20 12:52:25 +00:00
|
|
|
url="https://docs.tutor.overhang.io/",
|
2019-01-22 20:25:04 +00:00
|
|
|
project_urls={
|
2019-02-20 12:52:25 +00:00
|
|
|
"Documentation": "https://docs.tutor.overhang.io/",
|
2019-06-23 17:56:15 +00:00
|
|
|
"Code": "https://github.com/overhangio/tutor",
|
|
|
|
"Issue tracker": "https://github.com/overhangio/tutor/issues",
|
2019-02-20 12:52:25 +00:00
|
|
|
"Community": "https://discuss.overhang.io",
|
2019-01-22 20:25:04 +00:00
|
|
|
},
|
|
|
|
license="AGPLv3",
|
2019-06-23 18:03:19 +00:00
|
|
|
author="Overhang.io",
|
|
|
|
author_email="contact@overhang.io",
|
2021-06-25 15:03:43 +00:00
|
|
|
description="The Docker-based Open edX distribution designed for peace of mind",
|
2020-11-11 09:36:42 +00:00
|
|
|
long_description=load_readme(),
|
2019-09-23 09:36:21 +00:00
|
|
|
long_description_content_type="text/x-rst",
|
2019-06-23 11:23:27 +00:00
|
|
|
packages=find_packages(exclude=["tests*"]),
|
2019-08-31 10:27:56 +00:00
|
|
|
include_package_data=True,
|
2021-11-30 09:47:08 +00:00
|
|
|
python_requires=">=3.6",
|
2021-10-18 09:43:40 +00:00
|
|
|
install_requires=load_requirements("base.in"),
|
|
|
|
extras_require={
|
|
|
|
"full": load_requirements("plugins.txt"),
|
|
|
|
},
|
2019-08-20 15:01:34 +00:00
|
|
|
entry_points={"console_scripts": ["tutor=tutor.commands.cli:main"]},
|
2019-01-22 20:25:04 +00:00
|
|
|
classifiers=[
|
|
|
|
"Development Status :: 5 - Production/Stable",
|
|
|
|
"Intended Audience :: Developers",
|
|
|
|
"License :: OSI Approved :: GNU Affero General Public License v3",
|
|
|
|
"Operating System :: OS Independent",
|
|
|
|
"Programming Language :: Python",
|
|
|
|
"Programming Language :: Python :: 3.6",
|
|
|
|
"Programming Language :: Python :: 3.7",
|
2020-09-04 09:07:34 +00:00
|
|
|
"Programming Language :: Python :: 3.8",
|
2020-10-15 14:45:43 +00:00
|
|
|
"Programming Language :: Python :: 3.9",
|
|
|
|
"Programming Language :: Python :: 3.10",
|
2019-01-22 20:25:04 +00:00
|
|
|
],
|
2021-11-23 08:25:09 +00:00
|
|
|
test_suite="tests",
|
2019-01-22 20:25:04 +00:00
|
|
|
)
|