Browse Source

sg_mbp_release now accepts dev version identifier

master
Holger Frey 4 years ago
parent
commit
7c1d2ae138
  1. 1
      work_helpers/excel2markdown.py
  2. 25
      work_helpers/sg_mbp_release.py

1
work_helpers/excel2markdown.py

@ -2,6 +2,7 @@
import click import click
import pyperclip import pyperclip
def split_table(text): def split_table(text):
rows = [] rows = []
for line in text.splitlines(): for line in text.splitlines():

25
work_helpers/sg_mbp_release.py

@ -102,28 +102,29 @@ def create_changelog_entry(new_version, parent=PATH_ISSUES):
fh.write(CRLF.join(content)) fh.write(CRLF.join(content))
def copy_changelog(destination, latest): def copy_changelog(destination, release_version):
textfiles = _files_in_folder(PATH_ISSUES, ".txt") textfiles = _files_in_folder(PATH_ISSUES, ".txt")
changelog = next(f for f in textfiles if f.stem.lower().startswith("change")) changelog = next(f for f in textfiles if f.stem.lower().startswith("change"))
new_path = destination / f"CHANGELOG {latest}.txt" new_path = destination / f"CHANGELOG {release_version}.txt"
print(changelog.name, "->", new_path) print(changelog.name, "->", new_path)
shutil.copyfile(changelog, new_path) shutil.copyfile(changelog, new_path)
def copy_workbook_changelogs(destination, latest): def copy_workbook_changelogs(destination, latest, release_version):
source = PATH_ISSUES / latest source = PATH_ISSUES / latest
textfiles = _files_in_folder(source, ".txt") textfiles = _files_in_folder(source, ".txt")
logs = (f for f in textfiles if f.stem.lower().startswith("change")) logs = (f for f in textfiles if f.stem.lower().startswith("change"))
for log_file in logs: for log_file in logs:
new_path = destination / log_file.name new_name = log_file.name.replace(latest, release_version)
new_path = destination / new_name
print(log_file.name, "->", new_path) print(log_file.name, "->", new_path)
shutil.copyfile(log_file, new_path) shutil.copyfile(log_file, new_path)
def copy_workbooks(destination, latest): def copy_workbooks(destination, release_version):
for excel_file in _files_in_folder(PATH_WORKBOOKS, ".xlsx"): for excel_file in _files_in_folder(PATH_WORKBOOKS, ".xlsx"):
new_name = WORKBOOKS_MAP[excel_file.name] new_name = WORKBOOKS_MAP[excel_file.name]
new_path = destination / new_name.format(version=latest) new_path = destination / new_name.format(version=release_version)
print(excel_file.name, "->", new_path) print(excel_file.name, "->", new_path)
shutil.copyfile(excel_file, new_path) shutil.copyfile(excel_file, new_path)
@ -150,7 +151,8 @@ def sg_mbp_new_version(version):
@click.command() @click.command()
def sg_mbp_release(): @click.option("-d", "--dev_version", prompt=True, required=True, default="")
def sg_mbp_release(dev_version):
""" """
Before running this command: Before running this command:
@ -163,14 +165,15 @@ def sg_mbp_release():
The command will collect all data into one folder on the Desktop to be published The command will collect all data into one folder on the Desktop to be published
""" """
latest = get_latest_version() latest = get_latest_version()
release_version = f"{latest}{dev_version}"
new_folder_name = f"{TODAY} {latest}" new_folder_name = f"{TODAY} {release_version}"
new_folder_path = PATH_WIN_DESKTOP / new_folder_name new_folder_path = PATH_WIN_DESKTOP / new_folder_name
if new_folder_path.exists(): if new_folder_path.exists():
raise IOError(f"Folder exists on desktop: {new_folder_name}") raise IOError(f"Folder exists on desktop: {new_folder_name}")
else: else:
new_folder_path.mkdir() new_folder_path.mkdir()
copy_workbooks(new_folder_path, latest) copy_workbooks(new_folder_path, release_version)
copy_workbook_changelogs(new_folder_path, latest) copy_workbook_changelogs(new_folder_path, latest, release_version)
copy_changelog(new_folder_path, latest) copy_changelog(new_folder_path, release_version)

Loading…
Cancel
Save