mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-25 19:28:26 +08:00
artiq_dir: move out of tools to unlink dependencies
This commit is contained in:
parent
cbb60337ae
commit
d1119d7747
@ -1,3 +1,7 @@
|
|||||||
from ._version import get_versions
|
from ._version import get_versions
|
||||||
__version__ = get_versions()['version']
|
__version__ = get_versions()['version']
|
||||||
del get_versions
|
del get_versions
|
||||||
|
|
||||||
|
import os
|
||||||
|
__artiq_dir__ = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
del os
|
||||||
|
@ -2,6 +2,8 @@ import os, sys
|
|||||||
|
|
||||||
from pythonparser import diagnostic
|
from pythonparser import diagnostic
|
||||||
|
|
||||||
|
from artiq import __artiq_dir__ as artiq_dir
|
||||||
|
|
||||||
from artiq.language.core import *
|
from artiq.language.core import *
|
||||||
from artiq.language.types import *
|
from artiq.language.types import *
|
||||||
from artiq.language.units import *
|
from artiq.language.units import *
|
||||||
@ -16,7 +18,7 @@ from artiq.coredevice import exceptions
|
|||||||
|
|
||||||
def _render_diagnostic(diagnostic, colored):
|
def _render_diagnostic(diagnostic, colored):
|
||||||
def shorten_path(path):
|
def shorten_path(path):
|
||||||
return path.replace(os.path.normpath(os.path.join(__file__, "..", "..")), "<artiq>")
|
return path.replace(artiq_dir, "<artiq>")
|
||||||
lines = [shorten_path(path) for path in diagnostic.render(colored)]
|
lines = [shorten_path(path) for path in diagnostic.render(colored)]
|
||||||
return "\n".join(lines)
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ import linecache
|
|||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from artiq import __artiq_dir__ as artiq_dir
|
||||||
from artiq.coredevice.runtime import source_loader
|
from artiq.coredevice.runtime import source_loader
|
||||||
|
|
||||||
|
|
||||||
@ -36,8 +37,7 @@ class CoreException:
|
|||||||
else:
|
else:
|
||||||
formatted_address = " (RA=0x{:x})".format(address)
|
formatted_address = " (RA=0x{:x})".format(address)
|
||||||
|
|
||||||
filename = filename.replace(os.path.normpath(os.path.join(os.path.dirname(__file__),
|
filename = filename.replace(artiq_dir, "<artiq>")
|
||||||
"..")), "<artiq>")
|
|
||||||
if column == -1:
|
if column == -1:
|
||||||
lines.append(" File \"{file}\", line {line}, in {function}{address}".
|
lines.append(" File \"{file}\", line {line}, in {function}{address}".
|
||||||
format(file=filename, line=line, function=function,
|
format(file=filename, line=line, function=function,
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
|
from artiq import __artiq_dir__ as artiq_dir
|
||||||
|
|
||||||
|
|
||||||
class SourceLoader:
|
class SourceLoader:
|
||||||
def __init__(self, runtime_root):
|
def __init__(self, runtime_root):
|
||||||
self.runtime_root = runtime_root
|
self.runtime_root = runtime_root
|
||||||
@ -8,5 +11,4 @@ class SourceLoader:
|
|||||||
with open(os.path.join(self.runtime_root, filename)) as f:
|
with open(os.path.join(self.runtime_root, filename)) as f:
|
||||||
return f.read()
|
return f.read()
|
||||||
|
|
||||||
artiq_root = os.path.join(os.path.dirname(__file__), "..", "..")
|
source_loader = SourceLoader(os.path.join(artiq_dir, "soc", "runtime"))
|
||||||
source_loader = SourceLoader(os.path.join(artiq_root, "soc", "runtime"))
|
|
||||||
|
@ -7,6 +7,7 @@ import subprocess
|
|||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import artiq
|
import artiq
|
||||||
|
from artiq import __artiq_dir__ as artiq_dir
|
||||||
from artiq.frontend.bit2bin import bit2bin
|
from artiq.frontend.bit2bin import bit2bin
|
||||||
|
|
||||||
|
|
||||||
@ -70,7 +71,7 @@ def main():
|
|||||||
}[opts.target]
|
}[opts.target]
|
||||||
|
|
||||||
if opts.dir is None:
|
if opts.dir is None:
|
||||||
opts.dir = os.path.join(os.path.dirname(artiq.__file__), "binaries",
|
opts.dir = os.path.join(artiq_dir, "binaries",
|
||||||
"{}-{}".format(opts.target, opts.adapter))
|
"{}-{}".format(opts.target, opts.adapter))
|
||||||
|
|
||||||
conv = False
|
conv = False
|
||||||
|
@ -10,6 +10,7 @@ import os
|
|||||||
from quamash import QEventLoop, QtGui, QtCore
|
from quamash import QEventLoop, QtGui, QtCore
|
||||||
from pyqtgraph import dockarea
|
from pyqtgraph import dockarea
|
||||||
|
|
||||||
|
from artiq import __artiq_dir__ as artiq_dir
|
||||||
from artiq.tools import *
|
from artiq.tools import *
|
||||||
from artiq.protocols.pc_rpc import AsyncioClient
|
from artiq.protocols.pc_rpc import AsyncioClient
|
||||||
from artiq.gui.models import ModelSubscriber
|
from artiq.gui.models import ModelSubscriber
|
||||||
|
@ -20,7 +20,7 @@ from misoc.targets.kc705 import MiniSoC, soc_kc705_args, soc_kc705_argdict
|
|||||||
from artiq.gateware.soc import AMPSoC
|
from artiq.gateware.soc import AMPSoC
|
||||||
from artiq.gateware import rtio, nist_qc1, nist_clock, nist_qc2
|
from artiq.gateware import rtio, nist_qc1, nist_clock, nist_qc2
|
||||||
from artiq.gateware.rtio.phy import ttl_simple, ttl_serdes_7series, dds
|
from artiq.gateware.rtio.phy import ttl_simple, ttl_serdes_7series, dds
|
||||||
from artiq.tools import artiq_dir
|
from artiq import __artiq_dir__ as artiq_dir
|
||||||
from artiq import __version__ as artiq_version
|
from artiq import __version__ as artiq_version
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ from misoc.targets.pipistrello import *
|
|||||||
from artiq.gateware.soc import AMPSoC
|
from artiq.gateware.soc import AMPSoC
|
||||||
from artiq.gateware import rtio, nist_qc1
|
from artiq.gateware import rtio, nist_qc1
|
||||||
from artiq.gateware.rtio.phy import ttl_simple, ttl_serdes_spartan6, dds
|
from artiq.gateware.rtio.phy import ttl_simple, ttl_serdes_spartan6, dds
|
||||||
from artiq.tools import artiq_dir
|
from artiq import __artiq_dir__ as artiq_dir
|
||||||
from artiq import __version__ as artiq_version
|
from artiq import __version__ as artiq_version
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ from artiq.language.environment import is_experiment
|
|||||||
from artiq.protocols import pyon
|
from artiq.protocols import pyon
|
||||||
|
|
||||||
|
|
||||||
__all__ = ["artiq_dir", "parse_arguments", "elide", "short_format", "file_import",
|
__all__ = ["parse_arguments", "elide", "short_format", "file_import",
|
||||||
"get_experiment", "verbosity_args", "simple_network_args", "init_logger",
|
"get_experiment", "verbosity_args", "simple_network_args", "init_logger",
|
||||||
"bind_address_from_args", "atexit_register_coroutine",
|
"bind_address_from_args", "atexit_register_coroutine",
|
||||||
"exc_to_warning", "asyncio_wait_or_cancel",
|
"exc_to_warning", "asyncio_wait_or_cancel",
|
||||||
@ -25,8 +25,6 @@ __all__ = ["artiq_dir", "parse_arguments", "elide", "short_format", "file_import
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
artiq_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)))
|
|
||||||
|
|
||||||
|
|
||||||
def parse_arguments(arguments):
|
def parse_arguments(arguments):
|
||||||
d = {}
|
d = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user