pkgmgr-kunrunic 0.1.1.dev2__tar.gz → 0.1.1.dev3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. {pkgmgr_kunrunic-0.1.1.dev2/pkgmgr_kunrunic.egg-info → pkgmgr_kunrunic-0.1.1.dev3}/PKG-INFO +1 -1
  2. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr/__init__.py +1 -1
  3. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr/cli.py +7 -2
  4. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr/release.py +4 -1
  5. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3/pkgmgr_kunrunic.egg-info}/PKG-INFO +1 -1
  6. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr_kunrunic.egg-info/SOURCES.txt +4 -0
  7. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr_kunrunic.egg-info/top_level.txt +2 -0
  8. pkgmgr_kunrunic-0.1.1.dev3/plugin/export_cksum.py +354 -0
  9. pkgmgr_kunrunic-0.1.1.dev3/plugin/export_source_review.py +490 -0
  10. pkgmgr_kunrunic-0.1.1.dev3/test_data_root/plugin/export_cksum.py +354 -0
  11. pkgmgr_kunrunic-0.1.1.dev3/test_data_root/plugin/export_source_review.py +490 -0
  12. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/tests/test_release.py +16 -0
  13. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/LICENSE +0 -0
  14. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/README.md +0 -0
  15. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr/__main__.py +0 -0
  16. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr/collectors/__init__.py +0 -0
  17. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr/collectors/base.py +0 -0
  18. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr/collectors/checksums.py +0 -0
  19. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr/config.py +0 -0
  20. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr/points.py +0 -0
  21. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr/shell_integration.py +0 -0
  22. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr/snapshot.py +0 -0
  23. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr/templates/pkg.yaml.sample +0 -0
  24. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr/templates/pkgmgr.yaml.sample +0 -0
  25. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr/watch.py +0 -0
  26. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr_kunrunic.egg-info/dependency_links.txt +0 -0
  27. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr_kunrunic.egg-info/entry_points.txt +0 -0
  28. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr_kunrunic.egg-info/not-zip-safe +0 -0
  29. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pkgmgr_kunrunic.egg-info/requires.txt +0 -0
  30. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/pyproject.toml +0 -0
  31. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/setup.cfg +0 -0
  32. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/tests/test_cli_install.py +0 -0
  33. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/tests/test_config.py +0 -0
  34. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/tests/test_progress.py +0 -0
  35. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/tests/test_snapshot.py +0 -0
  36. {pkgmgr_kunrunic-0.1.1.dev2 → pkgmgr_kunrunic-0.1.1.dev3}/tools/echo_args.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pkgmgr-kunrunic
3
- Version: 0.1.1.dev2
3
+ Version: 0.1.1.dev3
4
4
  Summary: Package management workflow scaffold.
5
5
  Author: pkgmgr maintainers
6
6
  License: MIT License
@@ -13,4 +13,4 @@ __all__ = [
13
13
  "points",
14
14
  ]
15
15
 
16
- __version__ = "0.1.1.dev2"
16
+ __version__ = "0.1.1.dev3"
@@ -161,7 +161,10 @@ def _add_point(sub):
161
161
  def build_parser():
162
162
  if argparse is None:
163
163
  raise RuntimeError("argparse not available; install argparse")
164
- parser = argparse.ArgumentParser(prog="pkgmgr", description="Pkg manager CLI scaffold")
164
+ parser = argparse.ArgumentParser(
165
+ prog="pkgmgr",
166
+ description="Pkg manager CLI v%s" % __version__,
167
+ )
165
168
  # keep %(prog)s for argparse's mapping and append package version
166
169
  parser.add_argument("-V", "--version", action="version", version="%(prog)s " + __version__)
