Make greenlet optional

The greenlet library is not always used. It is used to capture detail
of green threads but this part can be skipped in case greenlet is not
present.

Also eventlet in test requirements is not used and can be removed.

Change-Id: I57edfe4d975ce42ca92a9242d4b32e69d1cec268
This commit is contained in:
Takashi Kajinami 2024-02-07 11:51:25 +09:00
parent 489fe7c8fb
commit e43ae1115c
4 changed files with 13 additions and 4 deletions

View File

@ -75,6 +75,11 @@ from oslo_reports.generators import threading as tgen
from oslo_reports.generators import version as pgen from oslo_reports.generators import version as pgen
from oslo_reports import report from oslo_reports import report
try:
import greenlet
except ImportError:
greenlet = None
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -240,8 +245,9 @@ class GuruMeditation(object):
self.add_section('Threads', self.add_section('Threads',
tgen.ThreadReportGenerator(self.traceback)) tgen.ThreadReportGenerator(self.traceback))
self.add_section('Green Threads', if greenlet:
tgen.GreenThreadReportGenerator()) self.add_section('Green Threads',
tgen.GreenThreadReportGenerator())
self.add_section('Processes', self.add_section('Processes',
prgen.ProcessReportGenerator()) prgen.ProcessReportGenerator())

View File

@ -4,5 +4,4 @@ oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
psutil>=3.2.2 # BSD psutil>=3.2.2 # BSD
oslo.i18n>=3.15.3 # Apache-2.0 oslo.i18n>=3.15.3 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0 oslo.utils>=3.33.0 # Apache-2.0
greenlet>=0.4.15 # MIT
oslo.config>=5.1.0 # Apache-2.0 oslo.config>=5.1.0 # Apache-2.0

View File

@ -22,6 +22,10 @@ classifier =
Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: CPython
[extras]
greenlet =
greenlet>=0.4.15 # MIT
[files] [files]
packages = packages =
oslo_reports oslo_reports

View File

@ -3,7 +3,7 @@ oslotest>=3.2.0 # Apache-2.0
stestr>=2.0.0 # Apache-2.0 stestr>=2.0.0 # Apache-2.0
# for testing optional parts # for testing optional parts
eventlet!=0.18.3,!=0.20.1,>=0.18.2 # MIT greenlet>=0.4.15 # MIT
coverage!=4.4,>=4.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0