Skip to content

Commit 2a9e56a

Browse files
committed
ensure support for Python < 3.8
Signed-off-by: Paul Horton <[email protected]>
1 parent 7d1e6ef commit 2a9e56a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cyclonedx/model/bom.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
# Copyright (c) OWASP Foundation. All Rights Reserved.
1919

2020
import datetime
21+
import sys
2122
from importlib.metadata import version
2223
from typing import List
2324
from uuid import uuid4
@@ -88,6 +89,11 @@ def __repr__(self):
8889
return '<Tool {}:{}:{}>'.format(self._vendor, self._name, self._version)
8990

9091

92+
if sys.version_info >= (3, 8, 0):
93+
from importlib.metadata import version
94+
else:
95+
from importlib_metadata import version
96+
9197
try:
9298
ThisTool = Tool(vendor='CycloneDX', name='cyclonedx-python-lib', version=version('cyclonedx-python-lib'))
9399
except Exception:

0 commit comments

Comments
 (0)