readback_check.py

back to table · edit · history · where entries came from · files · download

798 bytes, as of the version from 2026-12-02 04:59 (current). Recorded here, not run.

import json,sys,platform,subprocess
from pathlib import Path
import numberdb.sage as numberdb
from sage.env import SAGE_VERSION
from check_values import run
w=Path(__file__).parent
doc=json.loads((w/'stored.json').read_text())
assert doc.get('Parameters')=={}
assert len(doc['Numbers'])==1 and isinstance(doc['Numbers'][0],str)
r=run(doc['Numbers'][0])
print('CHECK_JSON='+json.dumps(r,sort_keys=True))
versions={'python':platform.python_version(),'sage':SAGE_VERSION,'numberdb':numberdb.__version__}
for name in ['flint','mpfr','gmp']:
 try:
  p=subprocess.run(['pkg-config','--modversion',name],capture_output=True,text=True)
  if p.returncode==0: versions[name]=p.stdout.strip()
 except FileNotFoundError: pass
print('VERSIONS_JSON='+json.dumps(versions))
assert not r['failures'],r['failures']