10000 remove dependance on pip command line · winpython/winpython@931d4d0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 931d4d0

Browse files
committed
remove dependance on pip command line
and by so, drop support for Python-3.7 and below
1 parent 4a61cf1 commit 931d4d0

File tree

3 files changed

+8
-19
lines changed

3 files changed

+8
-19
lines changed

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__ = '7.6.20240427'
31+
__version__ = '8.0.20240501'
3232
__license__ = __doc__
3333
__project_url__ = 'http://winpython.github.io/'

winpython/piptree.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: utf-8 -*-
2+
# require python 3.8+ because of importlib.metadata
23
import json, sys, re, platform, os, sysconfig
34
import re
45
from collections import OrderedDict
@@ -58,7 +59,7 @@ def __init__(self, Target=None):
5859
pip_json_installed=distributions(path=[str(Path(Target).parent /'lib'/'site-packages'),])
5960
for p in pip_json_installed:
6061
meta = p.metadata
61-
name = p.name
62+
name = p.metadata['Name'] # p.name is not ok in 3.8
6263
version = p.version
6364
key = normalize(name)
6465
requires = []

winpython/wppm.py

Lines changed: 5 additions & 17 deletions
< 56FF td data-grid-cell-id="diff-b613193ad1ad07eecf31ea6ec1015716028a8c39a1687eb107c3185c21822def-335-321-2" data-line-anchor="diff-b613193ad1ad07eecf31ea6ec1015716028a8c39a1687eb107c3185c21822defR321" data-selected="false" role="gridcell" style="background-color:var(--diffBlob-additionLine-bgColor, var(--diffBlob-addition-bgColor-line));padding-right:24px" tabindex="-1" valign="top" class="focusable-grid-cell diff-text-cell right-side-diff-cell left-side">+
else:
Original file line numberDiff line numberDiff line change
@@ -316,23 +316,11 @@ def get_installed_packages(self, update=False):
316316

317317
# Include package installed via pip (not via WPPM)
318318
wppm = []
319-
try: # we try to use also 'pip inspect' via piptree (work for pip>= 22.2)
320-
if str(Path(sys.executable).parent) == self.target:
321-
self.pip = piptree.pipdata()
322-
else:
323-
self.pip = piptree.pipdata(Target=utils.get_python_executable(self.target))
324-
pip_list = self.pip.pip_list()
325-
except:
326-
# if failure back to pip list (will use packages.ini for names)
327-
cmdx = [
328-
utils.get_python_executable(self.target), # PyPy !
329-
"-m",
330-
"pip",
331-
"list",
332-
]
333-
pip_list_raw = utils.exec_run_cmd(cmdx).splitlines()
334-
# pip list gives 2 lines of titles to ignore
335-
pip_list = [l.split() for l in pip_list_raw[2:]]
319+
if str(Path(sys.executable).parent) == self.target:
320+
self.pip = piptree.pipdata()
321
322+
self.pip = piptree.pipdata(Target=utils.get_python_executable(self.target))
323+
pip_list = self.pip.pip_list()
336324

337325
# create pip package list
338326
wppm = [

0 commit comments

Comments
 (0)
0