merge artiq.coredevice.runtime into comm_kernel

This commit is contained in:
Sebastien Bourdeauducq 2022-02-28 12:04:46 +08:00
parent 2e4233274f
commit 64a0c4b29a
2 changed files with 11 additions and 15 deletions

View File

@ -5,6 +5,7 @@ import numpy
import socket import socket
import re import re
import linecache import linecache
import os
from enum import Enum from enum import Enum
from fractions import Fraction from fractions import Fraction
from collections import namedtuple from collections import namedtuple
@ -12,7 +13,6 @@ from collections import namedtuple
from artiq.coredevice import exceptions from artiq.coredevice import exceptions
from artiq.coredevice.comm import initialize_connection from artiq.coredevice.comm import initialize_connection
from artiq import __version__ as software_version from artiq import __version__ as software_version
from artiq.coredevice.runtime import source_loader
from artiq import __artiq_dir__ as artiq_dir from artiq import __artiq_dir__ as artiq_dir
@ -175,6 +175,16 @@ class CommKernelDummy:
pass pass
class SourceLoader:
def __init__(self, runtime_root):
self.runtime_root = runtime_root
def get_source(self, filename):
with open(os.path.join(self.runtime_root, filename)) as f:
return f.read()
source_loader = SourceLoader(os.path.join(artiq_dir, "soc", "runtime"))
class CoreException: class CoreException:
"""Information about an exception raised or passed through the core device.""" """Information about an exception raised or passed through the core device."""

View File

@ -1,14 +0,0 @@
import os
from artiq import __artiq_dir__ as artiq_dir
class SourceLoader:
def __init__(self, runtime_root):
self.runtime_root = runtime_root
def get_source(self, filename):
with open(os.path.join(self.runtime_root, filename)) as f:
return f.read()
source_loader = SourceLoader(os.path.join(artiq_dir, "soc", "runtime"))