2
0
mirror of https://github.com/m-labs/artiq.git synced 2025-01-21 16:16:41 +08:00
artiq/artiq/coredevice/runtime.py
whitequark 46476516ba ARTIQException: tell linecache where to look for runtime sources.
Runtime sources can appear in the backtrace when
artiq_raise_from_c is used.
2015-08-10 20:26:07 +03:00

14 lines
438 B
Python

import os
class SourceLoader:
def __init__(self, runtime_root):
self.runtime_root = runtime_root
def get_source(self, filename):
print(os.path.join(self.runtime_root, filename))
with open(os.path.join(self.runtime_root, filename)) as f:
return f.read()
artiq_root = os.path.join(os.path.dirname(__file__), "..", "..")
source_loader = SourceLoader(os.path.join(artiq_root, "soc", "runtime"))