summaryrefslogtreecommitdiff
path: root/pkg_resources
diff options
context:
space:
mode:
authorTomas Orsava <torsava@redhat.com>2018-04-12 14:55:06 +0200
committerTomas Orsava <torsava@redhat.com>2018-04-12 15:01:14 +0200
commit4377d517a95a0df2d4e0941438bebdb9f804a527 (patch)
treef3679e84a36423d61da42ba40b22603c42faa56f /pkg_resources
parent0e62448b2674b3b321be28496b87362bc76ebcd1 (diff)
downloadpython-setuptools-git-4377d517a95a0df2d4e0941438bebdb9f804a527.tar.gz
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
Diffstat (limited to 'pkg_resources')
-rw-r--r--pkg_resources/__init__.py4
1 files changed, 2 insertions, 2 deletions
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):