pkgmgr-kunrunic 0.1.1.dev4__tar.gz → 0.1.1.dev5__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 (35) hide show
  1. {pkgmgr_kunrunic-0.1.1.dev4/pkgmgr_kunrunic.egg-info → pkgmgr_kunrunic-0.1.1.dev5}/PKG-INFO +1 -1
  2. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr/__init__.py +1 -1
  3. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr/cli.py +7 -7
  4. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr/release.py +23 -1
  5. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5/pkgmgr_kunrunic.egg-info}/PKG-INFO +1 -1
  6. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/plugin/export_cksum.py +55 -7
  7. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/plugin/export_pkgstore.py +5 -0
  8. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/LICENSE +0 -0
  9. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/README.md +0 -0
  10. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr/__main__.py +0 -0
  11. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr/collectors/__init__.py +0 -0
  12. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr/collectors/base.py +0 -0
  13. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr/collectors/checksums.py +0 -0
  14. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr/config.py +0 -0
  15. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr/points.py +0 -0
  16. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr/shell_integration.py +0 -0
  17. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr/snapshot.py +0 -0
  18. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr/templates/pkg.yaml.sample +0 -0
  19. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr/templates/pkgmgr.yaml.sample +0 -0
  20. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr/watch.py +0 -0
  21. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr_kunrunic.egg-info/SOURCES.txt +0 -0
  22. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr_kunrunic.egg-info/dependency_links.txt +0 -0
  23. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr_kunrunic.egg-info/entry_points.txt +0 -0
  24. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr_kunrunic.egg-info/not-zip-safe +0 -0
  25. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr_kunrunic.egg-info/requires.txt +0 -0
  26. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pkgmgr_kunrunic.egg-info/top_level.txt +0 -0
  27. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/plugin/export_source_review.py +0 -0
  28. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/pyproject.toml +0 -0
  29. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/setup.cfg +0 -0
  30. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/tests/test_cli_install.py +0 -0
  31. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/tests/test_config.py +0 -0
  32. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/tests/test_progress.py +0 -0
  33. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/tests/test_release.py +0 -0
  34. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/tests/test_snapshot.py +0 -0
  35. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev5}/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.dev4
3
+ Version: 0.1.1.dev5
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.dev4"
16
+ __version__ = "0.1.1.dev5"
@@ -220,24 +220,24 @@ def _handle_snapshot(args):
220
220
  def _handle_create_pkg(args):
221
221
  cfg = config.load_main(args.config)
222
222
  release.create_pkg(cfg, args.pkg_id)
223
- _run_auto_actions(cfg, "create_pkg", config_path=args.config)
223
+ _run_auto_actions(cfg, "create_pkg", config_path=args.config, context={"pkg_id": args.pkg_id, "event": "create_pkg"})
224
224
  return 0
225
225
 
226
226
  def _handle_update_pkg(args):
227
227
  cfg = config.load_main(args.config)
228
228
  if args.release:
229
229
  release.finalize_pkg_release(cfg, args.pkg_id)
230
- _run_auto_actions(cfg, "update_pkg_release", config_path=args.config)
230
+ _run_auto_actions(cfg, "update_pkg_release", config_path=args.config, context={"pkg_id": args.pkg_id, "event": "update_pkg_release"})
231
231
  return 0
232
232
  release.update_pkg(cfg, args.pkg_id)
233
- _run_auto_actions(cfg, "update_pkg", config_path=args.config)
233
+ _run_auto_actions(cfg, "update_pkg", config_path=args.config, context={"pkg_id": args.pkg_id, "event": "update_pkg"})
234
234
  return 0
235
235
 
236
236
 
237
237
  def _handle_close_pkg(args):
238
238
  cfg = config.load_main(args.config)
239
239
  release.close_pkg(cfg, args.pkg_id)
240
- _run_auto_actions(cfg, "close_pkg", config_path=args.config)
240
+ _run_auto_actions(cfg, "close_pkg", config_path=args.config, context={"pkg_id": args.pkg_id, "event": "close_pkg"})
241
241
  return 0
