Files
Andrey afdf62cfa4 Добавить проверку Flash SCI, системные диалоги и векторизацию PDF
Расширить протокол SCI проверкой содержимого Flash и комплектом RAM-ядер.
Добавить утилиту векторизации PDF с OCR, общие диалоги DSView и проверки.
2026-11-18 16:03:53 +03:00

49 lines
2.7 KiB
Python

"""Build DSView with the Zynq Ethernet driver using the SETGUI recipe."""
import argparse
from pathlib import Path
import shutil
import subprocess
import sys
HERE = Path(__file__).resolve().parent
TEMPLATES = HERE.parents[2]
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--source', type=Path, default=Path('build/dsview-upstream'))
parser.add_argument('--output', type=Path, required=True)
parser.add_argument('--msys-root', type=Path, required=True)
parser.add_argument('--recipe', type=Path, default=HERE.parent)
parser.add_argument('--win7', action='store_true') # Вариант Ethernet должен сохранить тот же совместимый Python, что базовый компонент DSView.
parser.add_argument('--python-root', type=Path) # Явная установка Python 3.8 передаётся каноническому рецепту без подмены ABI.
args = parser.parse_args()
source, output, recipe = (p.resolve() for p in (args.source, args.output, args.recipe))
revision = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=source, text=True).strip()
if not revision.startswith('2e9e2c8e'):
parser.error('DSView checkout must be at revision 2e9e2c8e')
analyzer = TEMPLATES / 'hdl/logic-analyzer/include'
ethernet = TEMPLATES / 'hdl/logic-udp-ethernet/include'
inputs = (HERE / 'zynq.c', HERE / 'zynq_record.c', HERE / 'zynq_record.h',
analyzer / 'zynq_la.h', analyzer / 'zynq_la_stream.h',
ethernet / 'zynq_la_pl.h')
driver = source / 'libsigrok4DSL/hardware/zynq'
driver.mkdir(parents=True, exist_ok=True)
for path in inputs:
shutil.copy2(path, driver / path.name)
subprocess.run([sys.executable, str(recipe / 'build.py'), '--source', str(source),
'--extra-patch', str(HERE / 'ethernet.patch'),
'--output', str(output), '--msys-root', str(args.msys_root.resolve()), *(['--win7', '--python-root', str(args.python_root.resolve())] if args.win7 and args.python_root else [])], check=True) # Современная сборка сохраняет прежнюю команду, Win7 получает отдельный набор параметров.
source_files = output / 'zynq-source'
source_files.mkdir(exist_ok=True)
for path in (*inputs, HERE / 'ethernet.patch'):
shutil.copy2(path, source_files / path.name)
with (output / 'SOURCE.txt').open('a', encoding='utf-8') as manifest:
manifest.write('Zynq Ethernet driver and integration patch: zynq-source/\n')
(output / 'zynq-ethernet-1').write_text('DSView Zynq Ethernet protocol 1\n', encoding='utf-8')
if __name__ == '__main__':
main()