Commit 8e8d68b7 authored by Vincent Stehlé's avatar Vincent Stehlé
Browse files

parser.py: handle missing packaging gracefully



The packaging library is not always installed even though it is standard.
Try to handle its absence gracefully.
Signed-off-by: Vincent Stehlé's avatarVincent Stehlé <vincent.stehle@arm.com>
parent 2049e5b8
......@@ -8,7 +8,11 @@ import csv
import logging
import json
import re
from packaging import version
try:
from packaging import version
except ImportError:
print('No packaging...')
try:
import yaml
......@@ -22,7 +26,8 @@ if 'yaml' in sys.modules:
from yaml import Dumper
# Not all yaml versions have a Loader argument.
if version.parse(yaml.__version__) >= version.parse('5.1'):
if 'packaging.version' in sys.modules and \
version.parse(yaml.__version__) >= version.parse('5.1'):
yaml_load_args = {'Loader': yaml.FullLoader}
else:
yaml_load_args = {}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment