@@ -102,9 +102,6 @@ def _get_python_zip_file(self) -> Path:
102
102
@property
103
103
def package_index_markdown (self ) -> str :
104
104
"""Generates a Markdown formatted package index page."""
105
- installed_tools_markdown = self ._get_installed_tools_markdown ()
106
- installed_packages_markdown = self ._get_installed_packages_markdown ()
107
-
108
105
return f"""## WinPython { self .winpyver2 + self .flavor }
109
106
110
107
The following packages are included in WinPython-{ self .architecture_bits } bit v{ self .winpyver2 + self .flavor } { self .release_level } .
@@ -115,49 +112,17 @@ def package_index_markdown(self) -> str:
115
112
116
113
Name | Version | Description
117
114
-----|---------|------------
118
- { installed_tools_markdown }
115
+ { utils . get_installed_tools_markdown ( utils . get_python_executable ( self . python_executable_directory )) }
119
116
120
117
### Python packages
121
118
122
119
Name | Version | Description
123
120
-----|---------|------------
124
- [Python](http://www.python.org/) | { self .python_full_version } | Python programming language with standard library
125
- { installed_packages_markdown }
121
+ { self .distribution .get_installed_packages_markdown ()}
126
122
127
123
</details>
128
124
"""
129
125
130
- def _get_installed_tools_markdown (self ) -> str :
131
- """Generates Markdown for installed tools section in package index."""
132
- tool_lines = []
133
-
134
- if (nodejs_path := self .winpython_directory / NODEJS_RELATIVE_PATH ).exists ():
135
- version = utils .exec_shell_cmd ("node -v" , nodejs_path ).splitlines ()[0 ]
136
- tool_lines .append (f"[Nodejs](https://nodejs.org) | { version } | xa JavaScript runtime built on Chrome's V8 JavaScript engine" )
137
- version = utils .exec_shell_cmd ("npm -v" , nodejs_path ).splitlines ()[0 ]
138
- tool_lines .append (f"[npmjs](https://www.npmjs.com) | { version } | a package manager for JavaScript" )
139
-
140
- if (pandoc_exe := self .winpython_directory / "t" / "pandoc.exe" ).exists ():
141
- version = utils .exec_shell_cmd ("pandoc -v" , pandoc_exe .parent ).splitlines ()[0 ].split (" " )[- 1 ]
142
- tool_lines .append (f"[Pandoc](https://pandoc.org) | { version } | an universal document converter" )
143
-
144
- if vscode_exe := (self .winpython_directory / "t" / "VSCode" / "Code.exe" ).exists ():
145
- version = utils .getFileProperties (str (vscode_exe ))["FileVersion" ]
146
- tool_lines .append (f"[VSCode](https://code.visualstudio.com) | { version } | a source-code editor developed by Microsoft" )
147
-
148
- return "\n " .join (tool_lines )
149
-
150
- def _get_installed_packages_markdown (self ) -> str :
151
- """Generates Markdown for installed packages section in package index."""
152
- if not self .distribution :
153
- return "" # Distribution not initialized yet.
154
- self .installed_packages = self .distribution .get_installed_packages (update = True )
155
- package_lines = [
156
- f"[{ pkg .name } ]({ pkg .url } ) | { pkg .version } | { pkg .description } "
157
- for pkg in sorted (self .installed_packages , key = lambda p : p .name .lower ())
158
- ]
159
- return "\n " .join (package_lines )
160
-
161
126
@property
162
127
def winpython_version_name (self ) -> str :
163
128
"""Returns the full WinPython version string."""
0 commit comments