Skip to content

wppm -md -ws . will compare Installed package to WheelHouse packages #1639

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
Jun 7, 2025
Merged
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
19 changes: 12 additions & 7 deletions winpython/wppm.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import json
from pathlib import Path
from argparse import ArgumentParser, RawTextHelpFormatter
from . import utils, piptree, associate
from . import utils, piptree, associate, diff
from . import wheelhouse as wh
from operator import itemgetter
# Workaround for installing PyVISA on Windows from source:
Expand Down Expand Up @@ -80,10 +80,10 @@ def render_markdown_for_list(self, title, items):
return md

def generate_package_index_markdown(self, python_executable_directory: str|None = None, winpyver2: str|None = None,
flavor: str|None = None, architecture_bits: int|None = None, release_level: str|None = None) -> str:
flavor: str|None = None, architecture_bits: int|None = None
, release_level: str|None = None, wheeldir: str|None = None) -> str:
"""Generates a Markdown formatted package index page."""
my_ver , my_arch = utils.get_python_infos(python_executable_directory or self.target)
# suppose we suite ourself (method will vary over time)
my_winpyver2 = winpyver2 or os.getenv("WINPYVER2","")
my_winpyver2 = my_winpyver2 if my_winpyver2 != "" else my_ver
my_flavor = flavor or os.getenv("WINPYFLAVOR", "")
Expand All @@ -92,10 +92,10 @@ def generate_package_index_markdown(self, python_executable_directory: str|None
tools_list = utils.get_installed_tools(utils.get_python_executable(python_executable_directory))
package_list = [(pkg.name, pkg.url, pkg.version, pkg.description) for pkg in self.get_installed_packages()]
wheelhouse_list = []
wheeldir = self.wheelhouse / 'included.wheels'
if wheeldir.is_dir():
my_wheeldir = Path(wheeldir) if wheeldir else self.wheelhouse / 'included.wheels'
if my_wheeldir.is_dir():
wheelhouse_list = [(name, f"https://pypi.org/project/{name}", version, summary)
for name, version, summary in wh.list_packages_with_metadata(str(wheeldir)) ]
for name, version, summary in wh.list_packages_with_metadata(str(my_wheeldir)) ]

return f"""## WinPython {my_winpyver2 + my_flavor}

Expand Down Expand Up @@ -366,7 +366,12 @@ def main(test=False):
p = subprocess.Popen(["start", "cmd", "/k",dist.python_exe, "-c" , cmd_mov], shell = True, cwd=dist.target)
sys.exit()
if args.markdown:
print(dist.generate_package_index_markdown())
default = dist.generate_package_index_markdown()
if args.wheelsource:
compare = dist.generate_package_index_markdown(wheeldir = args.wheelsource)
print(diff.compare_markdown_sections(default, compare,'python', 'wheelhouse', 'installed', 'wheelhouse'))
else:
print(default)
sys.exit()
if not args.install and not args.uninstall and args.fname.endswith(".toml"):
args.install = True # for Drag & Drop of .toml (and not wheel)
Expand Down