Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions winpython/utils.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -23,7 +19,6 @@
import tarfile
import zipfile
import atexit
import io
import winreg

# SOURCE_PATTERN defines what an acceptable source package name is
Expand Down Expand Up @@ -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:
Expand Down
19 changes: 6 additions & 13 deletions winpython/wppm.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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")):
Expand All @@ -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):
Expand Down