youpdated-scanning 0.1.0__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.
@@ -0,0 +1,141 @@
1
+ """Go programs installed with ``go install``
2
+
3
+ ``go install module@version`` puts the program in ``GOBIN``, else the first ``GOPATH``'s ``bin``, else ``~/go/bin``.
4
+ Either can be set in the environment or in ``go env -w``'s file (``$GOENV``, else ``go/env`` in the user config folder).
5
+
6
+ Each Go program carries its build info, the text ``go version -m`` prints, behind the ``\\xff Go buildinf:`` header.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import mmap
12
+ import os
13
+ import sys
14
+ from pathlib import Path
15
+ from typing import ClassVar, Iterable
16
+
17
+ from .base import Installed
18
+
19
+ MAGIC = b"\xff Go buildinf:"
20
+ HEADER = 32
21
+ FLAG_INLINE = 0x2
22
+ SENTINEL = 16
23
+ DEVEL = "(devel)"
24
+
25
+
26
+ def _config_dir() -> Path:
27
+ """Go's os.UserConfigDir()"""
28
+ home = Path.home()
29
+ if sys.platform == "win32":
30
+ return Path(os.environ.get("APPDATA") or home / "AppData" / "Roaming")
31
+ if sys.platform == "darwin":
32
+ return home / "Library" / "Application Support"
33
+ return Path(os.environ.get("XDG_CONFIG_HOME") or home / ".config")
34
+
35
+
36
+ def go_env_file() -> dict[str, str]:
37
+ """What ``go env -w`` set"""
38
+ where = os.environ.get("GOENV")
39
+ if where == "off":
40
+ return {}
41
+ path = Path(where) if where else _config_dir() / "go" / "env"
42
+ try:
43
+ text = path.read_text(encoding="utf-8")
44
+ except OSError:
45
+ return {}
46
+ values = {}
47
+ for line in text.splitlines():
48
+ key, sep, value = line.partition("=")
49
+ if sep and key.strip():
50
+ values[key.strip()] = value.strip()
51
+ return values
52
+
53
+
54
+ def gobin() -> Path:
55
+ file = go_env_file()
56
+ setting = lambda key: os.environ.get(key) or file.get(key) # noqa: E731
57
+ if setting("GOBIN"):
58
+ return Path(setting("GOBIN")).expanduser()
59
+ paths = [path for path in (setting("GOPATH") or "").split(os.pathsep) if path]
60
+ return Path(paths[0]).expanduser() / "bin" if paths else Path.home() / "go" / "bin"
61
+
62
+
63
+ def _uvarint(data: bytes | mmap.mmap, at: int) -> tuple[int, int]:
64
+ value = shift = 0
65
+ while at < len(data):
66
+ byte = data[at]
67
+ at += 1
68
+ value |= (byte & 0x7F) << shift
69
+ if byte < 0x80:
70
+ return value, at
71
+ shift += 7
72
+ if shift > 63:
73
+ break
74
+ raise ValueError("bad varint")
75
+
76
+
77
+ def build_info(data: bytes | mmap.mmap) -> tuple[str, str] | None:
78
+ """(Go version, ``go version -m`` text) from a Go program's bytes"""
79
+ at = data.find(MAGIC)
80
+ while at != -1:
81
+ if at + HEADER <= len(data) and data[at + len(MAGIC) + 1] & FLAG_INLINE:
82
+ try:
83
+ length, start = _uvarint(data, at + HEADER)
84
+ version = bytes(data[start:start + length]).decode("utf-8", "replace")
85
+ length, start = _uvarint(data, start + length)
86
+ modinfo = bytes(data[start:start + length]).decode("utf-8", "replace")
87
+ except ValueError:
88
+ modinfo = None
89
+ if modinfo is not None:
90
+ if len(modinfo) >= 2 * SENTINEL + 1 and modinfo[-SENTINEL - 1] == "\n":
91
+ modinfo = modinfo[SENTINEL:-SENTINEL]
92
+ return version, modinfo
93
+ at = data.find(MAGIC, at + 1)
94
+ return None
95
+
96
+
97
+ def main_module(modinfo: str) -> tuple[str, str] | None:
98
+ """(module path, version) from the ``mod`` line"""
99
+ for line in modinfo.splitlines():
100
+ fields = line.split("\t")
101
+ if len(fields) >= 3 and fields[0] == "mod" and fields[1]:
102
+ return fields[1], fields[2]
103
+ return None
104
+
105
+
106
+ def read_program(path: Path) -> tuple[str, str] | None:
107
+ try:
108
+ with path.open("rb") as file, mmap.mmap(file.fileno(), 0, access=mmap.ACCESS_READ) as data:
109
+ info = build_info(data)
110
+ except (OSError, ValueError):
111
+ # ValueError: an empty file can't be mapped
112
+ return None
113
+ return main_module(info[1]) if info else None
114
+
115
+
116
+ class GoScanner:
117
+ name: ClassVar[str] = "go"
118
+ summary: ClassVar[str] = "Go programs installed with go install"
119
+ sources: ClassVar[tuple[str, ...]] = ("go",)
120
+
121
+ def __init__(self, directory: Path | None = None) -> None:
122
+ self.directory = directory
123
+
124
+ def available(self) -> bool:
125
+ return (self.directory or gobin()).is_dir()
126
+
127
+ def scan(self) -> Iterable[Installed]:
128
+ seen: set[str] = set()
129
+ directory = self.directory or gobin()
130
+ try:
131
+ programs = sorted(directory.iterdir())
132
+ except OSError:
133
+ return
134
+ for program in programs:
135
+ if not program.is_file():
136
+ continue
137
+ found = read_program(program)
138
+ if found is None or found[1] == DEVEL or found[0] in seen:
139
+ continue
140
+ seen.add(found[0])
141
+ yield Installed("go", found[0], program.stem, found[1], program.resolve())
@@ -0,0 +1,78 @@
1
+ """Homebrew formulae and casks
2
+
3
+ ``brew list --formula --installed-on-request`` gives the formulae asked for. ``brew list --cask`` gives the casks.
4
+ ``--full-name`` and ``--versions`` can't be combined, names and versions are separate calls.
5
+
6
+ Formulae and casks from third-party taps (``user/tap/name``) are passed on as they are, and the homebrew source skips them.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import shutil
12
+ import sys
13
+ from pathlib import Path
14
+ from typing import ClassVar, Iterable
15
+
16
+ from .base import Installed, run
17
+
18
+ ENV = {"HOMEBREW_NO_AUTO_UPDATE": "1", "HOMEBREW_NO_ANALYTICS": "1", "HOMEBREW_NO_ENV_HINTS": "1"}
19
+ TIMEOUT = 60
20
+
21
+
22
+ def parse_names(text: str) -> list[str]:
23
+ return [line.strip() for line in text.splitlines() if line.strip()]
24
+
25
+
26
+ def parse_versions(text: str) -> dict[str, str]:
27
+ """``name 1.0 1.1`` lines, as name to the last version listed"""
28
+ versions = {}
29
+ for line in text.splitlines():
30
+ words = line.split()
31
+ if len(words) > 1:
32
+ versions[words[0]] = words[-1]
33
+ return versions
34
+
35
+
36
+ def cask_app(caskroom: Path, token: str, version: str | None) -> Path | None:
37
+ """The app a cask installed from Caskroom symlink"""
38
+ if version is None:
39
+ return None
40
+ try:
41
+ links = sorted((caskroom / token / version).glob("*.app"))
42
+ except OSError:
43
+ return None
44
+ for link in links:
45
+ if link.is_symlink():
46
+ return link.resolve()
47
+ return None
48
+
49
+
50
+ class HomebrewScanner:
51
+ name: ClassVar[str] = "homebrew"
52
+ summary: ClassVar[str] = "Homebrew formulae and casks"
53
+ sources: ClassVar[tuple[str, ...]] = ("homebrew",)
54
+
55
+ def available(self) -> bool:
56
+ return shutil.which("brew") is not None
57
+
58
+ def brew(self, *args: str) -> str:
59
+ """``brew args`` output"""
60
+ return run("brew", *args, timeout=TIMEOUT, env=ENV)
61
+
62
+ def scan(self) -> Iterable[Installed]:
63
+ formulae = parse_names(self.brew("list", "--formula", "--installed-on-request", "--full-name"))
64
+ formula_versions = parse_versions(self.brew("list", "--formula", "--versions"))
65
+ # Casks are macOS only
66
+ casks = parse_names(self.brew("list", "--cask", "--full-name")) if sys.platform == "darwin" else []
67
+ cask_versions = parse_versions(self.brew("list", "--cask", "--versions")) if casks else {}
68
+ caskroom = Path(self.brew("--caskroom").strip()) if casks else None
69
+
70
+ for full in formulae:
71
+ # `--versions` names a tap's formula without its tap
72
+ name = full.rsplit("/", 1)[-1]
73
+ yield Installed("homebrew", full, name, formula_versions.get(name))
74
+ for full in casks:
75
+ token = full.rsplit("/", 1)[-1]
76
+ version = cask_versions.get(token)
77
+ where = cask_app(caskroom, token, version) if caskroom and "/" not in full else None
78
+ yield Installed("homebrew", f"cask:{full}", token, version, where)
@@ -0,0 +1,177 @@
1
+ """macOS apps: Sparkle feeds and App Store apps
2
+
3
+ Each ``.app`` in ``/Applications`` and ``~/Applications`` (and one folder deep) has a ``Contents/Info.plist``:
4
+
5
+ - ``Contents/_MASReceipt/receipt`` means it came from the Mac App Store -> ``appstore``, by ``CFBundleIdentifier``.
6
+ Its App Store number, from Spotlight's ``kMDItemAppStoreAdamID``, is an alias, for a config that lists it by number
7
+ - ``SUFeedURL`` is the app's Sparkle appcast -> ``sparkle``
8
+ - ``CFBundleShortVersionString`` (or ``CFBundleVersion``) is the installed version
9
+
10
+ Some apps set their feed outside the plist. Those are found when the app has written the feed to its defaults
11
+ (``~/Library/Preferences/<bundle id>.plist``). A sandboxed app's defaults are in its container, which macOS asks for confirmation before reading, so those are ignored.
12
+
13
+ A feed in its defaults belongs to that user's copy of the app, and some apps put a license or install id in its
14
+ query string. URLs get printed, so a feed from defaults with a query string, or a user name or password, is skipped
15
+ with a note instead of copied into the config. A feed in ``Info.plist`` is the same for every copy, since the plist is
16
+ code signed. A plain ``http://`` feed is added with a warning.
17
+
18
+ Setapp installs its apps in a ``Setapp`` folder in ``/Applications``, and updates them itself. Those are its own builds,
19
+ so a feed or ``app-update.yml`` in one is likely a developer's for the copy they sell, with releases Setapp may not
20
+ have shipped yet. Every scanner reading apps through ``bundles()`` skips that folder, and this one warns about it.
21
+
22
+ iPhone/iPad apps installed on a Mac have a ``Wrapper/`` instead of ``Contents/``, and aren't read yet.
23
+ """
24
+
25
+ from __future__ import annotations
26
+
27
+ import plistlib
28
+ import sys
29
+ from pathlib import Path
30
+ from typing import Any, ClassVar, Iterable, Iterator, Sequence
31
+ from urllib.parse import SplitResult, urlsplit
32
+ from xml.parsers.expat import ExpatError
33
+
34
+ from .base import Installed, ScanError, run
35
+
36
+ MDLS_TIMEOUT = 10
37
+
38
+
39
+ def app_dirs() -> list[Path]:
40
+ return [path for path in (Path("/Applications"), Path.home() / "Applications") if path.is_dir()]
41
+
42
+
43
+ def bundles(directory: Path) -> Iterator[Path]:
44
+ """The ``.app``s in ``directory`` and in its folders (``Utilities``), except Setapp's"""
45
+ for child in _children(directory):
46
+ if child.suffix == ".app":
47
+ yield child
48
+ elif child.is_dir() and not child.is_symlink() and not _is_setapp(child):
49
+ yield from (grandchild for grandchild in _children(child) if grandchild.suffix == ".app")
50
+
51
+
52
+ def _is_setapp(folder: Path) -> bool:
53
+ return folder.name.casefold() == "setapp"
54
+
55
+
56
+ def setapp_bundles(directory: Path) -> tuple[Path, list[Path]] | None:
57
+ """Setapp's folder in ``directory`` and the ``.app``s ``bundles()`` passed over in it"""
58
+ for child in _children(directory):
59
+ if _is_setapp(child) and child.is_dir() and not child.is_symlink():
60
+ return child, [app for app in _children(child) if app.suffix == ".app"]
61
+ return None
62
+
63
+
64
+ def _children(directory: Path) -> list[Path]:
65
+ try:
66
+ return sorted(directory.iterdir())
67
+ except OSError:
68
+ return []
69
+
70
+
71
+ def read_plist(path: Path) -> dict[str, Any] | None:
72
+ """A plist file (XML or binary) as a dict"""
73
+ try:
74
+ loaded = plistlib.loads(path.read_bytes())
75
+ except (OSError, ValueError, ExpatError):
76
+ return None
77
+ return loaded if isinstance(loaded, dict) else None
78
+
79
+
80
+ def _private(url: SplitResult) -> str | None:
81
+ """What in ``url`` can be sensitive: a query string, or a user name or password"""
82
+ if url.query:
83
+ return "a query string"
84
+ if url.username is not None or url.password is not None:
85
+ return "a user name or password"
86
+ return None
87
+
88
+
89
+ def _text(info: dict[str, Any], *keys: str) -> str | None:
90
+ for key in keys:
91
+ value = info.get(key)
92
+ if isinstance(value, str) and value.strip():
93
+ return value.strip()
94
+ return None
95
+
96
+
97
+ class MacAppsScanner:
98
+ name: ClassVar[str] = "apps"
99
+ summary: ClassVar[str] = "macOS apps with a Sparkle feed or from the App Store"
100
+ sources: ClassVar[tuple[str, ...]] = ("sparkle", "appstore")
101
+
102
+ def __init__(self, dirs: Sequence[Path] | None = None, preferences: Path | None = None) -> None:
103
+ self.dirs, self.preferences = dirs, preferences
104
+ # Feeds the last scan skipped or flagged, for `scan()` to warn with
105
+ self.notes: list[str] = []
106
+
107
+ def available(self) -> bool:
108
+ return sys.platform == "darwin" and bool(app_dirs())
109
+
110
+ def scan(self) -> Iterable[Installed]:
111
+ self.notes = []
112
+ preferences = self.preferences or Path.home() / "Library" / "Preferences"
113
+ for directory in app_dirs() if self.dirs is None else self.dirs:
114
+ setapp = setapp_bundles(directory)
115
+ if setapp and setapp[1]:
116
+ folder, apps = setapp
117
+ self.notes.append(
118
+ f"skipped {len(apps)} app{'' if len(apps) == 1 else 's'} in {folder}: Setapp updates its apps itself, "
119
+ "and their feeds are likely for developers' builds, with releases Setapp may not have published. "
120
+ "Use `youpdated add` to watch anyway"
121
+ )
122
+ for app in bundles(directory):
123
+ found = self.read(app, preferences)
124
+ if found is not None:
125
+ yield found
126
+
127
+ def read(self, app: Path, preferences: Path) -> Installed | None:
128
+ info = read_plist(app / "Contents" / "Info.plist")
129
+ if info is None:
130
+ return None
131
+ bundle_id = _text(info, "CFBundleIdentifier")
132
+ name = _text(info, "CFBundleDisplayName", "CFBundleName") or app.stem
133
+ short = _text(info, "CFBundleShortVersionString")
134
+ where = app.resolve()
135
+
136
+ if bundle_id and (app / "Contents" / "_MASReceipt" / "receipt").is_file():
137
+ number = self.app_store_number(app)
138
+ # The store lists the short version. A build number compares to nothing there
139
+ return Installed("appstore", bundle_id, name, short, where, (number,) if number else ())
140
+ # A feed without `sparkle:shortVersionString` shows `sparkle:version`, the bundle version, the same way
141
+ version = short or _text(info, "CFBundleVersion")
142
+ feed = _text(info, "SUFeedURL")
143
+ saved = False
144
+ if feed is None and bundle_id and "/" not in bundle_id:
145
+ defaults = read_plist(preferences / f"{bundle_id}.plist")
146
+ feed = _text(defaults, "SUFeedURL") if defaults else None
147
+ saved = feed is not None
148
+ if feed is None:
149
+ return None
150
+ try:
151
+ url = urlsplit(feed)
152
+ except ValueError:
153
+ # Not a URL the sparkle source could read either (`http://[::1`)
154
+ return None
155
+ private = _private(url) if saved else None
156
+ if private:
157
+ # Only where to look
158
+ self.notes.append(
159
+ f"skipped {name}: the feed URL saved in its settings has {private}, which can hold a license "
160
+ f"or install id, so it isn't copied into your config. `defaults read {bundle_id} SUFeedURL` shows it. "
161
+ "Add it with `youpdated add sparkle '<url>'` if desired"
162
+ )
163
+ return None
164
+ if url.scheme == "http" and url.hostname:
165
+ self.notes.append(
166
+ f"the feed for {name} is plain http://, so anyone between you and {url.hostname} can see and change "
167
+ "output. Added anyway. If the feed works over https://, change it in your config"
168
+ )
169
+ return Installed("sparkle", feed, name, version, where)
170
+
171
+ def app_store_number(self, app: Path) -> str | None:
172
+ """``app``'s App Store number as Spotlight indexed it, if it did. ``mdls`` only reads the local index"""
173
+ try:
174
+ number = run("mdls", "-raw", "-name", "kMDItemAppStoreAdamID", str(app), timeout=MDLS_TIMEOUT).strip()
175
+ except ScanError:
176
+ return None
177
+ return number if number.isdigit() else None
@@ -0,0 +1,75 @@
1
+ """global npm packages (``npm install -g``)
2
+
3
+ Skipped:
4
+ - a symlink, which ``npm link`` leaves for a package being worked on
5
+ - npm and corepack, which come with Node.js
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import json
11
+ import shutil
12
+ from pathlib import Path
13
+ from typing import ClassVar, Iterable, Iterator
14
+
15
+ from .base import Installed, run
16
+
17
+ ENV = {
18
+ "NPM_CONFIG_UPDATE_NOTIFIER": "false", "NPM_CONFIG_OFFLINE": "true",
19
+ "NPM_CONFIG_FUND": "false", "NPM_CONFIG_AUDIT": "false",
20
+ }
21
+ TIMEOUT = 60
22
+ WITH_NODE = frozenset({"npm", "corepack"})
23
+
24
+
25
+ def packages(root: Path) -> Iterator[Path]:
26
+ """The package folders in ``root``, a ``node_modules``"""
27
+ for child in _children(root):
28
+ if child.name.startswith("."):
29
+ continue
30
+ if child.name.startswith("@") and child.is_dir() and not child.is_symlink():
31
+ yield from (scoped for scoped in _children(child) if not scoped.name.startswith("."))
32
+ else:
33
+ yield child
34
+
35
+
36
+ def _children(directory: Path) -> list[Path]:
37
+ try:
38
+ return sorted(directory.iterdir())
39
+ except OSError:
40
+ return []
41
+
42
+
43
+ def read(folder: Path) -> tuple[str, str | None] | None:
44
+ """(name, version) of the package in ``folder``"""
45
+ if folder.is_symlink() or not folder.is_dir():
46
+ return None
47
+ try:
48
+ manifest = json.loads((folder / "package.json").read_text(encoding="utf-8"))
49
+ except (OSError, ValueError):
50
+ return None
51
+ if not isinstance(manifest, dict):
52
+ return None
53
+ name, version = manifest.get("name"), manifest.get("version")
54
+ if not isinstance(name, str) or not name or name in WITH_NODE:
55
+ return None
56
+ return name, version if isinstance(version, str) and version else None
57
+
58
+
59
+ class NpmScanner:
60
+ name: ClassVar[str] = "npm"
61
+ summary: ClassVar[str] = "global npm packages"
62
+ sources: ClassVar[tuple[str, ...]] = ("npm",)
63
+
64
+ def available(self) -> bool:
65
+ return shutil.which("npm") is not None
66
+
67
+ def npm(self, *args: str) -> str:
68
+ return run("npm", *args, timeout=TIMEOUT, env=ENV)
69
+
70
+ def scan(self) -> Iterable[Installed]:
71
+ root = Path(self.npm("root", "-g").strip())
72
+ for folder in packages(root):
73
+ found = read(folder)
74
+ if found is not None:
75
+ yield Installed("npm", found[0], found[0], found[1], folder.resolve())
@@ -0,0 +1,87 @@
1
+ """Python apps installed with pipx
2
+
3
+ ``pipx list --json`` reads each venv's ``pipx_metadata.json``
4
+ - ``package_or_url`` is what was asked for
5
+ - ``pip_args`` with ``--index-url`` (``-i``) is another index and is passed over
6
+ - packages injected into a venv are part of that app, not apps of their own
7
+
8
+ Youpdated is ignored
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import json
14
+ import re
15
+ import shutil
16
+ from typing import Any, ClassVar, Iterable
17
+
18
+ from .base import Installed, ScanError, run
19
+
20
+ TIMEOUT = 60
21
+ # The packages making up `youpdated scan`, by normalized name
22
+ SELF = frozenset({"youpdated", "youpdated-scanning"})
23
+ INDEX_ARGS = ("--index-url", "-i")
24
+ ARCHIVES = (".whl", ".zip", ".tar.gz", ".tgz", ".tar.bz2", ".tar.xz", ".tar")
25
+ _SPEC_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._-]*\s*(?:\[[^\]]*\])?\s*(?:[<>=!~;].*)?$")
26
+
27
+
28
+ def normalize(name: str) -> str:
29
+ """A Python package name as PEP 503 compares them"""
30
+ return re.sub(r"[-_.]+", "-", name).lower()
31
+
32
+
33
+ def _sets_index(arg: object) -> bool:
34
+ """``arg`` is ``--index-url URL``'s option, or a short ``-iURL`` with the URL attached"""
35
+ if not isinstance(arg, str):
36
+ return False
37
+ return arg.split("=", 1)[0] in INDEX_ARGS or (arg.startswith("-i") and not arg.startswith("--"))
38
+
39
+
40
+ def from_pypi(spec: str, pip_args: list[Any]) -> bool:
41
+ """``spec`` (``package_or_url``) installed with ``pip_args`` came from PyPI"""
42
+ if any(_sets_index(arg) for arg in pip_args):
43
+ return False
44
+ spec = spec.strip()
45
+ # a wheel or sdist's file name is spelled like a package name
46
+ return bool(_SPEC_RE.match(spec)) and not spec.lower().endswith(ARCHIVES)
47
+
48
+
49
+ def parse_list(text: str) -> list[tuple[str, str | None]]:
50
+ """``pipx list --json`` output as (package, version) of each venv's main package from PyPI"""
51
+ try:
52
+ doc = json.loads(text)
53
+ except ValueError as exc:
54
+ raise ScanError(f"`pipx list --json` gave something other than JSON: {exc}") from None
55
+ venvs = doc.get("venvs") if isinstance(doc, dict) else None
56
+ found = []
57
+ for venv in (venvs or {}).values():
58
+ main = venv.get("metadata", {}).get("main_package") if isinstance(venv, dict) else None
59
+ if not isinstance(main, dict):
60
+ continue
61
+ package, spec = main.get("package"), main.get("package_or_url")
62
+ if not isinstance(package, str) or not package or not isinstance(spec, str):
63
+ continue
64
+ if normalize(package) in SELF or not from_pypi(spec, main.get("pip_args") or []):
65
+ continue
66
+ version = main.get("package_version")
67
+ found.append((package, version if isinstance(version, str) and version else None))
68
+ return found
69
+
70
+
71
+ class PipxScanner:
72
+ name: ClassVar[str] = "pipx"
73
+ summary: ClassVar[str] = "Python apps installed with pipx"
74
+ sources: ClassVar[tuple[str, ...]] = ("pypi",)
75
+
76
+ def available(self) -> bool:
77
+ return shutil.which("pipx") is not None
78
+
79
+ def pipx(self, *args: str) -> str:
80
+ return run("pipx", *args, timeout=TIMEOUT)
81
+
82
+ def scan(self) -> Iterable[Installed]:
83
+ seen: set[str] = set()
84
+ for package, version in parse_list(self.pipx("list", "--json")):
85
+ if normalize(package) not in seen:
86
+ seen.add(normalize(package))
87
+ yield Installed("pypi", package, package, version)
File without changes