From ce0b43d919f07d96d1b94e9d14d03e935e80011d Mon Sep 17 00:00:00 2001 From: Dean Serenevy Date: Thu, 9 Jul 2020 12:44:41 -0400 Subject: [PATCH] Remove dependency on 3rd party packaging library --- jc/cli.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jc/cli.py b/jc/cli.py index 7c72d437..fb4d3d05 100644 --- a/jc/cli.py +++ b/jc/cli.py @@ -17,7 +17,6 @@ from pygments.style import Style from pygments.token import (Name, Number, String, Keyword) from pygments.lexers import JsonLexer from pygments.formatters import Terminal256Formatter -from packaging import version import jc.appdirs as appdirs @@ -100,7 +99,9 @@ if os.path.isdir(local_parsers_dir): parsers.append(plugin_name) -if version.parse(pygments.__version__) < version.parse("2.4.0"): +# We only support 2.3.0+, pygments changed color names in 2.4.0. +# startswith is sufficient and avoids potential exceptions from split and int. +if pygments.__version__.startswith("2.3."): PYGMENT_COLOR = { 'black': '#ansiblack', 'red': '#ansidarkred',