14
14
import json
15
15
from pathlib import Path
16
16
from argparse import ArgumentParser , RawTextHelpFormatter
17
- from . import utils , piptree , associate
17
+ from . import utils , piptree , associate , diff
18
18
from . import wheelhouse as wh
19
19
from operator import itemgetter
20
20
# Workaround for installing PyVISA on Windows from source:
@@ -80,10 +80,10 @@ def render_markdown_for_list(self, title, items):
80
80
return md
81
81
82
82
def generate_package_index_markdown (self , python_executable_directory : str | None = None , winpyver2 : str | None = None ,
83
- flavor : str | None = None , architecture_bits : int | None = None , release_level : str | None = None ) -> str :
83
+ flavor : str | None = None , architecture_bits : int | None = None
84
+ , release_level : str | None = None , wheeldir : str | None = None ) -> str :
84
85
"""Generates a Markdown formatted package index page."""
85
86
my_ver , my_arch = utils .get_python_infos (python_executable_directory or self .target )
86
- # suppose we suite ourself (method will vary over time)
87
87
my_winpyver2 = winpyver2 or os .getenv ("WINPYVER2" ,"" )
88
88
my_winpyver2 = my_winpyver2 if my_winpyver2 != "" else my_ver
89
89
my_flavor = flavor or os .getenv ("WINPYFLAVOR" , "" )
@@ -92,10 +92,10 @@ def generate_package_index_markdown(self, python_executable_directory: str|None
92
92
tools_list = utils .get_installed_tools (utils .get_python_executable (python_executable_directory ))
93
93
package_list = [(pkg .name , pkg .url , pkg .version , pkg .description ) for pkg in self .get_installed_packages ()]
94
94
wheelhouse_list = []
95
- wheeldir = self .wheelhouse / 'included.wheels'
96
- if wheeldir .is_dir ():
95
+ my_wheeldir = Path ( wheeldir ) if wheeldir else self .wheelhouse / 'included.wheels'
96
+ if my_wheeldir .is_dir ():
97
97
wheelhouse_list = [(name , f"https://pypi.org/project/{ name } " , version , summary )
98
- for name , version , summary in wh .list_packages_with_metadata (str (wheeldir )) ]
98
+ for name , version , summary in wh .list_packages_with_metadata (str (my_wheeldir )) ]
99
99
100
100
return f"""## WinPython { my_winpyver2 + my_flavor }
101
101
@@ -366,7 +366,12 @@ def main(test=False):
366
366
p = subprocess .Popen (["start" , "cmd" , "/k" ,dist .python_exe , "-c" , cmd_mov ], shell = True , cwd = dist .target )
367
367
sys .exit ()
368
368
if args .markdown :
369
- print (dist .generate_package_index_markdown ())
369
+ default = dist .generate_package_index_markdown ()
370
+ if args .wheelsource :
371
+ compare = dist .generate_package_index_markdown (wheeldir = args .wheelsource )
372
+ print (diff .compare_markdown_sections (default , compare ,'python' , 'wheelhouse' , 'installed' , 'wheelhouse' ))
373
+ else :
374
+ print (default )
370
375
sys .exit ()
371
376
if not args .install and not args .uninstall and args .fname .endswith (".toml" ):
372
377
args .install = True # for Drag & Drop of .toml (and not wheel)
0 commit comments