242
242
 
243
243
 
@@ -274,16 +274,16 @@ def _handle_actions(args):
274
274
  return 0
275
275
 
276
276
 
277
- def _run_auto_actions(cfg, event, config_path=None):
277
+ def _run_auto_actions(cfg, event, config_path=None, context=None):
278
278
  auto_actions = cfg.get("auto_actions") or {}
279
279
  names = auto_actions.get(event) or []
280
280
  if not names:
281
281
  return []
282
- return release.run_actions(cfg, names, config_path=config_path)
282
+ return release.run_actions(cfg, names, config_path=config_path, context=context)
283
283
 
284
284
 
285
285
  def _print_actions(actions):
286
- ordered = sorted(actions.keys())
286
+ ordered = sorted([name for name in actions.keys() if not str(name).startswith("auto_")])
287
287
  print("[actions] available:")
288
288
  for idx, name in enumerate(ordered, 1):
289
289
  entries = actions.get(name) or []
@@ -285,7 +285,7 @@ def collect_for_pkg(cfg, pkg_id, collectors=None):
285
285
 
286
286
 
287
287
 
288
- def run_actions(cfg, names, extra_args=None, config_path=None):
288
+ def run_actions(cfg, names, extra_args=None, config_path=None, context=None):
289
289
  """Run configured actions by name. Returns result list."""
290
290
  actions = cfg.get("actions", {}) or {}
291
291
  if not names:
@@ -297,6 +297,7 @@ def run_actions(cfg, names, extra_args=None, config_path=None):
297
297
  quoted = [shlex.quote(str(arg)) for arg in extra_args]
298
298
  extra_suffix = " " + " ".join(quoted)
299
299
  results = []
300
+ context = context or {}
300
301
  for name in names:
301
302
  entries = actions.get(name)
302
303
  if not entries:
@@ -315,6 +316,9 @@ def run_actions(cfg, names, extra_args=None, config_path=None):
315
316
  if not cmd:
316
317
  print("[actions] skip empty cmd for %s #%d" % (name, idx + 1))
317
318
  continue
319
+ cmd = _render_action_value(cmd, context)
320
+ cwd = _render_action_value(cwd, context)
321
+ env = _render_action_env(env, context)
318
322
  if config_path:
319
323
  env = dict(env or {})
320
324
  env.setdefault("PKGMGR_CONFIG", config_path)
@@ -331,6 +335,24 @@ def run_actions(cfg, names, extra_args=None, config_path=None):
331
335
  return results
332
336
 
333
337
 
338
+ def _render_action_value(value, context):
339
+ if not value or not context:
340
+ return value
341
+ text = str(value)
342
+ for key, val in context.items():
343
+ text = text.replace("{%s}" % key, str(val))
344
+ return text
345
+
346
+
347
+ def _render_action_env(env, context):
348
+ if not env or not isinstance(env, dict):
349
+ return env
350
+ rendered = {}
351
+ for k, v in env.items():
352
+ rendered[k] = _render_action_value(v, context)
353
+ return rendered
354
+
355
+
334
356
  def _parse_action_entry(entry):
335
357
  if isinstance(entry, dict):
336
358
  cmd = entry.get("cmd")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pkgmgr-kunrunic
3
- Version: 0.1.1.dev4
3
+ Version: 0.1.1.dev5
4
4
  Summary: Package management workflow scaffold.
5
5
  Author: pkgmgr maintainers
6
6
  License: MIT License
@@ -2,8 +2,10 @@
2
2
  # -*- coding: utf-8 -*-
3
3
  import argparse
4
4
  import os
5
+ import re
5
6
  import subprocess
6
7
  import sys
8
+ import time
7
9
  from copy import copy
8
10
 
9
11
  try:
@@ -96,6 +98,53 @@ def _cksum(path):
96
98
  return parts[0], parts[1], " ".join(parts[2:])
97
99
 
98
100
 
