Skip to content

Commit 99709de

Browse files
committed
wheelhouse in changelogs
1 parent 83baedd commit 99709de

File tree

3 files changed

+34
-6
lines changed

3 files changed

+34
-6
lines changed

diff.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def __str__(self):
3131
def from_text(self, text):
3232
match = re.match(self.PATTERN_OLD, text) or re.match(self.PATTERN, text)
3333
if not match:
34-
raise ValueError("Text does not match expected pattern")
34+
raise ValueError("Text does not match expected pattern: "+ text)
3535
self.name, self.url, self.version, self.description = match.groups()
3636

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

@@ -55,6 +56,7 @@ def __init__(self, version, basedir=None, flavor="", architecture=64):
5556
self.architecture = architecture
5657
self.other_packages = {}
5758
self.python_packages = {}
59+
self.wheelhouse_packages = {}
5860
self.from_file(basedir)
5961

6062
def from_file(self, basedir):
@@ -67,24 +69,29 @@ def from_file(self, basedir):
6769
def from_text(self, text):
6870
version = re.match(self.WINPYTHON_PATTERN + self.flavor, text).groups()[0]
6971
assert version == self.version
70-
tools_flag = python_flag = False
72+
tools_flag = python_flag = wheelhouse_flag = False
7173
for line in text.splitlines():
7274
if line:
7375
if line == self.TOOLS_LINE:
74-
tools_flag, python_flag = True, False
76+
tools_flag, python_flag, wheelhouse_flag = True, False, False
7577
continue
7678
elif line == self.PYTHON_PACKAGES_LINE:
77-
tools_flag, python_flag = False, True
79+
tools_flag, python_flag, wheelhouse_flag = False, True, False
80+
continue
81+
elif line == self.WHEELHOUSE_PACKAGES_LINE:
82+
tools_flag, python_flag, wheelhouse_flag = False, False, True
7883
continue
7984
elif line in (self.HEADER_LINE1, self.HEADER_LINE2, "<details>", "</details>"):
8085
continue
81-
if tools_flag or python_flag:
86+
if tools_flag or python_flag or wheelhouse_flag:
8287
package = Package()
8388
package.from_text(line)
8489
if tools_flag:
8590
self.other_packages[package.name] = package
86-
else:
91+
elif python_flag:
8792
self.python_packages[package.name] = package
93+
else:
94+
self.wheelhouse_packages[package.name] = package
8895

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

151+
py_text = diff_package_dicts(pi1.wheelhouse_packages, pi2.wheelhouse_packages)
152+
if py_text:
153+
text += PackageIndex.WHEELHOUSE_PACKAGES_LINE + "\r\n\r\n" + py_text
154+
144155
text += "\r\n</details>\r\n* * *\r\n"
145156
return text
146157

make.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ def package_index_markdown(self) -> str:
120120
-----|---------|------------
121121
{self.distribution.get_installed_packages_markdown()}
122122
123+
### WheelHouse packages
124+
125+
Name | Version | Description
126+
-----|---------|------------
127+
{self.distribution.get_wheelhouse_packages_markdown()}
128+
123129
</details>
124130
"""
125131

winpython/wppm.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ def get_installed_packages_markdown(self) -> str:
7676
]
7777
return "\n".join(package_lines)
7878

79+
def get_wheelhouse_packages_markdown(self) -> str:
80+
wheeldir = self.wheelhouse / 'included.wheels'
81+
if wheeldir.is_dir():
82+
package_lines = [
83+
f"[{name}](https://pypi.org/project/{name}) | {version} | {summary}"
84+
for name, version, summary in wh.list_packages_with_metadata(str(wheeldir))
85+
#for pkg in sorted(wh.list_packages_with_metadata(str(wheeldir)), key=lambda p: p.name.lower())
86+
]
87+
return "\n".join(package_lines)
88+
return ""
89+
7990
def find_package(self, name: str) -> Package | None:
8091
"""Find installed package by name."""
8192
for pack in self.get_installed_packages():

0 commit comments

Comments
 (0)