comparison libervia/server/tasks/implicit/task_brython.py @ 1515:73c848c2f41e

tasks (brython): fix version retrieval for Brython 3.11 (and 3.10?)
author Goffi <goffi@goffi.org>
date Mon, 22 May 2023 11:57:49 +0200
parents 106bae41f5c8
children
comparison
equal deleted inserted replaced
1514:16228994ca3b 1515:73c848c2f41e
44 ) 44 )
45 installed_ver = None 45 installed_ver = None
46 46
47 try: 47 try:
48 import brython 48 import brython
49 from brython import version as brython_version 49 try:
50 from brython.__main__ import implementation
51 except ImportError:
52 from brython.version import implementation
50 except ModuleNotFoundError as e: 53 except ModuleNotFoundError as e:
51 log.error('"brython" module is missing, can\'t use browser code for Brython') 54 log.error('"brython" module is missing, can\'t use browser code for Brython')
52 raise e 55 raise e
53 ver = [int(v) for v in brython_version.implementation.split('.')[:3]] 56 ver = [int(v) for v in implementation.split('.')[:3]]
54 if ver != installed_ver: 57 if ver != installed_ver:
55 log.info(_("Installing Brython v{version}").format( 58 log.info(_("Installing Brython v{version}").format(
56 version='.'.join(str(v) for v in ver))) 59 version='.'.join(str(v) for v in ver)))
57 data_path = Path(brython.__file__).parent / 'data' 60 data_path = Path(brython.__file__).parent / 'data'
58 # shutil has blocking method, but the task is run before we start 61 # shutil has blocking method, but the task is run before we start