Skip to content

wheelhouse in changelogs #1618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __str__(self):
def from_text(self, text):
match = re.match(self.PATTERN_OLD, text) or re.match(self.PATTERN, text)
if not match:
raise ValueError("Text does not match expected pattern")
raise ValueError("Text does not match expected pattern: "+ text)
self.name, self.url, self.version, self.description = match.groups()

def to_wiki(self):
Expand All @@ -45,6 +45,7 @@ class PackageIndex:
WINPYTHON_PATTERN = r"\#\# WinPython\-*[0-9b-t]* ([0-9\.a-zA-Z]*)"
TOOLS_LINE = "### Tools"
PYTHON_PACKAGES_LINE = "### Python packages"
WHEELHOUSE_PACKAGES_LINE = "### WheelHouse packages"
HEADER_LINE1 = "Name | Version | Description"
HEADER_LINE2 = "-----|---------|------------"

Expand All @@ -55,6 +56,7 @@ def __init__(self, version, basedir=None, flavor="", architecture=64):
self.architecture = architecture
self.other_packages = {}
self.python_packages = {}
self.wheelhouse_packages = {}
self.from_file(basedir)

def from_file(self, basedir):
Expand All @@ -67,24 +69,29 @@ def from_file(self, basedir):
def from_text(self, text):
version = re.match(self.WINPYTHON_PATTERN + self.flavor, text).groups()[0]
assert version == self.version
tools_flag = python_flag = False
tools_flag = python_flag = wheelhouse_flag = False
for line in text.splitlines():
if line:
if line == self.TOOLS_LINE:
tools_flag, python_flag = True, False
tools_flag, python_flag, wheelhouse_flag = True, False, False
continue
elif line == self.PYTHON_PACKAGES_LINE:
tools_flag, python_flag = False, True
tools_flag, python_flag, wheelhouse_flag = False, True, False
continue
elif line == self.WHEELHOUSE_PACKAGES_LINE:
tools_flag, python_flag, wheelhouse_flag = False, False, True
continue
elif line in (self.HEADER_LINE1, self.HEADER_LINE2, "<details>", "</details>"):
continue
if tools_flag or python_flag:
if tools_flag or python_flag or wheelhouse_flag:
package = Package()
package.from_text(line)
if tools_flag:
self.other_packages[package.name] = package
else:
elif python_flag:
self.python_packages[package.name] = package
else:
self.wheelhouse_packages[package.name] = package

def diff_package_dicts(old_packages, new_packages):
"""Return difference between package old and package new"""
Expand Down Expand Up @@ -141,6 +148,10 @@ def compare_package_indexes(version2, version1=None, basedir=None, flavor="", fl
if py_text:
text += PackageIndex.PYTHON_PACKAGES_LINE + "\r\n\r\n" + py_text

py_text = diff_package_dicts(pi1.wheelhouse_packages, pi2.wheelhouse_packages)
if py_text:
text += PackageIndex.WHEELHOUSE_PACKAGES_LINE + "\r\n\r\n" + py_text

text += "\r\n</details>\r\n* * *\r\n"
return text

Expand Down
6 changes: 6 additions & 0 deletions make.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ def package_index_markdown(self) -> str:
-----|---------|------------
{self.distribution.get_installed_packages_markdown()}

### WheelHouse packages

Name | Version | Description
-----|---------|------------
{self.distribution.get_wheelhouse_packages_markdown()}

</details>
"""

Expand Down
11 changes: 11 additions & 0 deletions winpython/wppm.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ def get_installed_packages_markdown(self) -> str:
]
return "\n".join(package_lines)

def get_wheelhouse_packages_markdown(self) -> str:
wheeldir = self.wheelhouse / 'included.wheels'
if wheeldir.is_dir():
package_lines = [
f"[{name}](https://pypi.org/project/{name}) | {version} | {summary}"
for name, version, summary in wh.list_packages_with_metadata(str(wheeldir))
#for pkg in sorted(wh.list_packages_with_metadata(str(wheeldir)), key=lambda p: p.name.lower())
]
return "\n".join(package_lines)
return ""

def find_package(self, name: str) -> Package | None:
"""Find installed package by name."""
for pack in self.get_installed_packages():
Expand Down