pkgmgr-kunrunic 0.1.0.dev0__py3-none-any.whl

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.
pkgmgr/__init__.py ADDED
@@ -0,0 +1,16 @@
1
+ from __future__ import print_function
2
+ """
3
+ Modernized pkg manager scaffold.
4
+ This package will grow to replace the legacy single-file script.
5
+ """
6
+
7
+ __all__ = [
8
+ "cli",
9
+ "config",
10
+ "snapshot",
11
+ "release",
12
+ "gitcollect",
13
+ "watch",
14
+ ]
15
+
16
+ __version__ = "0.1.0.dev0"
pkgmgr/__main__.py ADDED
@@ -0,0 +1,5 @@
1
+ from __future__ import print_function
2
+ from .cli import main
3
+
4
+ if __name__ == "__main__":
5
+ raise SystemExit(main())
pkgmgr/cli.py ADDED
@@ -0,0 +1,161 @@
1
+ from __future__ import print_function
2
+ """CLI entrypoint scaffold for the pkg manager."""
3
+
4
+ import sys
5
+
6
+ try:
7
+ import argparse # Python 2.6: install argparse package if missing
8
+ except Exception:
9
+ argparse = None
10
+
11
+ from . import config, snapshot, release, gitcollect, watch
12
+
13
+
14
+ def _add_make_config(sub):
15
+ p = sub.add_parser("make-config", help="create a pkgmgr.yaml template to edit")
16
+ p.add_argument(
17
+ "-o",
18
+ "--output",
19
+ default="pkgmgr.yaml",
20
+ help="path to write the main config (default: %(default)s)",
21
+ )
22
+ p.set_defaults(func=_handle_make_config)
23
+
24
+
25
+ def _add_install(sub):
26
+ p = sub.add_parser("install", help="install prereqs or prepare environment")
27
+ p.set_defaults(func=_handle_install)
28
+
29
+
30
+ def _add_init_snap(sub):
31
+ p = sub.add_parser(
32
+ "init-snap", help="take initial baseline snapshot for sources/install/pkg root"
33
+ )
34
+ p.add_argument("--config", default="pkgmgr.yaml", help="config file path")
35
+ p.set_defaults(func=_handle_init_snap)
36
+
37
+
38
+ def _add_create_pkg(sub):
39
+ p = sub.add_parser("create-pkg", help="create a pkg folder and template")
40
+ p.add_argument("pkg_id", help="package identifier (e.g. 20240601)")
41
+ p.add_argument("--config", default="pkgmgr.yaml", help="config file path")
42
+ p.set_defaults(func=_handle_create_pkg)
43
+
44
+
45
+ def _add_close_pkg(sub):
46
+ p = sub.add_parser("close-pkg", help="mark a pkg as closed and stop watching")
47
+ p.add_argument("pkg_id", help="package identifier to close")
48
+ p.add_argument("--config", default="pkgmgr.yaml", help="config file path")
49
+ p.set_defaults(func=_handle_close_pkg)
50
+
51
+
52
+ def _add_watch(sub):
53
+ p = sub.add_parser("watch", help="start watcher/daemon to monitor pkgs")
54
+ p.add_argument("--config", default="pkgmgr.yaml", help="config file path")
55
+ p.add_argument(
56
+ "--once",
57
+ action="store_true",
58
+ help="run a single poll iteration then exit (useful for cron)",
59
+ )
60
+ p.set_defaults(func=_handle_watch)
61
+
62
+
63
+ def _add_collect(sub):
64
+ p = sub.add_parser("collect", help="run collectors for a pkg")
65
+ p.add_argument("--pkg", required=True, help="package identifier")
66
+ p.add_argument(
67
+ "--collector",
68
+ action="append",
69
+ dest="collectors",
70
+ help="specific collectors to run (default: all enabled)",
71
+ )
72
+ p.add_argument("--config", default="pkgmgr.yaml", help="config file path")
73
+ p.set_defaults(func=_handle_collect)
74
+
75
+
76
+ def _add_export(sub):
77
+ p = sub.add_parser("export", help="export pkg data (excel/word/etc)")
78
+ p.add_argument("--pkg", required=True, help="package identifier")
79
+ p.add_argument("--format", choices=["excel", "word", "json"], required=True)
80
+ p.add_argument("--config", default="pkgmgr.yaml", help="config file path")
81
+ p.set_defaults(func=_handle_export)
82
+
83
+
84
+ def build_parser():
85
+ if argparse is None:
86
+ raise RuntimeError("argparse not available. On Python 2.6 run: pip install argparse")
87
+ parser = argparse.ArgumentParser(prog="pkgmgr", description="Pkg manager CLI scaffold")
88
+ sub = parser.add_subparsers(dest="command")
89
+
90
+ _add_make_config(sub)
91
+ _add_install(sub)
92
+ _add_init_snap(sub)
93
+ _add_create_pkg(sub)
94
+ _add_close_pkg(sub)
95
+ _add_watch(sub)
96
+ _add_collect(sub)
97
+ _add_export(sub)
98
+ return parser
99
+
100
+
101
+ def _handle_make_config(args):
102
+ config.write_template(args.output)
103
+ return 0
104
+
105
+
106
+ def _handle_install(args):
107
+ release.ensure_environment()
108
+ return 0
109
+
110
+
111
+ def _handle_init_snap(args):
112
+ cfg = config.load_main(args.config)
113
+ snapshot.create_baseline(cfg)
114
+ return 0
115
+
116
+
117
+ def _handle_create_pkg(args):
118
+ cfg = config.load_main(args.config)
119
+ release.create_pkg(cfg, args.pkg_id)
120
+ return 0
121
+
122
+
123
+ def _handle_close_pkg(args):
124
+ cfg = config.load_main(args.config)
125
+ release.close_pkg(cfg, args.pkg_id)
126
+ return 0
127
+
128
+
129
+ def _handle_watch(args):
130
+ cfg = config.load_main(args.config)
131
+ watch.run(cfg, run_once=args.once)
132
+ return 0
133
+
134
+
135
+ def _handle_collect(args):
136
+ cfg = config.load_main(args.config)
137
+ release.collect_for_pkg(cfg, args.pkg, args.collectors)
138
+ return 0
139
+
140
+
141
+ def _handle_export(args):
142
+ cfg = config.load_main(args.config)
143
+ release.export_pkg(cfg, args.pkg, args.format)
144
+ return 0
145
+
146
+
147
+ def main(argv=None):
148
+ argv = argv if argv is not None else sys.argv[1:]
149
+ parser = build_parser()
150
+ if not argv:
151
+ parser.print_help()
152
+ return 0
153
+ args = parser.parse_args(argv)
154
+ if not hasattr(args, "func"):
155
+ parser.print_help()
156
+ return 0
157
+ return args.func(args)
158
+
159
+
160
+ if __name__ == "__main__":
161
+ sys.exit(main())
@@ -0,0 +1,5 @@
1
+ """Collectors package."""
2
+
3
+ from . import base, checksums
4
+
5
+ __all__ = ["base", "checksums"]
@@ -0,0 +1,15 @@
1
+ from __future__ import print_function
2
+ """Collector interface definitions."""
3
+
4
+
5
+ class CollectorResult(dict):
6
+ """Lightweight result mapping for collector outputs."""
7
+
8
+
9
+ class Collector:
10
+ """Base collector contract."""
11
+
12
+ name = "base"
13
+
14
+ def run(self, pkg_ctx, cfg):
15
+ raise NotImplementedError
@@ -0,0 +1,35 @@
1
+ from __future__ import print_function
2
+ """Checksum collector stub."""
3
+
4
+ import hashlib
5
+ import os
6
+
7
+ from .base import Collector, CollectorResult
8
+
9
+
10
+ class ChecksumsCollector(Collector):
11
+ name = "checksums"
12
+
13
+ def run(self, pkg_ctx, cfg):
14
+ """
15
+ Placeholder: walk pkg_ctx['paths'] and compute sha256.
16
+ pkg_ctx is expected to contain 'paths' list of absolute file paths.
17
+ """
18
+ res = CollectorResult()
19
+ paths = pkg_ctx.get("paths", [])
20
+ for path in paths:
21
+ if not os.path.exists(path):
22
+ continue
23
+ res[path] = sha256_of_file(path)
24
+ return res
25
+
26
+
27
+ def sha256_of_file(path, chunk=1024 * 1024):
28
+ h = hashlib.sha256()
29
+ with open(path, "rb") as f:
30
+ while True:
31
+ b = f.read(chunk)
32
+ if not b:
33
+ break
34
+ h.update(b)
35
+ return h.hexdigest()
pkgmgr/config.py ADDED
@@ -0,0 +1,108 @@
1
+ from __future__ import print_function
2
+ """Configuration helpers for the pkg manager scaffold."""
3
+
4
+ import os
5
+ import textwrap
6
+
7
+ try:
8
+ import yaml # type: ignore
9
+ except Exception:
10
+ yaml = None
11
+
12
+
13
+ MAIN_TEMPLATE = """\
14
+ version: 1
15
+
16
+ pkg_release_root: ~/PKG/RELEASE
17
+ sources:
18
+ - /path/to/source-A
19
+ - /path/to/source-B
20
+
21
+ install:
22
+ targets: [bin, lib, data]
23
+ exclude: [log, tmp, cache]
24
+
25
+ watch:
26
+ interval_sec: 60
27
+
28
+ git:
29
+ keywords: ["FIX", "BUG", "SECURITY"]
30
+
31
+ collectors:
32
+ enabled: ["checksums"]
33
+ """
34
+
35
+ PKG_TEMPLATE = """\
36
+ pkg:
37
+ id: "<pkg-id>"
38
+ root: "/path/to/release/<pkg-id>"
39
+ status: "open" # open|closed
40
+
41
+ include:
42
+ sources: ["relative/path/from/source/root"]
43
+ install: ["bin", "lib", "data"]
44
+ pkg_dir: ["docs", "notes"]
45
+
46
+ git:
47
+ keywords: ["BUG", "FEATURE"]
48
+ since: null # e.g. "2024-01-01"
49
+ until: null
50
+
51
+ collectors:
52
+ enabled: ["checksums"]
53
+ """
54
+
55
+
56
+ def write_template(path):
57
+ """Write the main pkgmgr.yaml template."""
58
+ target = os.path.abspath(path)
59
+ parent = os.path.dirname(target)
60
+ if parent and not os.path.exists(parent):
61
+ os.makedirs(parent)
62
+ with open(target, "w") as f:
63
+ f.write(MAIN_TEMPLATE)
64
+ print("[make-config] wrote template to %s" % target)
65
+
66
+
67
+ def write_pkg_template(path):
68
+ """Write a pkg.yaml template for a specific package."""
69
+ target = os.path.abspath(path)
70
+ parent = os.path.dirname(target)
71
+ if parent and not os.path.exists(parent):
72
+ os.makedirs(parent)
73
+ with open(target, "w") as f:
74
+ f.write(PKG_TEMPLATE)
75
+ print("[create-pkg] wrote pkg template to %s" % target)
76
+
77
+
78
+ def load_main(path):
79
+ """
80
+ Load main config YAML. For now this is a thin wrapper; will grow validation.
81
+ If PyYAML is missing, raise a clear error so installation can add it.
82
+ """
83
+ if yaml is None:
84
+ raise RuntimeError(
85
+ "PyYAML not installed; install it or keep using templates manually"
86
+ )
87
+ abs_path = os.path.abspath(path)
88
+ if not os.path.exists(abs_path):
89
+ raise RuntimeError("config not found: %s" % abs_path)
90
+ with open(abs_path, "r") as f:
91
+ data = yaml.safe_load(f) or {}
92
+ return data
93
+
94
+
95
+ def describe_expected_fields():
96
+ """Return a help string for the main config layout."""
97
+ return textwrap.dedent(
98
+ """
99
+ version: schema version for future compatibility
100
+ pkg_release_root: root directory where pkg/<id> will live
101
+ sources: list of source roots to watch
102
+ install.targets: top-level install directories to include
103
+ install.exclude: subdirectories to skip
104
+ watch.interval_sec: poll interval for the watcher
105
+ git.keywords: list of keywords/regex for commit collection
106
+ collectors.enabled: default collectors to run per pkg
107
+ """
108
+ ).strip()
pkgmgr/gitcollect.py ADDED
@@ -0,0 +1,10 @@
1
+ from __future__ import print_function
2
+ """Git collection scaffolding."""
3
+
4
+
5
+ def collect(cfg, pkg_id):
6
+ """
7
+ Placeholder for git log collection using cfg['git']['keywords'].
8
+ Will dump commits into state/pkg/<id>/commits.json in a future step.
9
+ """
10
+ print("[git] collect stub for pkg=%s keywords=%s" % (pkg_id, cfg.get("git")))
pkgmgr/release.py ADDED
@@ -0,0 +1,58 @@
1
+ from __future__ import print_function
2
+ """Release/package lifecycle scaffolding."""
3
+
4
+ import os
5
+ import sys
6
+
7
+ from . import config, snapshot, shell_integration
8
+
9
+
10
+ def ensure_environment():
11
+ """Prepare environment: update shell PATH/alias for current python scripts."""
12
+ script_dir = os.path.dirname(sys.executable)
13
+ shell_integration.ensure_path_and_alias(script_dir)
14
+ print("[install] ensured shell PATH/alias for script dir: %s" % script_dir)
15
+
16
+
17
+ def _pkg_dir(cfg, pkg_id):
18
+ root = os.path.expanduser(cfg.get("pkg_release_root", ""))
19
+ if not root:
20
+ raise RuntimeError("pkg_release_root missing in config")
21
+ return os.path.join(root, str(pkg_id))
22
+
23
+
24
+ def create_pkg(cfg, pkg_id):
25
+ """Create pkg directory and write pkg.yaml template."""
26
+ dest = _pkg_dir(cfg, pkg_id)
27
+ if not os.path.exists(dest):
28
+ os.makedirs(dest)
29
+ template_path = os.path.join(dest, "pkg.yaml")
30
+ config.write_pkg_template(template_path)
31
+ # initial snapshot placeholder
32
+ snapshot.create_baseline(cfg)
33
+ print("[create-pkg] prepared %s" % dest)
34
+
35
+
36
+ def close_pkg(cfg, pkg_id):
37
+ """Mark pkg closed (stub)."""
38
+ dest = _pkg_dir(cfg, pkg_id)
39
+ if not os.path.exists(dest):
40
+ print("[close-pkg] pkg dir not found, nothing to close: %s" % dest)
41
+ return
42
+ marker = os.path.join(dest, ".closed")
43
+ with open(marker, "w") as f:
44
+ f.write("closed\n")
45
+ print("[close-pkg] marked closed: %s" % dest)
46
+
47
+
48
+ def collect_for_pkg(cfg, pkg_id, collectors=None):
49
+ """Run collector hooks (stub)."""
50
+ print(
51
+ "[collect] pkg=%s collectors=%s (stub; wire to collectors.checksums etc.)"
52
+ % (pkg_id, collectors or "default")
53
+ )
54
+
55
+
56
+ def export_pkg(cfg, pkg_id, fmt):
57
+ """Export pkg data placeholder."""
58
+ print("[export] pkg=%s format=%s (stub)" % (pkg_id, fmt))
@@ -0,0 +1,119 @@
1
+ from __future__ import print_function
2
+ """Shell integration helpers: add PATH/alias to common shell rc files.
3
+
4
+ Designed to be conservative and idempotent:
5
+ - Only appends when marker text is absent.
6
+ - Creates rc files if they do not exist.
7
+ - Supports bash/zsh/csh/tcsh/fish.
8
+ """
9
+
10
+ import os
11
+
12
+
13
+ def ensure_path_and_alias(script_dir, alias_name="pkg", command="pkgmgr"):
14
+ """
15
+ Append PATH export and alias to the user's shell rc file when possible.
16
+ script_dir: directory where the pkgmgr console script lives (e.g. venv/bin).
17
+ """
18
+ if not script_dir:
19
+ print("[install] script_dir not provided; skip shell integration")
20
+ return
21
+ shell = os.environ.get("SHELL", "")
22
+ shell_name = os.path.basename(shell) if shell else ""
23
+
24
+ handlers = {
25
+ "bash": _update_bash_zsh,
26
+ "zsh": _update_bash_zsh,
27
+ "csh": _update_csh,
28
+ "tcsh": _update_csh,
29
+ "fish": _update_fish,
30
+ }
31
+
32
+ handler = handlers.get(shell_name)
33
+ if not handler:
34
+ print("[install] unknown shell '%s'; skipping rc update" % (shell_name or ""))
35
+ return
36
+
37
+ try:
38
+ handler(script_dir, alias_name, command)
39
+ except Exception as e:
40
+ print("[install] shell integration failed for %s: %s" % (shell_name, str(e)))
41
+
42
+
43
+ # -------- rc updaters --------
44
+
45
+ def _ensure_lines(path, marker, lines):
46
+ """
47
+ Append lines to file if marker not present.
48
+ """
49
+ exists = os.path.exists(path)
50
+ content = ""
51
+ if exists:
52
+ try:
53
+ f = open(path, "r")
54
+ try:
55
+ content = f.read()
56
+ finally:
57
+ f.close()
58
+ except Exception:
59
+ content = ""
60
+
61
+ if marker in content:
62
+ return False
63
+
64
+ parent = os.path.dirname(path)
65
+ if parent and not os.path.exists(parent):
66
+ os.makedirs(parent)
67
+
68
+ f = open(path, "a")
69
+ try:
70
+ if content and not content.endswith("\n"):
71
+ f.write("\n")
72
+ f.write("# %s\n" % marker)
73
+ for line in lines:
74
+ f.write(line + "\n")
75
+ finally:
76
+ f.close()
77
+ return True
78
+
79
+
80
+ def _update_bash_zsh(script_dir, alias_name, command):
81
+ rc_path = os.path.expanduser("~/.bashrc")
82
+ shell = os.path.basename(os.environ.get("SHELL", ""))
83
+ if shell == "zsh":
84
+ rc_path = os.path.expanduser("~/.zshrc")
85
+ marker = "added by pkgmgr (sh)"
86
+ lines = [
87
+ 'export PATH="%s:$PATH"' % script_dir,
88
+ 'alias %s="%s"' % (alias_name, command),
89
+ ]
90
+ changed = _ensure_lines(rc_path, marker, lines)
91
+ if changed:
92
+ print("[install] updated %s with PATH/alias" % rc_path)
93
+
94
+
95
+ def _update_csh(script_dir, alias_name, command):
96
+ rc_path = os.path.expanduser("~/.cshrc")
97
+ shell = os.path.basename(os.environ.get("SHELL", ""))
98
+ if shell == "tcsh":
99
+ rc_path = os.path.expanduser("~/.tcshrc")
100
+ marker = "added by pkgmgr (csh)"
101
+ lines = [
102
+ "set path = (%s $path)" % script_dir,
103
+ "alias %s %s" % (alias_name, command),
104
+ ]
105
+ changed = _ensure_lines(rc_path, marker, lines)
106
+ if changed:
107
+ print("[install] updated %s with PATH/alias" % rc_path)
108
+
109
+
110
+ def _update_fish(script_dir, alias_name, command):
111
+ rc_path = os.path.expanduser("~/.config/fish/config.fish")
112
+ marker = "added by pkgmgr (fish)"
113
+ lines = [
114
+ "set -U fish_user_paths %s $fish_user_paths" % script_dir,
115
+ "alias %s %s" % (alias_name, command),
116
+ ]
117
+ changed = _ensure_lines(rc_path, marker, lines)
118
+ if changed:
119
+ print("[install] updated %s with PATH/alias" % rc_path)
pkgmgr/snapshot.py ADDED
@@ -0,0 +1,27 @@
1
+ from __future__ import print_function
2
+ """Snapshot scaffolding.
3
+
4
+ This module will house hash/mtime scanning for sources/install/pkg dirs.
5
+ """
6
+
7
+ import os
8
+
9
+
10
+ def create_baseline(cfg):
11
+ """
12
+ Placeholder for baseline snapshot creation.
13
+ Will use cfg['sources'], cfg['install'], cfg['pkg_release_root'].
14
+ """
15
+ roots = {
16
+ "sources": cfg.get("sources", []),
17
+ "install": cfg.get("install", {}).get("targets", []),
18
+ "release": cfg.get("pkg_release_root"),
19
+ }
20
+ print("[init-snap] baseline placeholder. roots=%s" % roots)
21
+ # TODO: implement hashing and storage under pkgmgr/state
22
+
23
+
24
+ def diff_snapshots(base, latest):
25
+ """Placeholder diff helper."""
26
+ print("[snapshot] diff placeholder: base=%s latest=%s" % (base, latest))
27
+ return {}
@@ -0,0 +1,14 @@
1
+ pkg:
2
+ id: "<pkg-id>"
3
+ root: "/path/to/release/<pkg-id>"
4
+ status: "open"
5
+ include:
6
+ sources: ["relative/path/from/source/root"]
7
+ install: ["bin", "lib", "data"]
8
+ pkg_dir: ["docs", "notes"]
9
+ git:
10
+ keywords: ["BUG", "FEATURE"]
11
+ since: null
12
+ until: null
13
+ collectors:
14
+ enabled: ["checksums"]
@@ -0,0 +1,14 @@
1
+ version: 1
2
+ pkg_release_root: ~/PKG/RELEASE
3
+ sources:
4
+ - /path/to/source-A
5
+ - /path/to/source-B
6
+ install:
7
+ targets: [bin, lib, data]
8
+ exclude: [log, tmp, cache]
9
+ watch:
10
+ interval_sec: 60
11
+ git:
12
+ keywords: ["FIX", "BUG", "SECURITY"]
13
+ collectors:
14
+ enabled: ["checksums"]
pkgmgr/watch.py ADDED
@@ -0,0 +1,22 @@
1
+ from __future__ import print_function
2
+ """Watcher/daemon scaffold."""
3
+
4
+ import time
5
+
6
+
7
+ def run(cfg, run_once=False):
8
+ """
9
+ Basic poller placeholder. Future work: inotify/watchdog and pkg status checks.
10
+ """
11
+ interval = cfg.get("watch", {}).get("interval_sec", 60)
12
+ print("[watch] starting poller interval=%ss once=%s" % (interval, run_once))
13
+ if run_once:
14
+ _tick(cfg)
15
+ return
16
+ while True:
17
+ _tick(cfg)
18
+ time.sleep(interval)
19
+
20
+
21
+ def _tick(cfg):
22
+ print("[watch] tick (stub) cfg=%s" % cfg.get("pkg_release_root"))
@@ -0,0 +1,160 @@
1
+ Metadata-Version: 2.4
2
+ Name: pkgmgr-kunrunic
3
+ Version: 0.1.0.dev0
4
+ Summary: Package management workflow scaffold.
5
+ Author: pkgmgr maintainers
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Jho Sung Jun
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/kunrunic/pkgmgnt
29
+ Project-URL: Repository, https://github.com/kunrunic/pkgmgnt
30
+ Classifier: Development Status :: 2 - Pre-Alpha
31
+ Classifier: Intended Audience :: Developers
32
+ Classifier: License :: OSI Approved :: MIT License
33
+ Classifier: Environment :: Console
34
+ Classifier: Programming Language :: Python
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Programming Language :: Python :: 3 :: Only
37
+ Classifier: Programming Language :: Python :: 3.8
38
+ Classifier: Programming Language :: Python :: 3.9
39
+ Classifier: Programming Language :: Python :: 3.10
40
+ Classifier: Programming Language :: Python :: 3.11
41
+ Classifier: Programming Language :: Python :: 3.12
42
+ Classifier: Topic :: Software Development :: Build Tools
43
+ Requires-Python: >=3.8
44
+ Description-Content-Type: text/markdown
45
+ License-File: LICENSE
46
+ Requires-Dist: pyyaml>=6.0
47
+ Dynamic: license-file
48
+
49
+ # pkgmgr
50
+
51
+ 패키지 관리/배포 워크플로를 위한 Python 패키지입니다. 현재는 스캐폴드 상태이며, CLI와 설정 템플릿이 준비돼 있습니다.
52
+
53
+ ## 구성
54
+ - `pkgmgr/cli.py` : CLI 엔트리 (아래 명령어 참조)
55
+ - `pkgmgr/config.py` : `pkgmgr.yaml` / `pkg.yaml` 템플릿 생성 및 로더 (PyYAML 필요)
56
+ - `pkgmgr/snapshot.py`, `pkgmgr/release.py`, `pkgmgr/gitcollect.py`, `pkgmgr/watch.py` : 스냅샷/패키지 수명주기/깃 수집/감시 스텁
57
+ - `pkgmgr/collectors/` : 컬렉터 인터페이스 및 체크섬 컬렉터 스텁
58
+ - 템플릿: `pkgmgr/templates/pkgmgr.yaml.sample`, `pkgmgr/templates/pkg.yaml.sample`
59
+
60
+ ## 필요 사항
61
+ - Python 3.8 이상
62
+ - PyYAML 6.x (의존성에 포함되어 일반 설치 시 자동 설치)
63
+
64
+ ## 기본 사용 흐름 (스캐폴드)
65
+ 아래 명령은 `python -m pkgmgr.cli ...` 형태로 실행합니다.
66
+
67
+ 1) 메인 설정 템플릿 생성
68
+ ```
69
+ python -m pkgmgr.cli make-config -o pkgmgr.yaml
70
+ ```
71
+ `pkgmgr.yaml`에서 소스 경로, 설치 타깃(bin/lib/data 등), release 루트, Git 키워드, 감시 주기, 기본 컬렉터 목록 등을 편집합니다.
72
+
73
+ 2) 환경 준비
74
+ ```
75
+ python -m pkgmgr.cli install
76
+ ```
77
+ (현재는 자리표시자; 추후 의존성/경로 체크를 수행)
78
+
79
+ 3) 초기 스냅샷 생성
80
+ ```
81
+ python -m pkgmgr.cli init-snap --config pkgmgr.yaml
82
+ ```
83
+ 설정된 소스/설치/릴리스 루트를 기준으로 베이스라인을 기록하도록 확장 예정입니다.
84
+
85
+ 4) 패키지 생성
86
+ ```
87
+ python -m pkgmgr.cli create-pkg <pkg-id> --config pkgmgr.yaml
88
+ ```
89
+ `<release_root>/<pkg-id>/pkg.yaml` 템플릿을 만들고, 초기 스냅샷/메타데이터를 붙이는 방향으로 확장됩니다.
90
+
91
+ 5) 패키지 종료
92
+ ```
93
+ python -m pkgmgr.cli close-pkg <pkg-id> --config pkgmgr.yaml
94
+ ```
95
+ 감시 대상에서 제외하고 상태를 closed로 표시하는 용도로 사용합니다.
96
+
97
+ 6) 감시(폴링)
98
+ ```
99
+ python -m pkgmgr.cli watch --config pkgmgr.yaml
100
+ python -m pkgmgr.cli watch --config pkgmgr.yaml --once # 한 번만 폴링
101
+ ```
102
+ 설정된 interval로 변경을 감시하는 로직을 연결할 예정입니다.
103
+
104
+ 7) 수집(컬렉터)
105
+ ```
106
+ python -m pkgmgr.cli collect --pkg <pkg-id> --config pkgmgr.yaml
107
+ python -m pkgmgr.cli collect --pkg <pkg-id> --collector checksums --config pkgmgr.yaml
108
+ ```
109
+ 체크섬/정적/동적/EDR/백신 등 컬렉터를 플러그인 형태로 추가할 수 있도록 확장 예정입니다.
110
+
111
+ 8) 내보내기
112
+ ```
113
+ python -m pkgmgr.cli export --pkg <pkg-id> --format excel --config pkgmgr.yaml
114
+ ```
115
+ 엑셀/워드/JSON 등의 산출물을 생성하는 후크를 붙일 계획입니다.
116
+
117
+ ## 설치·PATH/alias 자동 추가
118
+ - `python -m pip install .` 후 `python -m pkgmgr.cli install`을 실행하면 현재 파이썬의 `bin` 경로(예: venv/bin, ~/.local/bin 등)를 감지해 사용 중인 쉘의 rc 파일에 PATH/alias를 추가합니다.
119
+ - 지원 쉘: bash(`~/.bashrc`), zsh(`~/.zshrc`), csh/tcsh(`~/.cshrc`/`~/.tcshrc`), fish(`~/.config/fish/config.fish`).
120
+ - 추가 내용:
121
+ - PATH: `export PATH="<script_dir>:$PATH"` 또는 쉘별 동등 구문
122
+ - alias: `alias pkg="pkgmgr"` (csh/fish 문법 사용)
123
+ - 이미 추가된 경우(marker로 확인) 중복 삽입하지 않습니다. rc 파일이 없으면 새로 만듭니다.
124
+
125
+ ## 배포(초도 PyPI 업로드) 체크리스트
126
+ - 메타데이터: `pyproject.toml`에서 이름/설명/라이선스/클래시파이어를 관리합니다. 버전은 `pkgmgr/__init__.py`의 `__version__`에서 읽습니다(PEP 440 형식).
127
+ - 빌드 준비: `python -m pip install --upgrade build twine`.
128
+ - 빌드: `python -m build` → `dist/`에 sdist+wheel 생성.
129
+ - 검증: `twine check dist/*` 후 `python -m pip install dist/pkgmgr-<버전>-py3-none-any.whl` 로컬 설치 테스트.
130
+ - 업로드: `TWINE_USERNAME=__token__ TWINE_PASSWORD=pypi-*** twine upload dist/*`.
131
+ - 업로드 전 README/라이선스/템플릿이 최신인지 확인하고, 필요시 rc 업데이트 안내를 유지합니다.
132
+
133
+ ## 템플릿 개요
134
+ - `pkgmgr/templates/pkgmgr.yaml.sample` : 메인 설정 샘플
135
+ - `version`: 스키마 버전
136
+ - `pkg_release_root`: 패키지 릴리스 루트
137
+ - `sources`: 관리할 소스 경로 목록
138
+ - `install.targets` / `install.exclude`: 설치 영역 포함/제외 규칙
139
+ - `watch.interval_sec`: 감시 폴링 주기
140
+ - `git.keywords`: 커밋 수집 키워드/정규식
141
+ - `collectors.enabled`: 기본 활성 컬렉터
142
+
143
+ - `pkgmgr/templates/pkg.yaml.sample` : 패키지별 설정 샘플
144
+ - `pkg.id` / `pkg.root` / `pkg.status(open|closed)`
145
+ - `include.sources/install/pkg_dir`: 포함 대상
146
+ - `git.keywords/since/until`: 커밋 수집 범위
147
+ - `collectors.enabled`: 패키지별 컬렉터 설정
148
+
149
+ ## 주의
150
+ - 아직 핵심 로직(스냅샷/감시/수집/내보내기)은 스텁입니다. 추후 단계적으로 구현/교체 예정입니다.
151
+
152
+ ## TODO (우선순위)
153
+ - 스냅샷/디프 구현: `pkgmgr/snapshot.py`에 해시/mtime/size 스캔, baseline/latest 저장(`state/...`), diff 작성. CLI `init-snap`/`watch` 연결.
154
+ - 설정 스키마 검증: `pkgmgr/config.py` 필수 필드 확인, 기본값 주입, PyYAML 체크, 템플릿 필드 설명 보강.
155
+ - 패키지 라이프사이클: `release.py`에서 `create-pkg` 시 `pkg.yaml` 초기화, `close-pkg` 상태 저장, 상태 파일 표준화.
156
+ - Git 수집: `gitcollect.py`에 키워드/정규식 로그 수집, `state/pkg/<id>/commits.json` 저장, `collect_for_pkg`에서 호출.
157
+ - 컬렉터 파이프라인: 체크섬 collector를 include 목록 기반 실행, collector 등록/선택 로직 추가, 정적/동적/EDR/AV 훅 자리 마련.
158
+ - 감시 루프: `watch.py` 폴링 tick 구현(스냅샷→디프→state), pkg status(open/closed) 고려, interval 적용.
159
+ - Export 인터페이스: `release.py`의 `export_pkg`에서 기본 JSON 덤프, excel/word는 외부 후크 설계.
160
+ - 문서/샘플: README와 `templates/*.sample`를 최신 스키마에 맞춰 보강.
@@ -0,0 +1,20 @@
1
+ pkgmgr/__init__.py,sha256=bv_7ZlxogM79-C3tT1LL7dDqpnmTOJJ794gRy_YHCh4,274
2
+ pkgmgr/__main__.py,sha256=5eNtvDmnY8k4F1RUzYaPcmF-6t-4kH8THzm8x8vFZGI,117
3
+ pkgmgr/cli.py,sha256=pE7msZ6rOxSh6MwpHoGFODJ-Ak25C9KH8gvO7QOOcVk,4549
4
+ pkgmgr/config.py,sha256=SCHHtjFD8pLqkWeFc6IMpzCimp7eEmUU4bGvBi2GY6Q,2746
5
+ pkgmgr/gitcollect.py,sha256=MiPSUsEVO81bbc4g5dzlQajyszLBxUu3yQwHwLp8exI,340
6
+ pkgmgr/release.py,sha256=ygqHcQR2h1aFkInQZvGZ4jwx3KHIQcpTeuj-sA1Y6BY,1809
7
+ pkgmgr/shell_integration.py,sha256=gbHo1xobU-Z4AQztev3vdpwMuXITRNrQeJff9GKyKbE,3520
8
+ pkgmgr/snapshot.py,sha256=V1rOs2LS7LJhxa-xfJ0Kvy-LKXdlRlQGUS2QPnxmEb4,774
9
+ pkgmgr/watch.py,sha256=zu__GO3JjxokEQyNOAi3zjakVuzRDwX8g8KaIdueAo4,557
10
+ pkgmgr/collectors/__init__.py,sha256=eDt5wa8jyDFn3HC2-0U5AjyXSdlJ9hcHOweMewfD4kM,90
11
+ pkgmgr/collectors/base.py,sha256=Zfpe6yMMLmoSZQUkYR6TObDF4TW1YQNNlAZmcukTQIU,309
12
+ pkgmgr/collectors/checksums.py,sha256=Lp7ySNx6ZEhk6hMWtMgJ5KJn0PcWa6jb9_FXosd6Dks,877
13
+ pkgmgr/templates/pkg.yaml.sample,sha256=GSTEVhYOgGrhpAI6asjRIZxDet3LfDEGD57OIojQ3p0,294
14
+ pkgmgr/templates/pkgmgr.yaml.sample,sha256=PjOo5zgVq4B96uYTX8awGoQXFUoo3bBB4l7D_YQ0AMU,269
15
+ pkgmgr_kunrunic-0.1.0.dev0.dist-info/licenses/LICENSE,sha256=DQyjlSl_S-KOdFowc6Lqx-cP6cX9aNF9CLguAHfQI5c,1069
16
+ pkgmgr_kunrunic-0.1.0.dev0.dist-info/METADATA,sha256=mBE7kSPskWmuATarLpcc1fUjBR79nSJFJNrGaRjueu4,8217
17
+ pkgmgr_kunrunic-0.1.0.dev0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
+ pkgmgr_kunrunic-0.1.0.dev0.dist-info/entry_points.txt,sha256=DsYKXAiVGhesLkCOM0jgsRoiSXo21S8qReKGTqxTBjs,43
19
+ pkgmgr_kunrunic-0.1.0.dev0.dist-info/top_level.txt,sha256=eQM_xxe8mhHcwmMik-aja8Z_IB7SpUJ9ow3iPlXlBhw,7
20
+ pkgmgr_kunrunic-0.1.0.dev0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pkgmgr = pkgmgr.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Jho Sung Jun
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ pkgmgr