2023-06-29 16:30:34 -04:00
|
|
|
"""Sets up the project."""
|
2021-07-29 02:26:34 +02:00
|
|
|
|
2022-12-05 19:56:00 +08:00
|
|
|
import pathlib
|
2016-04-27 08:00:58 -07:00
|
|
|
|
2022-12-05 19:56:00 +08:00
|
|
|
from setuptools import setup
|
2022-10-14 13:51:58 +01:00
|
|
|
|
2022-12-05 19:56:00 +08:00
|
|
|
|
|
|
|
CWD = pathlib.Path(__file__).absolute().parent
|
2022-10-14 11:37:24 +01:00
|
|
|
|
2022-10-14 13:51:58 +01:00
|
|
|
|
2022-10-14 11:37:24 +01:00
|
|
|
def get_version():
|
2022-10-14 13:51:58 +01:00
|
|
|
"""Gets the gymnasium version."""
|
2022-12-05 19:56:00 +08:00
|
|
|
path = CWD / "gymnasium" / "__init__.py"
|
|
|
|
content = path.read_text()
|
2022-10-14 13:51:58 +01:00
|
|
|
|
2022-12-05 19:56:00 +08:00
|
|
|
for line in content.splitlines():
|
2022-10-14 13:51:58 +01:00
|
|
|
if line.startswith("__version__"):
|
|
|
|
return line.strip().split()[-1].strip().strip('"')
|
|
|
|
raise RuntimeError("bad version data in __init__.py")
|
|
|
|
|
2016-04-27 08:00:58 -07:00
|
|
|
|
2023-01-06 22:11:11 +00:00
|
|
|
def get_description():
|
|
|
|
"""Gets the description from the readme."""
|
|
|
|
with open("README.md") as fh:
|
|
|
|
long_description = ""
|
|
|
|
header_count = 0
|
|
|
|
for line in fh:
|
|
|
|
if line.startswith("##"):
|
|
|
|
header_count += 1
|
|
|
|
if header_count < 2:
|
|
|
|
long_description += line
|
|
|
|
else:
|
|
|
|
break
|
|
|
|
return long_description
|
|
|
|
|
|
|
|
|
|
|
|
setup(name="gymnasium", version=get_version(), long_description=get_description())
|