<reponame>loic-simon/lg-rez<filename>setup.py
import re
import setuptools


repo_url = "https://github.com/loic-simon/lg-rez"

version = ""
with open("lgrez/__init__.py") as f:
    version = re.search(r"""^__version__\s*=\s*['"](.*?)['"]""",
                        f.read(), re.MULTILINE).group(1)

assert version, "__version__ not found in __init__.py"


def absolute_links(string, base):
    """Replace all relative Markdown links by absolute links"""
    base = base.rstrip("/")
    return re.sub(
        r"\[(.+?)\]\(([^:]+?)\)",   # Every [text](link) without ":" in link
        f"[\\1]({base}/\\2)",       # Replace link by base/link
        string
    )

with open("README.md", "r", encoding="utf-8") as fh:
    readme = fh.read()

version_blob_url = f"{repo_url}/blob/{version}"
# Github blob URL for tag <version>
long_description = absolute_links(readme, version_blob_url)
# long_description is README.md contents with relative links to project
# files/folders converted into links to files on GitHub blob, so they
# can be clicked on PyPI.


with open("requirements.txt", "r", encoding="utf-8") as fh:
    requirements = fh.readlines()


setuptools.setup(
    name="lg-rez",
    version=version,
    author="<NAME>, <NAME>",
    author_email="<EMAIL>, <EMAIL>",
    description="Discord bot for organizing Werewolf RP games ESPCI-style",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url=repo_url,
    packages=setuptools.find_packages(),
    classifiers=[
        "Development Status :: 5 - Production/Stable",
        "Framework :: AsyncIO",
        "Intended Audience :: Developers",
        "Natural Language :: French",
        "Programming Language :: Python :: 3.8",
        "Programming Language :: Python :: 3.9",
        "Programming Language :: Python :: 3.10",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
        "Topic :: Games/Entertainment :: Role-Playing",
        "Topic :: Internet",
    ],
    install_requires=requirements,
    python_requires='>=3.8',
)

import re
import setuptools


repo_url = "https://github.com/loic-simon/lg-rez"

version = ""
with open("lgrez/__init__.py") as f:
    version = re.search(r"""^__version__\s*=\s*['"](.*?)['"]""",
                        f.read(), re.MULTILINE).group(1)

assert version, "__version__ not found in __init__.py"


def absolute_links(string, base):
    """Replace all relative Markdown links by absolute links"""
    base = base.rstrip("/")
    return re.sub(
        r"\[(.+?)\]\(([^:]+?)\)",   # Every [text](link) without ":" in link
        f"[\\1]({base}/\\2)",       # Replace link by base/link
        string
    )

with open("README.md", "r", encoding="utf-8") as fh:
    readme = fh.read()

version_blob_url = f"{repo_url}/blob/{version}"
# Github blob URL for tag <version>
long_description = absolute_links(readme, version_blob_url)
# long_description is README.md contents with relative links to project
# files/folders converted into links to files on GitHub blob, so they
# can be clicked on PyPI.


with open("requirements.txt", "r", encoding="utf-8") as fh:
    requirements = fh.readlines()


setuptools.setup(
    name="lg-rez",
    version=version,
    author="<NAME>, <NAME>",
    author_email="<EMAIL>, <EMAIL>",
    description="Discord bot for organizing Werewolf RP games ESPCI-style",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url=repo_url,
    packages=setuptools.find_packages(),
    classifiers=[
        "Development Status :: 5 - Production/Stable",
        "Framework :: AsyncIO",
        "Intended Audience :: Developers",
        "Natural Language :: French",
        "Programming Language :: Python :: 3.8",
        "Programming Language :: Python :: 3.9",
        "Programming Language :: Python :: 3.10",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
        "Topic :: Games/Entertainment :: Role-Playing",
        "Topic :: Internet",
    ],
    install_requires=requirements,
    python_requires='>=3.8',
)
^__version__\s*=\s*['"](.*?)['"] Replace all relative Markdown links by absolute links # Every [text](link) without ":" in link # Replace link by base/link # Github blob URL for tag <version> # long_description is README.md contents with relative links to project # files/folders converted into links to files on GitHub blob, so they # can be clicked on PyPI.