Skip to content

Commit

Permalink
Merge pull request #23 from AlexanderWells-diamond/fix_cothread_warning
Browse files Browse the repository at this point in the history
Only print warning when using old cothread version
  • Loading branch information
AlexanderWells-diamond authored Jul 31, 2024
2 parents cd2ad10 + 089d658 commit 581fd56
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/python/epicscorelibs/path/cothread.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,18 @@

from . import get_lib

if 'cothread.load_ca' in sys.modules or 'cothread.catools' in sys.modules:
warnings.warn("epicscorelibs.path.cothread must be imported before cothread.catools to have effect")
def check_cothread_order():
if "cothread" not in sys.modules:
return
cothread = sys.modules.get("cothread")
# >= 2.16 will attempt to import this module
ver = tuple(int(c) for c in cothread.__version__.split("."))
if ver < (2, 16):
warnings.warn("epicscorelibs.path.cothread must be imported before cothread.catools to have effect")


check_cothread_order()
del check_cothread_order

# don't override if already set
if 'CATOOLS_LIBCA_PATH' not in os.environ:
Expand Down

0 comments on commit 581fd56

Please sign in to comment.