Skip to content

Commit f947b53

Browse files
committed
fix wppm bug
1 parent 9f31bc0 commit f947b53

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

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

wppm/packagemetadata.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import importlib.metadata
1414
import email
1515
#from packaging.utils import canonicalize_name
16-
from utils import normalize as canonicalize_name
1716
# --- Abstract metadata accessor ---
1817

1918
class PackageMetadata:
@@ -31,7 +30,7 @@ def get_installed_metadata(path = None) -> List[PackageMetadata]:
3130
pkgs = []
3231
distro = importlib.metadata.distributions(path = path) if path else importlib.metadata.distributions()
3332
for dist in distro:
34-
name = canonicalize_name(dist.metadata['Name'])
33+
name = utils.canonicalize_name(dist.metadata['Name'])
3534
version = dist.version
3635
summary = dist.metadata.get("Summary", ""),
3736
description = dist.metadata.get("Description", ""),
@@ -73,7 +72,7 @@ def extract_metadata_from_sdist(path: str) -> PackageMetadata:
7372

7473
def parse_metadata_file(txt: str) -> PackageMetadata:
7574
meta = email.message_from_string(txt)
76-
name = canonicalize_name(meta.get('Name', ''))
75+
name = utils.canonicalize_name(meta.get('Name', ''))
7776
version = meta.get('Version', '')
7877
summary = meta.get('Summary', '')
7978
description = meta.get('Description', '')

wppm/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,10 @@ def normalize(this):
303303
"""Apply PEP 503 normalization to the string."""
304304
return re.sub(r"[-_.]+", "-", this).lower()
305305

306+
def canonicalize_name(this):
307+
"""Apply PEP 503 normalization to the string."""
308+
return re.sub(r"[-_.]+", "-", this).lower()
309+
306310
def zip_directory(folder_path, output_zip_path):
307311
folder_path = Path(folder_path)
308312
output_zip_path = Path(output_zip_path)

0 commit comments

Comments
 (0)