diff --git a/winpython/utils.py b/winpython/utils.py index 05d88556..523b6fa0 100644 --- a/winpython/utils.py +++ b/winpython/utils.py @@ -1,15 +1,11 @@ # -*- coding: utf-8 -*- # +# WinPython utilities # Copyright © 2012 Pierre Raybaut +# Copyright © 2014-2025+ The Winpython development team https://github.com/winpython/ # Licensed under the terms of the MIT License # (see winpython/__init__.py for details) -""" -WinPython utilities - -Created on Tue Aug 14 14:08:40 2012 -""" - import os import sys import stat @@ -23,7 +19,6 @@ import tarfile import zipfile import atexit -import io import winreg # SOURCE_PATTERN defines what an acceptable source package name is @@ -259,13 +254,13 @@ def patch_shebang_line_py(fname, to_movable=True, targetdir=""): def guess_encoding(csv_file): """guess the encoding of the given file""" # UTF_8_BOM = "\xEF\xBB\xBF" - with io.open(csv_file, "rb") as f: + with open(csv_file, "rb") as f: data = f.read(5) if data.startswith(b"\xEF\xBB\xBF"): # UTF-8 with a "BOM" (normally no BOM in utf-8) return ["utf-8-sig"] else: # in Windows, guessing utf-8 doesn't work, so we have to try try: - with io.open(csv_file, encoding="utf-8") as f: + with open(csv_file, encoding="utf-8") as f: preview = f.read(222222) return ["utf-8"] except: diff --git a/winpython/wppm.py b/winpython/wppm.py index 9d13b195..7e55f72a 100644 --- a/winpython/wppm.py +++ b/winpython/wppm.py @@ -1,15 +1,11 @@ # -*- coding: utf-8 -*- # +# WinPython Package Manager # Copyright © 2012 Pierre Raybaut +# Copyright © 2014-2025+ The Winpython development team https://github.com/winpython/ # Licensed under the terms of the MIT License # (see winpython/__init__.py for details) -""" -WinPython Package Manager - -Created on Fri Aug 03 14:32:26 2012 -""" - import os from pathlib import Path import shutil @@ -22,15 +18,14 @@ # Local imports from winpython import utils, piptree - # Workaround for installing PyVISA on Windows from source: os.environ["HOME"] = os.environ["USERPROFILE"] class Package: "standardize a Package from filename or pip list" - def __init__(self, fname, suggested_summary=None): + def __init__(self, fname, suggested_summary=None): self.fname = fname - self.description = piptree.sum_up(suggested_summary) if suggested_summary else "" + self.description = piptree.sum_up(suggested_summary) if suggested_summary else "" self.name = None self.version = None if fname.endswith((".zip", ".tar.gz", ".whl")): @@ -39,14 +34,12 @@ def __init__(self, fname, suggested_summary=None): if infos is not None: self.name, self.version = infos self.name = utils.normalize(self.name) - self.url = None + self.url = f"https://pypi.org/project/{self.name}" self.files = [] - setattr(self,'url',"https://pypi.org/project/" + self.name) - def __str__(self): return f"{self.name} {self.version}\r\n{self.description}\r\nWebsite: {self.url}" - + class Distribution: def __init__(self, target=None, verbose=False):