Skip to content

Commit

Permalink
fix broken packaging in github action
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwojcik committed Jun 28, 2021
1 parent 72a6203 commit 6638504
Showing 1 changed file with 29 additions and 9 deletions.
38 changes: 29 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,53 @@

import setuptools

from starlette_context import __author__, __version__ # noqa
import os
import re


PKG_NAME = "starlette_context"

HERE = os.path.abspath(os.path.dirname(__file__))

PATTERN = r'^{target}\s*=\s*([\'"])(.+)\1$'

AUTHOR_RE = re.compile(PATTERN.format(target="__author__"), re.M)
VERSION_RE = re.compile(PATTERN.format(target="__version__"), re.M)


def parse_init():
with open(os.path.join(HERE, PKG_NAME, "__init__.py")) as f:
file_data = f.read()
return [
regex.search(file_data).group(2) for regex in (AUTHOR_RE, VERSION_RE)
]


def get_long_description():
with open("README.md", "r", encoding="utf8") as f:
return f.read()


AUTHOR, VERSION = parse_init()


setup(
name="starlette_context",
name=PKG_NAME,
python_requires=">=3.7",
version=__version__,
version=VERSION,
license="MIT",
description="Access context in Starlette",
long_description=get_long_description(),
long_description_content_type="text/markdown",
packages=setuptools.find_packages(
include=("starlette_context", "starlette_context.*")
),
packages=setuptools.find_packages(include=(PKG_NAME, f"{PKG_NAME}.*")),
package_data={
"starlette_context": ["py.typed"],
PKG_NAME: ["py.typed"],
},
platforms="any",
author=__author__,
author=AUTHOR,
url="https://github.com/tomwojcik/starlette-context",
download_url="https://github.com/tomwojcik/starlette-context/"
f"archive/{__version__}.tar.gz",
f"archive/{VERSION}.tar.gz",
keywords=["starlette", "fastapi"],
install_requires="starlette",
classifiers=[
Expand Down

0 comments on commit 6638504

Please sign in to comment.