|
|
@ -16,10 +16,10 @@ TODAY = datetime.now().strftime("%y%m%d") |
|
|
|
CRLF = "\r\n" |
|
|
|
CRLF = "\r\n" |
|
|
|
|
|
|
|
|
|
|
|
EXCEL_CHANGELOGS = { |
|
|
|
EXCEL_CHANGELOGS = { |
|
|
|
"changes_hyb_workbook": "J1", |
|
|
|
"changes mbp {version} hyb.txt": "J1", |
|
|
|
"changes_qc_cy5_workbook": "J1", |
|
|
|
"changes mbp {version} qc.txt": "J1", |
|
|
|
"changes_qc_dry_workbook": "L1", |
|
|
|
"changes mbp {version} dry.txt": "L1", |
|
|
|
"changes_qc_workbook": "J1", |
|
|
|
"changes mbp {version} reg.txt": "J1", |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
EXCEL_CHANGELOG_HEADERS = [ |
|
|
|
EXCEL_CHANGELOG_HEADERS = [ |
|
|
@ -28,6 +28,14 @@ EXCEL_CHANGELOG_HEADERS = [ |
|
|
|
"", |
|
|
|
"", |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WORKBOOKS_MAP = { |
|
|
|
|
|
|
|
"MBP Hyb.xlsx": "MBP {version} Hyb.xlsx", |
|
|
|
|
|
|
|
"MBP Reg.xlsx": "MBP {version} Reg.xlsx", |
|
|
|
|
|
|
|
"MBP QC.xlsx":"MBP {version} QC.xlsx", |
|
|
|
|
|
|
|
"MBP Dry.xlsx": "MBP {version} Dry.xlsx", |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _folder_content(folder): |
|
|
|
def _folder_content(folder): |
|
|
|
nondotted = (i for i in folder.iterdir() if not i.stem.startswith(".")) |
|
|
|
nondotted = (i for i in folder.iterdir() if not i.stem.startswith(".")) |
|
|
@ -71,7 +79,7 @@ def create_new_version_folder(new_version, parent=PATH_ISSUES): |
|
|
|
|
|
|
|
|
|
|
|
def create_excel_changelogs(new_version, parent): |
|
|
|
def create_excel_changelogs(new_version, parent): |
|
|
|
for name, cell in EXCEL_CHANGELOGS.items(): |
|
|
|
for name, cell in EXCEL_CHANGELOGS.items(): |
|
|
|
new_file = parent / f"{name}_{new_version}.txt" |
|
|
|
new_file = parent / name.format(version=new_version) |
|
|
|
with new_file.open("w") as fh: |
|
|
|
with new_file.open("w") as fh: |
|
|
|
data_line = "\t".join(["Settings", cell, new_version, ""]) |
|
|
|
data_line = "\t".join(["Settings", cell, new_version, ""]) |
|
|
|
content_lines = EXCEL_CHANGELOG_HEADERS + [data_line, "", ""] |
|
|
|
content_lines = EXCEL_CHANGELOG_HEADERS + [data_line, "", ""] |
|
|
@ -94,31 +102,28 @@ def create_changelog_entry(new_version, parent=PATH_ISSUES): |
|
|
|
fh.write(CRLF.join(content)) |
|
|
|
fh.write(CRLF.join(content)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def copy_changelog(destination, date, latest): |
|
|
|
def copy_changelog(destination, latest): |
|
|
|
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"{date}_CHANGELOG_{latest}.txt" |
|
|
|
new_path = destination / f"CHANGELOG {latest}.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, date, latest): |
|
|
|
def copy_workbook_changelogs(destination, latest): |
|
|
|
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: |
|
|
|
parts = log_file.stem.split("_") |
|
|
|
new_path = destination / log_file.name |
|
|
|
if parts[-1] == latest: |
|
|
|
|
|
|
|
new_path = destination / f"{date}_{log_file.name}" |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
new_path = destination / f"{date}_{log_file.stem}_{latest}.txt" |
|
|
|
|
|
|
|
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, date, latest): |
|
|
|
def copy_workbooks(destination, latest): |
|
|
|
for excel_file in _files_in_folder(PATH_WORKBOOKS, ".xlsx"): |
|
|
|
for excel_file in _files_in_folder(PATH_WORKBOOKS, ".xlsx"): |
|
|
|
new_path = destination / f"{date}_{excel_file.stem}_{latest}.xlsx" |
|
|
|
new_name = WORKBOOKS_MAP[excel_file.name] |
|
|
|
|
|
|
|
new_path = destination / new_name.format(version=latest) |
|
|
|
print(excel_file.name, "->", new_path) |
|
|
|
print(excel_file.name, "->", new_path) |
|
|
|
shutil.copyfile(excel_file, new_path) |
|
|
|
shutil.copyfile(excel_file, new_path) |
|
|
|
|
|
|
|
|
|
|
@ -166,6 +171,6 @@ def sg_mbp_release(): |
|
|
|
else: |
|
|
|
else: |
|
|
|
new_folder_path.mkdir() |
|
|
|
new_folder_path.mkdir() |
|
|
|
|
|
|
|
|
|
|
|
copy_workbooks(new_folder_path, TODAY, latest) |
|
|
|
copy_workbooks(new_folder_path, latest) |
|
|
|
copy_workbook_changelogs(new_folder_path, TODAY, latest) |
|
|
|
copy_workbook_changelogs(new_folder_path, latest) |
|
|
|
copy_changelog(new_folder_path, TODAY, latest) |
|
|
|
copy_changelog(new_folder_path, latest) |
|
|
|