Drop deprecation filters for pip and yamllint
[mudpy.git] / mudpy / version.py
index afe66eb..aa1e3eb 100644 (file)
@@ -1,6 +1,6 @@
 """Version and diagnostic information for the mudpy engine."""
 
-# Copyright (c) 2018-2020 mudpy authors. Permission to use, copy,
+# Copyright (c) 2018-2021 mudpy authors. Permission to use, copy,
 # modify, and distribute this software is granted under terms
 # provided in the LICENSE file distributed with this software.
 
@@ -8,9 +8,6 @@ import json
 import sys
 
 
-# TODO(fungi) Clean up once Python 3.6 is the oldest interpreter supported
-if not hasattr(__builtins__, 'ModuleNotFoundError'):
-    ModuleNotFoundError = ImportError
 # TODO(fungi) Clean up once Python 3.8 is the oldest interpreter supported
 try:
     import importlib.metadata
@@ -116,8 +113,16 @@ class Versions:
 
 
 def _normalize_project(project_name):
-    """Convenience function to normalize Python project names."""
+    """Strip and normalize Python project names."""
+
+    # Use lower-case names for ease of comparison
     if use_importlib:
-        return project_name.lower()
+        project_name = project_name.lower()
     else:
-        return pkg_resources.safe_name(project_name).lower()
+        project_name = pkg_resources.safe_name(project_name).lower()
+
+    # Remove any version specifiers included with requirements strings
+    for operator in ' <>=!':
+        project_name = project_name.split(operator)[0]
+
+    return project_name