-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathsetup.py
36 lines (27 loc) · 861 Bytes
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import os
import re
from pathlib import Path
from setuptools import setup
def fixed_readme() -> str:
"""
Fix things in the README for PyPI
"""
readme = Path("README.md").read_text()
# Remove the PYPI_REMOVE tags
readme = re.sub(
r"<!--\s*PYPI_REMOVE\s*-->((?!PYPI_REMOVE).)*<!--\s*/PYPI_REMOVE\s*-->",
"",
readme,
flags=re.MULTILINE | re.DOTALL,
)
# Git hash of the commit tagged with the current version. Set by Makefile.
revup_version_hash = os.environ.get("REVUP_VERSION_HASH", "main")
# Replace relative links with absolute, so images appear correctly on PyPI
readme = readme.replace(
"docs/images/",
f"https://raw.githubusercontent.com/skydio/revup/{revup_version_hash}/docs/images/",
)
return readme
setup(
long_description=fixed_readme(),
)