Skip to content

Commit

Permalink
updated setup.py
Browse files Browse the repository at this point in the history
- necessary to keep relative banner path in README (in repo)
- and absolute path for PyPI
  • Loading branch information
sugatoray committed Jan 13, 2022
1 parent 0562590 commit 61b17d6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
BANNER_PATH_PAT = re.compile(BANNER_PATH_PAT)
CONTENT_PATH_PREFIX = r"https://raw.githubusercontent.com/sugatoray/genespeak/master/"

def update_banner_path(readme_path: str="README.md") -> str:

def update_banner_path(readme_path: str = "README.md") -> str:
"""Converts the relative path of the banner into a parmalink.
The banner is made avilable in the readme file as follows:
--------------------------------------------------------------
Expand All @@ -29,7 +30,7 @@ def update_banner_path(readme_path: str="README.md") -> str:

text = pathlib.Path("README.md").read_text()
res = BANNER_PATH_PAT.search(text)
replace_with = CONTENT_PATH_PREFIX + BANNER_PATH_PAT.search(text).groupdict().get("path")
replace_with = r"[#repo-banner]: " + CONTENT_PATH_PREFIX + res.groupdict().get("path") + '\n\n'
mod_text = BANNER_PATH_PAT.sub(replace_with, text)

return mod_text
Expand Down

0 comments on commit 61b17d6

Please sign in to comment.