Skip to content

Commit

Permalink
(DOCSP-26328): Migrate changelog script from Python 2 to Python 3 (#2116
Browse files Browse the repository at this point in the history
)

* (DOCSP-26328): Migrate changelog script from Python 2 to Python 3 (#2113)

* update Makefile command and requirements filename (#2114)
  • Loading branch information
jeff-allen-mongo authored Nov 4, 2022
1 parent a4a305f commit f90860e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,4 @@ examples:
curl -SfL https://raw.githubusercontent.com/mongodb/mongo-swift-driver/master/Examples/Docs/Sources/SyncExamples/main.swift -o ${DRIVERS_PATH}/swiftSync.swift

changelogs:
python changelogs/generatechangelogs.py
python3 changelogs/generatechangelogs.py
25 changes: 13 additions & 12 deletions changelogs/generatechangelogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ def get_issue_structure(config, issues, version):
# format issue summary to remove backticks
# (necessary for next-gen)

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

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

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

if len(issues) == 1:
r.content("{1} {0}".format(issues[0][1], r.role(
"issue", issues[0][0])), wrap=False)
"issue", issues[0][0])))
else:
for issue in issues:
r.li("{1} {0}".format(issue[1], r.role(
"issue", issue[0])), wrap=False)
"issue", issue[0])))
r.newline()

# repeat the above formatting with minor variations to do the nesting.
Expand All @@ -190,11 +190,11 @@ def generate_changelog_rst(config, headings, fixVersion):
sub_issues = headings[sub]
if len(sub_issues) == 0:
r.content("{1} {0}".format(sub_issues[0][1].strip(), r.role(
"issue", sub_issues[0][0])), wrap=False)
"issue", sub_issues[0][0])))
else:
for issue in sub_issues:
r.li("{1} {0}".format(issue[1].strip(), r.role(
"issue", issue[0])), wrap=False)
"issue", issue[0])))
r.newline()

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

print(
"wrote changelog '{0}'. Commit this file independently.".format(outputDir))
with open (outputDir, 'w') as f:
f.write(str(rst))

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

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

def main():
# Prompt user for the version to generate the changelog for:
fixVersion = raw_input("Enter changelog version: ")
fixVersion = input("Enter changelog version: ")

# Get list of JIRA issues to include in changelog
issues = get_jira_issues(fixVersion)
Expand Down
6 changes: 6 additions & 0 deletions changelogs/requirements-changelogs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
###### Requirements without Version Specifiers ######

cryptography
jira
PyJWT
rstcloth
1 change: 1 addition & 0 deletions config/changelog_conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ groups:
"Security":
- Security
- Queryable Encryption
- Field Level Encryption
"Sharding":
- Sharding
"Replication":
Expand Down

0 comments on commit f90860e

Please sign in to comment.