Skip to content

Commit bbc36d5

Browse files
BUG#37453587: Github links in PyPI project's pages do not work
Fixed the links displayed in the PyPI project pages that are meant to open metadata files in GitHub such as LICENSE.txt. Change-Id: I53ecacb3f70f9e86920aeef5d87d5848e7981513
1 parent e271035 commit bbc36d5

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

CHANGES.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@ MySQL Connector/Python - Release Notes & Changes
33
====================================================
44

55
MySQL Connector/Python
6-
Copyright (c) 2009, 2024, Oracle and/or its affiliates.
6+
Copyright (c) 2009, 2025, Oracle and/or its affiliates.
77

88
Full release notes:
99
http://dev.mysql.com/doc/relnotes/connector-python/en/
1010

11+
v9.3.0
12+
======
13+
14+
- BUG#37453587: Github links in PyPI project's pages do not work
15+
1116
v9.2.0
1217
======
1318

mysql-connector-python/setup.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
# Copyright (c) 2009, 2024, Oracle and/or its affiliates.
4+
# Copyright (c) 2009, 2025, Oracle and/or its affiliates.
55
#
66
# This program is free software; you can redistribute it and/or modify
77
# it under the terms of the GNU General Public License, version 2.0, as
@@ -48,6 +48,7 @@
4848
except ImportError:
4949
DistWheel = None
5050

51+
GITHUB_URL = "https://github.com/mysql/mysql-connector-python"
5152
METADATA_FILES = (
5253
"README.txt",
5354
"README.rst",
@@ -116,7 +117,7 @@ def main() -> None:
116117
"Documentation": "https://dev.mysql.com/doc/connector-python/en/",
117118
"Downloads": "https://dev.mysql.com/downloads/connector/python/",
118119
"Release Notes": "https://dev.mysql.com/doc/relnotes/connector-python/en/",
119-
"Source Code": "https://github.com/mysql/mysql-connector-python",
120+
"Source Code": GITHUB_URL,
120121
"Bug System": "https://bugs.mysql.com/",
121122
"Slack": "https://mysqlcommunity.slack.com/messages/connectors",
122123
"Forums": "https://forums.mysql.com/list.php?50",
@@ -201,6 +202,11 @@ def get_long_description() -> str:
201202
if repl_name == "repl" or repl_name.endswith("mysql"):
202203
block_text = block_text.replace(repl_source, repl_target)
203204
long_description = long_description.replace(block_match.group(), block_text)
205+
# Make replacements for files that are directly accessible within GitHub but not within PyPI
206+
files_regex_fragment = "|".join(mf.replace(".", r"\.") for mf in METADATA_FILES)
207+
long_description = re.sub(pattern=rf"\<(?P<file_name>{files_regex_fragment})\>",
208+
repl=f"<{GITHUB_URL}/blob/trunk/\g<file_name>>",
209+
string=long_description)
204210
return long_description
205211

206212

mysqlx-connector-python/setup.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
# Copyright (c) 2009, 2024, Oracle and/or its affiliates.
4+
# Copyright (c) 2009, 2025, Oracle and/or its affiliates.
55
#
66
# This program is free software; you can redistribute it and/or modify
77
# it under the terms of the GNU General Public License, version 2.0, as
@@ -49,6 +49,7 @@
4949
DistWheel = None
5050

5151

52+
GITHUB_URL = "https://github.com/mysql/mysql-connector-python"
5253
METADATA_FILES = (
5354
"README.txt",
5455
"README.rst",
@@ -128,7 +129,7 @@ def main() -> None:
128129
"Documentation": "https://dev.mysql.com/doc/connector-python/en/",
129130
"Downloads": "https://dev.mysql.com/downloads/connector/python/",
130131
"Release Notes": "https://dev.mysql.com/doc/relnotes/connector-python/en/",
131-
"Source Code": "https://github.com/mysql/mysql-connector-python",
132+
"Source Code": GITHUB_URL,
132133
"Bug System": "https://bugs.mysql.com/",
133134
"Slack": "https://mysqlcommunity.slack.com/messages/connectors",
134135
"Forums": "https://forums.mysql.com/list.php?50",
@@ -208,6 +209,11 @@ def get_long_description() -> str:
208209
if repl_name == "repl" or repl_name.endswith("mysqlx"):
209210
block_text = block_text.replace(repl_source, repl_target)
210211
long_description = long_description.replace(block_match.group(), block_text)
212+
# Make replacements for files that are directly accessible within GitHub but not within PyPI
213+
files_regex_fragment = "|".join(mf.replace(".", r"\.") for mf in METADATA_FILES)
214+
long_description = re.sub(pattern=rf"\<(?P<file_name>{files_regex_fragment})\>",
215+
repl=f"<{GITHUB_URL}/blob/trunk/\g<file_name>>",
216+
string=long_description)
211217
return long_description
212218

213219

0 commit comments

Comments
 (0)