Skip to content

Commit f90860e

Browse files
(DOCSP-26328): Migrate changelog script from Python 2 to Python 3 (#2116)
* (DOCSP-26328): Migrate changelog script from Python 2 to Python 3 (#2113) * update Makefile command and requirements filename (#2114)
1 parent a4a305f commit f90860e

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,4 @@ examples:
182182
curl -SfL https://raw.githubusercontent.com/mongodb/mongo-swift-driver/master/Examples/Docs/Sources/SyncExamples/main.swift -o ${DRIVERS_PATH}/swiftSync.swift
183183

184184
changelogs:
185-
python changelogs/generatechangelogs.py
185+
python3 changelogs/generatechangelogs.py

changelogs/generatechangelogs.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ def get_issue_structure(config, issues, version):
9494
# format issue summary to remove backticks
9595
# (necessary for next-gen)
9696

97-
issue_summary = issue.fields.summary.encode("utf-8").replace('`', '')
97+
issue_summary = issue.fields.summary.replace('`', '')
9898

99-
issue_pair = (issue.key.encode("utf-8"), issue_summary)
99+
issue_pair = (issue.key, issue_summary)
100100

101101
if len(components) == 0:
102102
# if there isn't a component put this in the last grouping.
@@ -169,11 +169,11 @@ def generate_changelog_rst(config, headings, fixVersion):
169169

170170
if len(issues) == 1:
171171
r.content("{1} {0}".format(issues[0][1], r.role(
172-
"issue", issues[0][0])), wrap=False)
172+
"issue", issues[0][0])))
173173
else:
174174
for issue in issues:
175175
r.li("{1} {0}".format(issue[1], r.role(
176-
"issue", issue[0])), wrap=False)
176+
"issue", issue[0])))
177177
r.newline()
178178

179179
# repeat the above formatting with minor variations to do the nesting.
@@ -190,11 +190,11 @@ def generate_changelog_rst(config, headings, fixVersion):
190190
sub_issues = headings[sub]
191191
if len(sub_issues) == 0:
192192
r.content("{1} {0}".format(sub_issues[0][1].strip(), r.role(
193-
"issue", sub_issues[0][0])), wrap=False)
193+
"issue", sub_issues[0][0])))
194194
else:
195195
for issue in sub_issues:
196196
r.li("{1} {0}".format(issue[1].strip(), r.role(
197-
"issue", issue[0])), wrap=False)
197+
"issue", issue[0])))
198198
r.newline()
199199

200200
return r
@@ -207,18 +207,19 @@ def write_changelog_file(rst, fixVersion):
207207
fn = fixVersion + ".rst"
208208
outputDir = os.path.join(
209209
sourceDir, "source/includes/changelogs/releases", fn)
210-
rst.write(outputDir)
211-
logger.info(
212-
"wrote changelog '{0}'. Commit this file independently.".format(outputDir))
213210

214-
print(
215-
"wrote changelog '{0}'. Commit this file independently.".format(outputDir))
211+
with open (outputDir, 'w') as f:
212+
f.write(str(rst))
216213

214+
logger.info(
215+
"wrote changelog '{0}'. Commit this file independently.".format(outputDir))
217216

217+
print(
218+
"wrote changelog '{0}'. Commit this file independently.".format(outputDir))
218219

219220
def main():
220221
# Prompt user for the version to generate the changelog for:
221-
fixVersion = raw_input("Enter changelog version: ")
222+
fixVersion = input("Enter changelog version: ")
222223

223224
# Get list of JIRA issues to include in changelog
224225
issues = get_jira_issues(fixVersion)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
###### Requirements without Version Specifiers ######
2+
3+
cryptography
4+
jira
5+
PyJWT
6+
rstcloth

config/changelog_conf.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ groups:
66
"Security":
77
- Security
88
- Queryable Encryption
9+
- Field Level Encryption
910
"Sharding":
1011
- Sharding
1112
"Replication":

0 commit comments

Comments
 (0)