Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf351d24

Browse files
committed
remove badges and strip links when generating PyPI package description
This is to avoid broken links in the PyPI project description (thatoccur because we avoid hardcoding the Github repository URLs in theREADME).
1 parent0028196 commitf351d24

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

‎setup.py‎

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
1-
frompathlibimportPath
2-
fromsetuptoolsimportsetup
1+
importre
32
importsdist_upip
3+
fromsetuptoolsimportsetup
44

5+
VERSION="1.0.0"
56

6-
HERE=Path(__file__).parent
7-
README= (HERE/'README.rst').read_text()
87

9-
VERSION="1.0.0"
8+
deflong_desc_from_readme():
9+
withopen('README.rst','r')asfd:
10+
long_description=fd.read()
11+
12+
# remove badges
13+
long_description=re.compile(r'^\.\. start-badges.*^\.\. end-badges',re.M|re.S).sub('',long_description)
14+
15+
# strip links. keep link name and use literal text formatting
16+
long_description=re.sub(r'`([^<`]+) </[^>]+>`_','``\\1``',long_description)
17+
18+
returnlong_description
19+
1020

1121
setup(
1222
name="micropython-py-esp32-ulp",
1323
version=VERSION,
1424
description="Assembler toolchain for the ESP32 ULP co-processor, written in MicroPython",
15-
long_description=README,
25+
long_description=long_desc_from_readme(),
1626
long_description_content_type='text/x-rst',
1727
url="https://github.com/ThomasWaldmann/py-esp32-ulp",
1828
license="MIT",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp