Skip to content

Commit

Permalink
more utf-8 , more piptree navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
stonebig committed Jul 8, 2023
1 parent 6b074d7 commit 055f845
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
8 changes: 6 additions & 2 deletions diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,12 @@ def from_file(self, basedir):
/ f"WinPython{self.flavor}-{self.architecture}bit-{self.version}.md"
)

with open(fname, "r") as fdesc: # python3 doesn't like 'rb'
text = fdesc.read()
try:
with open(fname, "r", encoding = 'utf-8') as fdesc: # python3 doesn't like 'rb'
text = fdesc.read()
except:
with open(fname, "r") as fdesc: # python3 doesn't like 'rb'
text = fdesc.read()
self.from_text(text)

def from_text(self, text):
Expand Down
2 changes: 1 addition & 1 deletion make.py
Original file line number Diff line number Diff line change
Expand Up @@ -2022,7 +2022,7 @@ def make(
+ f"{self.winpyver2}.md"
)
)
open(fname, "w").write(self.package_index_wiki)
open(fname, "w", encoding='utf-8').write(self.package_index_wiki)
# Copy to winpython/changelogs
shutil.copyfile(
fname,
Expand Down
2 changes: 1 addition & 1 deletion winpython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
OTHER DEALINGS IN THE SOFTWARE.
"""

__version__ = '6.3.20230611'
__version__ = '6.4.20230625'
__license__ = __doc__
__project_url__ = 'http://winpython.github.io/'
14 changes: 10 additions & 4 deletions winpython/piptree.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ def normalize(this):
class pipdata:
"""Wrapper aroud pip inspect"""

def __init__(self):
def __init__(self, Target=None):

# get pip_inpsect raw data in json form
pip_inspect = utils.exec_run_cmd(["pip", "inspect"])
if Target == None:
pip_inspect = utils.exec_run_cmd(["pip", "inspect"])
else:
pip_inspect = utils.exec_run_cmd(["chcp", "65001" ,"&", Target , "-m", "pip", "inspect"])
pip_json = json.loads(pip_inspect)

# create a distro{} dict of Packages
Expand Down Expand Up @@ -194,6 +197,9 @@ def description(self, pp):
if pp in self.distro:
return print("\n".join(self.distro[pp]["description"].split(r"\n")))

def pip_list(self):
def pip_list(self, full=False):
"""do like pip list"""
return [(p, self.distro[p]["version"]) for p in sorted(self.distro)]
if full:
return [(p, self.distro[p]["version"], self.distro[p]["summary"]) for p in sorted(self.distro)]
else:
return [(p, self.distro[p]["version"]) for p in sorted(self.distro)]

0 comments on commit 055f845

Please sign in to comment.