101
+ def _normalize_excel_template(excel_arg, pkg_dir):
102
+ path_template = excel_arg
103
+ if os.sep not in path_template:
104
+ export_dir = os.path.join(pkg_dir, "export")
105
+ path_template = os.path.join(export_dir, path_template)
106
+ if not path_template.lower().endswith(".xlsx"):
107
+ path_template = path_template + ".xlsx"
108
+ return path_template
109
+
110
+
111
+ def _next_version(path_template):
112
+ dir_path = os.path.dirname(path_template) or "."
113
+ name_template = os.path.basename(path_template)
114
+ regex = re.escape(name_template)
115
+ regex = regex.replace(re.escape("{YYYYMMDD}"), r"\d{8}")
116
+ regex = regex.replace(re.escape("{date}"), r"\d{8}")
117
+ regex = regex.replace(re.escape("{version}"), r"v(\d+)")
118
+ regex = "^" + regex + "$"
119
+ max_ver = 0
120
+ if os.path.isdir(dir_path):
121
+ for name in os.listdir(dir_path):
122
+ m = re.match(regex, name)
123
+ if not m:
124
+ continue
125
+ try:
126
+ ver = int(m.group(1))
127
+ except Exception:
128
+ continue
129
+ if ver > max_ver:
130
+ max_ver = ver
131
+ return max_ver + 1
132
+
133
+
134
+ def _resolve_excel_path(excel_arg, pkg_dir):
135
+ date_str = time.strftime("%Y%m%d", time.localtime())
136
+ template_path = _normalize_excel_template(excel_arg, pkg_dir)
137
+ if "{version}" in template_path:
138
+ version = _next_version(template_path)
139
+ else:
140
+ version = None
141
+ output_path = template_path
142
+ output_path = output_path.replace("{YYYYMMDD}", date_str).replace("{date}", date_str)
143
+ if version is not None:
144
+ output_path = output_path.replace("{version}", "v%d" % version)
145
+ return output_path
146
+
147
+
99
148
  def _default_styles():
100
149
  base_font = Font(name="맑은 고딕", size=11)
101
150
  bold_font = Font(name="맑은 고딕", size=11, bold=True)
@@ -262,7 +311,11 @@ def main(argv=None):
262
311
  parser = argparse.ArgumentParser(description="Export cksum results into an Excel template.")
263
312
  parser.add_argument("--config", help="pkgmgr main config path")
264
313
  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")
314
+ parser.add_argument(
315
+ "--excel",
316
+ required=True,
317
+ help="output xlsx path (supports {YYYYMMDD}/{date} and {version})",
318
+ )
266
319
  parser.add_argument("--template", help="xlsx template path (optional)")
267
320
  args = parser.parse_args(argv)
268
321
 
@@ -288,12 +341,7 @@ def main(argv=None):
288
341
  print("[export_cksum] no release entries found in %s" % pkg_yaml)
289
342
  return 1
290
343
 
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)
344
+ excel_path = _resolve_excel_path(args.excel, pkg_dir)
297
345
  template_path = args.template or excel_path
298
346
  template_available = template_path and os.path.exists(template_path)
299
347
  if template_available:
@@ -102,12 +102,17 @@ def main(argv=None):
102
102
  else:
103
103
  remote_state = "%s/state" % remote_root
104
104
  src_dir = dest_state.rstrip("/") + "/"
105
+ subprocess.check_call(
106
+ ["ssh", args.push, "mkdir", "-p", remote_state]
107
+ )
105
108
  rsync_cmd = ["rsync", "-avzc", "--delete"]
106
109
  if args.identity:
107
110
  rsync_cmd.extend(["-e", "ssh -i %s" % args.identity])
108
111
  rsync_cmd.extend([src_dir, "%s:%s" % (args.push, remote_state)])
109
112
  print("[export_pkgstore] rsync -> %s" % (remote_state,))
110
113
  subprocess.check_call(rsync_cmd)
114
+ else:
115
+ print("[export_pkgstore] push skipped (no --push)")
111
116
  if tmp_root:
112
117
  shutil.rmtree(tmp_root)
113
118
  return 0