167
170
  parser.add_argument(
@@ -261,7 +264,9 @@ def _handle_actions(args):
261
264
  return 0
262
265
  _print_actions(actions)
263
266
  return 0
264
- release.run_actions(cfg, [args.name], extra_args=args.action_args)
267
+ release.run_actions(
268
+ cfg, [args.name], extra_args=args.action_args, config_path=args.config
269
+ )
265
270
  return 0
266
271
 
267
272
 
@@ -150,7 +150,7 @@ def collect_for_pkg(cfg, pkg_id, collectors=None):
150
150
 
151
151
 
152
152
 
153
- def run_actions(cfg, names, extra_args=None):
153
+ def run_actions(cfg, names, extra_args=None, config_path=None):
154
154
  """Run configured actions by name. Returns result list."""
155
155
  actions = cfg.get("actions", {}) or {}
156
156
  if not names:
@@ -180,6 +180,9 @@ def run_actions(cfg, names, extra_args=None):
180
180
  if not cmd:
181
181
  print("[actions] skip empty cmd for %s #%d" % (name, idx + 1))
182
182
  continue
183
+ if config_path:
184
+ env = dict(env or {})
185
+ env.setdefault("PKGMGR_CONFIG", config_path)
183
186
  if extra_suffix:
184
187
  cmd = "%s%s" % (cmd, extra_suffix)
185
188
  rc = _run_cmd(cmd, cwd=cwd, env=env, label="%s #%d" % (name, idx + 1))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pkgmgr-kunrunic
3
- Version: 0.1.1.dev2
3
+ Version: 0.1.1.dev3
4
4
  Summary: Package management workflow scaffold.
5
5
  Author: pkgmgr maintainers
6
6
  License: MIT License
@@ -22,6 +22,10 @@ pkgmgr_kunrunic.egg-info/entry_points.txt
22
22
  pkgmgr_kunrunic.egg-info/not-zip-safe
23
23
  pkgmgr_kunrunic.egg-info/requires.txt
24
24
  pkgmgr_kunrunic.egg-info/top_level.txt
25
+ plugin/export_cksum.py
26
+ plugin/export_source_review.py
27
+ test_data_root/plugin/export_cksum.py
28
+ test_data_root/plugin/export_source_review.py
25
29
  tests/test_cli_install.py
26
30
  tests/test_config.py
27
31
  tests/test_progress.py
@@ -1,4 +1,6 @@
1
1
  design
2
2
  dist
3
3
  pkgmgr
4
+ plugin
5
+ test_data_root
4
6
  tools
@@ -0,0 +1,354 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ import argparse
4
+ import os
5
+ import subprocess
6
+ import sys
7
+ from copy import copy
8
+
9
+ try:
10
+ import openpyxl
11
+ except Exception:
12
+ openpyxl = None
13
+
14
+ from pkgmgr import config
15
+ from openpyxl.styles import Alignment, Border, Font, PatternFill, Side
16
+
17
+
18
+ def _load_pkg_yaml(pkg_dir):
19
+ if not pkg_dir:
20
+ return None
21
+ return os.path.join(pkg_dir, "pkg.yaml")
22
+
23
+
24
+ def _resolve_pkg_dir(pkg_id, config_path=None):
25
+ try:
26
+ if config_path:
27
+ main_cfg = config.load_main(path=config_path, allow_interactive=False)
28
+ else:
29
+ main_cfg = config.load_main(allow_interactive=False)
30
+ except Exception:
31
+ return None
32
+ release_root = main_cfg.get("pkg_release_root")
33
+ if not release_root:
34
+ return None
35
+ return os.path.abspath(os.path.expanduser(os.path.join(release_root, str(pkg_id))))
36
+
37
+
38
+ def _group_release_paths(pkg_dir, releases):
39
+ grouped = {}
40
+ for entry in releases:
41
+ if entry is None:
42
+ continue
43
+ rel = str(entry)
44
+ target = rel if os.path.isabs(rel) else os.path.join(pkg_dir, rel)
45
+ target = os.path.abspath(os.path.expanduser(target))
46
+ if not os.path.exists(target):
47
+ print("[export_cksum] skip missing: %s" % target)
48
+ continue
49
+ try:
50
+ relpath = os.path.relpath(target, pkg_dir)
51
+ except Exception:
52
+ relpath = os.path.basename(target)
53
+ if relpath.startswith(".."):
54
+ print("[export_cksum] skip outside pkg_dir: %s" % target)
55
+ continue
56
+ parts = relpath.split(os.sep, 1)
57
+ if len(parts) == 2:
58
+ root, subrel = parts[0], parts[1]
59
+ else:
60
+ root, subrel = parts[0], ""
61
+ grouped.setdefault(root, []).append((target, subrel))
62
+ return grouped
63
+
64
+
65
+ def _collect_files(root_dir, entries):
66
+ files = set()
67
+ for target, subrel in entries:
68
+ if subrel:
69
+ base_dir = os.path.join(root_dir, subrel)
70
+ else:
71
+ base_dir = target
72
+ if os.path.isfile(base_dir):
73
+ files.add(base_dir)
74
+ continue
75
+ if not os.path.isdir(base_dir):
76
+ continue
77
+ for base, _, names in os.walk(base_dir):
78
+ for name in names:
79
+ abspath = os.path.join(base, name)
80
+ if os.path.isfile(abspath):
81
+ files.add(abspath)
82
+ return files
83
+
84
+
85
+ def _cksum(path):
86
+ try:
87
+ out = subprocess.check_output(["cksum", path], stderr=subprocess.STDOUT)
88
+ except Exception as e:
89
+ print("[export_cksum] cksum failed: %s (%s)" % (path, str(e)))
90
+ return None
91
+ line = out.decode("utf-8", errors="replace").strip()
92
+ parts = line.split()
93
+ if len(parts) < 3:
94
+ print("[export_cksum] invalid cksum output: %s" % line)
95
+ return None
96
+ return parts[0], parts[1], " ".join(parts[2:])
97
+
98
+
99
+ def _default_styles():
100
+ base_font = Font(name="맑은 고딕", size=11)
101
+ bold_font = Font(name="맑은 고딕", size=11, bold=True)
102
+ header_fill = PatternFill("solid", fgColor="92D050")
103
+ sub_fill = PatternFill("solid", fgColor="FCE4D6")
104
+ medium = Side(style="medium")
105
+ hair = Side(style="hair")
106
+ return {
107
+ "base_font": base_font,
108
+ "bold_font": bold_font,
109
+ "header_fill": header_fill,
110
+ "sub_fill": sub_fill,
111
+ "medium": medium,
112
+ "hair": hair,
113
+ }
114
+
115
+
116
+ def _border(left=None, right=None, top=None, bottom=None):
117
+ return Border(left=left, right=right, top=top, bottom=bottom)
118
+
119
+
120
+ def _init_sheet(ws, sheet_name, release_path, ensure_format):
121
+ if ensure_format:
122
+ styles = _default_styles()
123
+ ws.merge_cells("B2:E2")
124
+ ws.merge_cells("B3:E3")
125
+ if "B4:C4" not in ws.merged_cells:
126
+ ws.merge_cells("B4:C4")
127
+ for col in range(2, 6):
128
+ cell = ws.cell(row=2, column=col)
129
+ cell.fill = styles["header_fill"]
130
+ cell.font = styles["bold_font"]
131
+ cell.alignment = Alignment(horizontal="center", vertical="center")
132
+ cell.border = _border(styles["medium"], styles["medium"], styles["medium"], styles["medium"])
133
+ for col in range(2, 6):
134
+ cell = ws.cell(row=3, column=col)
135
+ cell.fill = styles["sub_fill"]
136
+ cell.font = styles["base_font"]
137
+ cell.alignment = Alignment(horizontal="center", vertical="center")
138
+ left = styles["medium"] if col == 2 else styles["hair"]
139
+ right = styles["medium"] if col == 5 else styles["hair"]
140
+ cell.border = _border(left, right, styles["medium"], styles["hair"])
141
+ for col in range(2, 6):
142
+ cell = ws.cell(row=4, column=col)
143
+ cell.fill = styles["sub_fill"]
144
+ cell.font = styles["base_font"]
145
+ cell.alignment = Alignment(horizontal="center", vertical="center")
146
+ left = styles["medium"] if col == 2 else styles["hair"]
147
+ right = styles["medium"] if col == 5 else styles["hair"]
148
+ cell.border = _border(left, right, styles["hair"], styles["hair"])
149
+ ws.row_dimensions[2].height = 17.25
150
+ ws.column_dimensions["B"].width = 16.75
151
+ ws.column_dimensions["C"].width = 12.75
152
+ ws.column_dimensions["D"].width = 45.875
153
+ ws.column_dimensions["E"].width = 12.75
154
+ ws.column_dimensions["F"].width = 13.0
155
+ ws.cell(row=2, column=2, value=sheet_name)
156
+ ws.cell(row=3, column=2, value=release_path)
157
+ ws.cell(row=4, column=2, value="Check Sum")
158
+ ws.cell(row=4, column=4, value="File Name")
159
+ ws.cell(row=4, column=5, value="비고")
160
+
161
+
162
+ def _apply_table_border(ws, start_row, end_row, ensure_format):
163
+ if not ensure_format:
164
+ return
165
+ styles = _default_styles()
166
+ for row in range(start_row, end_row + 1):
167
+ for col in range(2, 6):
168
+ cell = ws.cell(row=row, column=col)
169
+ left = styles["medium"] if col == 2 else styles["hair"]
170
+ right = styles["medium"] if col == 5 else styles["hair"]
171
+ top = styles["hair"] if row >= 4 else None
172
+ if row == end_row:
173
+ bottom = styles["medium"]
174
+ elif row == 4:
175
+ bottom = styles["hair"]
176
+ else:
177
+ bottom = None
178
+ cell.border = _border(left, right, top, bottom)
179
+
180
+
181
+ def _configure_page(ws, end_row, template_ws=None):
182
+ if template_ws is not None:
183
+ ws.print_area = template_ws.print_area
184
+ ws.page_setup.orientation = template_ws.page_setup.orientation
185
+ ws.page_setup.paperSize = template_ws.page_setup.paperSize
186
+ ws.page_setup.fitToWidth = template_ws.page_setup.fitToWidth
187
+ ws.page_setup.fitToHeight = template_ws.page_setup.fitToHeight
188
+ ws.sheet_view.view = template_ws.sheet_view.view
189
+ ws.sheet_view.zoomScale = template_ws.sheet_view.zoomScale
190
+ ws.sheet_view.zoomScaleNormal = template_ws.sheet_view.zoomScaleNormal
191
+ ws.sheet_view.showGridLines = template_ws.sheet_view.showGridLines
192
+ return
193
+ ws.print_area = "A1:F%d" % max(end_row, 5)
194
+ ws.page_setup.orientation = "portrait"
195
+ ws.page_setup.paperSize = 9
196
+ ws.page_setup.fitToWidth = 1
197
+ ws.page_setup.fitToHeight = 0
198
+ ws.sheet_properties.pageSetUpPr.fitToPage = True
199
+ ws.sheet_view.view = "pageBreakPreview"
200
+ ws.sheet_view.zoomScale = 100
201
+ ws.sheet_view.zoomScaleNormal = 100
202
+ ws.sheet_view.showGridLines = False
203
+
204
+
205
+ def _copy_style(src, dest):
206
+ dest.font = copy(src.font)
207
+ dest.border = copy(src.border)
208
+ dest.fill = copy(src.fill)
209
+ dest.number_format = copy(src.number_format)
210
+ dest.protection = copy(src.protection)
211
+ dest.alignment = copy(src.alignment)
212
+
213
+
214
+ def _write_sheet(ws, rows, ensure_format, template_ws=None):
215
+ if ws.max_row >= 5:
216
+ for row in ws.iter_rows(min_row=5, max_row=ws.max_row, min_col=2, max_col=5):
217
+ for cell in row:
218
+ cell.value = None
219
+ style_row = 5 if ws.max_row >= 5 else None
220
+ style_cells = {}
221
+ if style_row:
222
+ for col in range(2, 6):
223
+ style_cells[col] = ws.cell(row=style_row, column=col)
224
+ template_height = None
225
+ if template_ws is not None:
226
+ template_height = template_ws.row_dimensions[5].height
227
+ styles = _default_styles() if ensure_format else None
228
+ for idx, (cksum, size, path) in enumerate(rows, 5):
229
+ b = ws.cell(row=idx, column=2, value=cksum)
230
+ c = ws.cell(row=idx, column=3, value=size)
231
+ d = ws.cell(row=idx, column=4, value=path)
232
+ e = ws.cell(row=idx, column=5, value="")
233
+ if style_cells:
234
+ _copy_style(style_cells[2], b)
235
+ _copy_style(style_cells[3], c)
236
+ _copy_style(style_cells[4], d)
237
+ _copy_style(style_cells[5], e)
238
+ if ensure_format and styles:
239
+ b.border = _border(styles["medium"], styles["hair"], styles["hair"], None)
240
+ c.border = _border(styles["hair"], styles["hair"], styles["hair"], None)
241
+ d.border = _border(styles["hair"], styles["hair"], styles["hair"], None)
242
+ e.border = _border(styles["hair"], styles["medium"], styles["hair"], None)
243
+ for cell in (b, c, d, e):
244
+ cell.font = styles["base_font"]
245
+ cell.alignment = Alignment(vertical="center")
246
+ if template_height is not None:
247
+ ws.row_dimensions[idx].height = template_height
248
+ end_row = max(5, 4 + len(rows))
249
+ _apply_table_border(ws, 4, end_row, ensure_format)
250
+ if ensure_format:
251
+ blank_row = end_row + 1
252
+ for col in range(2, 6):
253
+ cell = ws.cell(row=blank_row, column=col)
254
+ cell.value = None
255
+ cell.border = Border()
256
+ cell.fill = PatternFill(fill_type=None)
257
+ _configure_page(ws, end_row + 1, template_ws=template_ws)
258
+
259
+
260
+ def main(argv=None):
261
+ argv = argv if argv is not None else sys.argv[1:]
262
+ parser = argparse.ArgumentParser(description="Export cksum results into an Excel template.")
263
+ parser.add_argument("--config", help="pkgmgr main config path")
264
+ parser.add_argument("--pkg-id", required=True, help="pkg id (resolved via pkg_release_root)")
265
+ parser.add_argument("--excel", required=True, help="output xlsx path")
266
+ parser.add_argument("--template", help="xlsx template path (optional)")
267
+ args = parser.parse_args(argv)
268
+
269
+ if openpyxl is None:
270
+ print("[export_cksum] openpyxl is required (pip install openpyxl)")
271
+ return 1
272
+
273
+ pkg_dir = None
274
+ config_path = args.config or os.environ.get("PKGMGR_CONFIG")
275
+ if args.pkg_id:
276
+ pkg_dir = _resolve_pkg_dir(args.pkg_id, config_path=config_path)
277
+ pkg_yaml = _load_pkg_yaml(pkg_dir)
278
+ if not pkg_yaml:
279
+ print("[export_cksum] pkg.yaml not specified; use --pkg-id")
280
+ return 1
281
+ pkg_yaml = os.path.abspath(os.path.expanduser(pkg_yaml))
282
+ pkg_dir = os.path.dirname(pkg_yaml)
283
+
284
+ pkg_cfg = config.load_pkg_config(pkg_yaml)
285
+ releases = (pkg_cfg.get("include") or {}).get("releases") or []
286
+ grouped = _group_release_paths(pkg_dir, releases)
287
+ if not grouped:
288
+ print("[export_cksum] no release entries found in %s" % pkg_yaml)
289
+ return 1
290
+
291
+ excel_path = args.excel
292
+ if not excel_path.lower().endswith(".xlsx"):
293
+ excel_path = excel_path + ".xlsx"
294
+ if os.sep not in excel_path:
295
+ export_dir = os.path.join(pkg_dir, "export")
296
+ excel_path = os.path.join(export_dir, excel_path)
297
+ template_path = args.template or excel_path
298
+ template_available = template_path and os.path.exists(template_path)
299
+ if template_available:
300
+ wb = openpyxl.load_workbook(template_path)
301
+ print("[export_cksum] template loaded: %s" % template_path)
302
+ else:
303
+ wb = openpyxl.Workbook()
304
+ for name in list(wb.sheetnames):
305
+ wb.remove(wb[name])
306
+ print("[export_cksum] template not found; creating new workbook: %s" % excel_path)
307
+ template_ws = wb[wb.sheetnames[0]] if wb.sheetnames else None
308
+ template_title = template_ws.title if template_ws is not None else None
309
+ roots = []
310
+ for root, entries in sorted(grouped.items()):
311
+ roots.append(root)
312
+ root_dir = os.path.join(pkg_dir, root)
313
+ files = _collect_files(root_dir, entries)
314
+ rows = []
315
+ for path in files:
316
+ if not os.path.isfile(path):
317
+ continue
318
+ try:
319
+ relpath = os.path.relpath(path, root_dir)
320
+ except Exception:
321
+ relpath = os.path.basename(path)
322
+ cksum_row = _cksum(path)
323
+ if not cksum_row:
324
+ continue
325
+ rows.append((cksum_row[0], cksum_row[1], relpath))
326
+ rows.sort(key=lambda r: r[2])
327
+
328
+ ensure_format = not template_available
329
+ if root in wb.sheetnames:
330
+ ws = wb[root]
331
+ elif template_ws is not None:
332
+ ws = wb.copy_worksheet(template_ws)
333
+ ws.title = root
334
+ else:
335
+ ws = wb.create_sheet(title=root)
336
+ _init_sheet(ws, root, "PKG Release 경로 작성 필요", ensure_format)
337
+ _write_sheet(ws, rows, ensure_format, template_ws=template_ws)
338
+ print("[export_cksum] sheet=%s rows=%d" % (root, len(rows)))
339
+ if template_title and template_title not in roots and template_title in wb.sheetnames:
340
+ wb.remove(wb[template_title])
341
+
342
+ out_path = excel_path
343
+ if not out_path.lower().endswith(".xlsx"):
344
+ out_path = out_path + ".xlsx"
345
+ out_dir = os.path.dirname(os.path.abspath(out_path))
346
+ if out_dir and not os.path.exists(out_dir):
347
+ os.makedirs(out_dir)
348
+ wb.save(out_path)
349
+ print("[export_cksum] wrote %s" % out_path)
350
+ return 0
351
+
352
+
353
+ if __name__ == "__main__":
354
+ sys.exit(main())