8000 Merge pull request #1557 from stonebig/master · winpython/winpython@f2a1af6 · GitHub
[go: up one dir, main page]

Skip to content

Commit f2a1af6

Browse files
authored
Merge pull request #1557 from stonebig/master
simplify tools.ini tricky plumbery for just 4 tools
2 parents 3f7c47d + caa4020 commit f2a1af6

File tree

4 files changed

+13
-85
lines changed

4 files changed

+13
-85
lines changed

make.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -130,26 +130,22 @@ def package_index_markdown(self) -> str:
130130

131131
def _get_installed_tools_markdown(self) -> str:
132132
"""Generates Markdown for installed tools section in package index."""
133-
installed_tools = []
134-
135-
def get_tool_path(relative_path):
136-
path = self.winpython_directory / relative_path if self.winpython_directory else None
137-
return path if path and path.exists() else None
133+
tool_lines = []
138134

139-
if nodejs_path := get_tool_path(NODEJS_RELATIVE_PATH):
140-
installed_tools.append(("Nodejs", utils.get_nodejs_version(nodejs_path)))
141-
installed_tools.append(("npmjs", utils.get_npmjs_version(nodejs_path)))
135+
if (nodejs_path := self.winpython_directory / NODEJS_RELATIVE_PATH).exists():
136+
version = utils.get_nodejs_version(nodejs_path)
137+
tool_lines.append(f"[Nodejs](https://nodejs.org) | {version} | a JavaScript runtime built on Chrome's V8 JavaScript engine")
138+
version = utils.get_npmjs_version(nodejs_path)
139+
tool_lines.append(f"[npmjs](https://www.npmjs.com) | {version} | a package manager for JavaScript")
142140

143-
if pandoc_exe := get_tool_path("t/pandoc.exe"):
144-
installed_tools.append(("Pandoc", utils.get_pandoc_version(str(pandoc_exe.parent))))
141+
if (pandoc_exe := self.winpython_directory / "t" / "pandoc.exe").exists():
142+
version = utils.get_pandoc_version(str(pandoc_exe.parent))
143+
tool_lines.append(f"[Pandoc](https://pandoc.org) | {version} | an universal document converter")
145144

146-
if vscode_exe := get_tool_path("t/VSCode/Code.exe"):
147-
installed_tools.append(("VSCode", utils.getFileProperties(str(vscode_exe))["FileVersion"]))
145+
if vscode_exe := (self.winpython_directory / "t" / "VSCode" / "Code.exe").exists():
146+
version = utils.getFileProperties(str(vscode_exe))["FileVersion"]
147+
tool_lines.append(f"[VSCode](https://code.visualstudio.com) | {version} | a source-code editor developed by Microsoft")
148148

149-
tool_lines = []
150-
for name, version in installed_tools:
151-
metadata = utils.get_package_metadata("tools.ini", name)
152-
tool_lines.append(f"[{name}]({metadata['url']}) | {version} | {metadata['description']}")
153149
return "\n".join(tool_lines)
154150

155151
def _get_installed_packages_markdown(self) -> str:

winpython/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
OTHER DEALINGS IN THE SOFTWARE.
2929
"""
3030

31-
__version__ = '15.2.20250412'
31+
__version__ = '15.3.20250417'
3232
__license__ = __doc__
3333
__project_url__ = 'http://winpython.github.io/'

winpython/data/tools.ini

Lines changed: 0 additions & 47 deletions
This file was deleted.

winpython/utils.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -379,27 +379,6 @@ def normalize(this):
379379
"""Apply PEP 503 normalization to the string."""
380380
return re.sub(r"[-_.]+", "-", this).lower()
381381

382-
def get_package_metadata(database, name):
383-
"""Extract infos (description, url) from the local database."""
384-
DATA_PATH = Path(sys.modules['winpython'].__file__).parent / 'data'
385-
db = cp.ConfigParser()
386-
filepath = Path(database) if Path(database).is_absolute() else DATA_PATH / database
387-
db.read_file(open(str(filepath), encoding=guess_encoding(filepath)[0]))
388-
389-
my_metadata = {
390-
"description": "",
391-
"url": f"https://pypi.org/project/{name}",
392-
}
393-
for key in my_metadata:
394-
for name2 in (name, normalize(name)):
395-
try:
396-
my_metadata[key] = db.get(name2, key)
397-
break
398-
except (cp.NoSectionError, cp.NoOptionError):
399-
pass
400-
401-
return my_metadata
402-
403382
if __name__ == '__main__':
404383
print_box("Test")
405384
dname = sys.prefix

0 commit comments

Comments
 (0)
0