From 4377d517a95a0df2d4e0941438bebdb9f804a527 Mon Sep 17 00:00:00 2001 From: Tomas Orsava Date: Thu, 12 Apr 2018 14:55:06 +0200 Subject: Make safe_name compliant to PEP 503 and behaviour of pip > 8.1.2 According to PEP 503, a "normalized" project name has all runs of the characters ., - and _ replaced with a single - character. [0] Similarly, since version 8.1.2, that is the behaviour of pip as well. [1] However, Setuptools still allows a . in the normalized name, which is causing trouble down the line. [0] https://www.python.org/dev/peps/pep-0503/#normalized-names [1] https://github.com/pypa/pip/issues/3666 --- pkg_resources/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkg_resources') diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 8d95bd29..19a7eba8 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -1309,9 +1309,9 @@ def get_default_cache(): def safe_name(name): """Convert an arbitrary string to a standard distribution name - Any runs of non-alphanumeric/. characters are replaced with a single '-'. + Any runs of non-alphanumeric characters are replaced with a single '-'. """ - return re.sub('[^A-Za-z0-9.]+', '-', name) + return re.sub('[^A-Za-z0-9]+', '-', name) def safe_version(version): -- cgit v1.2.3