Files
Pier_v1/RAG/design-model-box-sample_2/deployment/install_dwg_runtime.py
T
ahnyongjooandClaude Sonnet 5.5 964a841de1 chore(rebar): Pier_T_rebar 작업 폴더 초기 구성 및 외부 의존 파일 통합
- Code\rebar_pipeline, review_pipeline, pier-program을 정션에서 실제 폴더로 전환
- Code\rhino_mcp 및 CLAUDE_rhino배경.md 추가, .mcp.json은 PYTHONPATH로 새 위치 사용
- pier-program 내부 .git 제거(이력은 backup\pier-program_20261028.bundle에 보관)
- worktree 가이드 반영(CLAUDE.local.md, HANDOFF.md)
- D:\Rhino-MCP 경로 참조를 새 위치로 치환

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-28 11:20:18 +09:00

47 lines
2.0 KiB
Python

"""Install only the same pinned DWG decoder used on the verified local host.
Build-time only. No drawings, credentials or model generation are involved.
"""
import hashlib
from pathlib import Path
import platform
import shutil
import tarfile
import tempfile
import urllib.request
URL = ('https://conda.anaconda.org/conda-forge/linux-64/'
'libredwg-0.11.3876-py38pl5321hf1fe3a4_2.tar.bz2')
SHA256 = '23e82c10d5e09b1444ca099c3710893f363d67a98417b0b69afd7155b9759f21'
def install(destination=Path('/opt/libredwg')):
if platform.machine() not in ('x86_64', 'AMD64'):
raise RuntimeError('This pinned converter requires a linux/amd64 Docker host')
members = {'bin/dwg2dxf': 'bin/dwg2dxf',
'lib/libredwg.so.0.0.11': 'lib/libredwg.so.0.0.11',
'info/licenses/COPYING': 'licenses/COPYING',
'info/recipe/meta.yaml': 'licenses/package-source.yaml'}
with tempfile.TemporaryDirectory(prefix='dwg-runtime-') as tmp:
archive = Path(tmp) / 'runtime.tar.bz2'
with urllib.request.urlopen(URL, timeout=120) as response, archive.open('wb') as out:
shutil.copyfileobj(response, out)
with archive.open('rb') as stream:
if hashlib.file_digest(stream, 'sha256').hexdigest() != SHA256:
raise ValueError('DWG runtime checksum mismatch')
with tarfile.open(archive) as bundle:
for source, relative in members.items():
member = bundle.getmember(source)
if not member.isfile():
raise ValueError('Expected regular DWG runtime file')
target = destination / relative
target.parent.mkdir(parents=True, exist_ok=True)
with bundle.extractfile(member) as inp, target.open('xb') as out:
shutil.copyfileobj(inp, out)
target.chmod(0o755 if relative.startswith(('bin/', 'lib/')) else 0o644)
(destination / 'lib/libredwg.so.0').symlink_to('libredwg.so.0.0.11')
if __name__ == '__main__':
install()