37 lines
2.4 KiB
Python
37 lines
2.4 KiB
Python
|
|
"""登记本地原始快照、交付产物、运行环境和图表核验回执。"""
|
|||
|
|
import datetime as dt
|
|||
|
|
import platform
|
|||
|
|
import re
|
|||
|
|
from pathlib import Path
|
|||
|
|
import numpy
|
|||
|
|
import pandas
|
|||
|
|
import matplotlib
|
|||
|
|
from common import ROOT,read,dump,digest,install_offline
|
|||
|
|
|
|||
|
|
def main():
|
|||
|
|
install_offline();assert read(ROOT/'audit.json')['checks_passed']
|
|||
|
|
assert 'Ran 17 tests' in (ROOT/'unit_tests.txt').read_text() and 'OK' in (ROOT/'unit_tests.txt').read_text()
|
|||
|
|
assert read(ROOT/'validation.json')['figures_reviewed']
|
|||
|
|
assert read(ROOT/'validation.json')['own_export_containers_remaining']==0
|
|||
|
|
for path in ROOT.glob('*.md'):
|
|||
|
|
for link in re.findall(r'\]\(([^)]+)\)',path.read_text()):
|
|||
|
|
if not link.startswith(('https://','http://','#')):
|
|||
|
|
target=(path.parent/link.split('#')[0]).resolve()
|
|||
|
|
assert target.exists() or target==ROOT/'manifest.json',str(target)
|
|||
|
|
def meta(path):return {'sha256':digest(path),'bytes':path.stat().st_size}
|
|||
|
|
snapshot={str(p.relative_to(ROOT)):meta(p) for p in sorted((ROOT/'raw').glob('*.json.gz'))}
|
|||
|
|
artifacts={str(p.relative_to(ROOT)):meta(p) for p in sorted(ROOT.rglob('*'))
|
|||
|
|
if p.is_file() and p.name!='manifest.json' and not set(p.relative_to(ROOT).parts)&{'raw','cache','__pycache__'}}
|
|||
|
|
cache={str(p.relative_to(ROOT)):meta(p) for p in sorted((ROOT/'cache').glob('*')) if p.is_file()}
|
|||
|
|
dump(ROOT/'manifest.json',{'recorded_at':dt.datetime.now(dt.timezone(dt.timedelta(hours=8))).isoformat(),
|
|||
|
|
'python':platform.python_version(),'packages':{'numpy':numpy.__version__,'pandas':pandas.__version__,'matplotlib':matplotlib.__version__},
|
|||
|
|
'raw_sources':snapshot,'cache':cache,'artifacts':artifacts,
|
|||
|
|
'shared_price_sources_relative_to_research':read(ROOT/'price_coverage.json')['source_sha256'],
|
|||
|
|
'shared_phase_sources_relative_to_first_version_raw':read(ROOT/'phase_coverage.json')['source_sha256'],
|
|||
|
|
'shared_phase_batch_catalog':{'path':'../chip_accumulation_20261030/raw/coverage.json.gz','sha256':digest(ROOT.parent/'chip_accumulation_20261030/raw/coverage.json.gz')},
|
|||
|
|
'exclusions':'raw、cache及__pycache__不入Git;交付清单不计算自身摘要。',
|
|||
|
|
'execution_scope':'开发机离线分析;155独立容器只读导出;无生产部署及交易动作。'})
|
|||
|
|
print('交付文件、快照摘要与本地链接核验完成',flush=True)
|
|||
|
|
|
|||
|
|
if __name__=='__main__':main()
|