frontend: add --version to common tools

This commit is contained in:
Sebastien Bourdeauducq 2019-11-14 11:42:31 +08:00
parent f8a7e278b8
commit 4416378d21
9 changed files with 38 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import logging
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
from quamash import QEventLoop from quamash import QEventLoop
from artiq import __version__ as artiq_version
from artiq import __artiq_dir__ as artiq_dir from artiq import __artiq_dir__ as artiq_dir
from artiq.tools import (add_common_args, atexit_register_coroutine, from artiq.tools import (add_common_args, atexit_register_coroutine,
get_user_config_dir) get_user_config_dir)
@ -21,6 +22,9 @@ logger = logging.getLogger(__name__)
def get_argparser(): def get_argparser():
parser = argparse.ArgumentParser(description="ARTIQ Browser") parser = argparse.ArgumentParser(description="ARTIQ Browser")
parser.add_argument("--version", action="version",
version="ARTIQ v{}".format(artiq_version),
help="print the ARTIQ version number")
parser.add_argument("--db-file", default=None, parser.add_argument("--db-file", default=None,
help="database file for local browser settings " help="database file for local browser settings "
"(default: %(default)s)") "(default: %(default)s)")

View File

@ -4,6 +4,7 @@ import os, sys, logging, argparse
from sipyco import common_args from sipyco import common_args
from artiq import __version__ as artiq_version
from artiq.master.databases import DeviceDB, DatasetDB from artiq.master.databases import DeviceDB, DatasetDB
from artiq.master.worker_db import DeviceManager, DatasetManager from artiq.master.worker_db import DeviceManager, DatasetManager
from artiq.language.environment import ProcessArgumentManager from artiq.language.environment import ProcessArgumentManager
@ -16,6 +17,9 @@ logger = logging.getLogger(__name__)
def get_argparser(): def get_argparser():
parser = argparse.ArgumentParser(description="ARTIQ static compiler") parser = argparse.ArgumentParser(description="ARTIQ static compiler")
parser.add_argument("--version", action="version",
version="ARTIQ v{}".format(artiq_version),
help="print the ARTIQ version number")
common_args.verbosity_args(parser) common_args.verbosity_args(parser)
parser.add_argument("--device-db", default="device_db.py", parser.add_argument("--device-db", default="device_db.py",

View File

@ -5,6 +5,7 @@ import struct
from sipyco import common_args from sipyco import common_args
from artiq import __version__ as artiq_version
from artiq.master.databases import DeviceDB from artiq.master.databases import DeviceDB
from artiq.coredevice.comm_kernel import CommKernel from artiq.coredevice.comm_kernel import CommKernel
from artiq.coredevice.comm_mgmt import CommMgmt from artiq.coredevice.comm_mgmt import CommMgmt
@ -14,6 +15,9 @@ from artiq.coredevice.profiler import CallgrindWriter
def get_argparser(): def get_argparser():
parser = argparse.ArgumentParser(description="ARTIQ core device " parser = argparse.ArgumentParser(description="ARTIQ core device "
"management tool") "management tool")
parser.add_argument("--version", action="version",
version="ARTIQ v{}".format(artiq_version),
help="print the ARTIQ version number")
common_args.verbosity_args(parser) common_args.verbosity_args(parser)
parser.add_argument("--device-db", default="device_db.py", parser.add_argument("--device-db", default="device_db.py",

View File

@ -13,6 +13,7 @@ from sipyco.pc_rpc import AsyncioClient, Client
from sipyco.broadcast import Receiver from sipyco.broadcast import Receiver
from sipyco import common_args from sipyco import common_args
from artiq import __version__ as artiq_version
from artiq import __artiq_dir__ as artiq_dir, __version__ as artiq_version from artiq import __artiq_dir__ as artiq_dir, __version__ as artiq_version
from artiq.tools import atexit_register_coroutine, get_user_config_dir from artiq.tools import atexit_register_coroutine, get_user_config_dir
from artiq.gui.models import ModelSubscriber from artiq.gui.models import ModelSubscriber
@ -23,6 +24,9 @@ from artiq.dashboard import (experiments, shortcuts, explorer,
def get_argparser(): def get_argparser():
parser = argparse.ArgumentParser(description="ARTIQ Dashboard") parser = argparse.ArgumentParser(description="ARTIQ Dashboard")
parser.add_argument("--version", action="version",
version="ARTIQ v{}".format(artiq_version),
help="print the ARTIQ version number")
parser.add_argument( parser.add_argument(
"-s", "--server", default="::1", "-s", "--server", default="::1",
help="hostname or IP of the master to connect to") help="hostname or IP of the master to connect to")

View File

@ -7,6 +7,8 @@ import textwrap
from collections import defaultdict from collections import defaultdict
from itertools import count from itertools import count
from artiq import __version__ as artiq_version
def process_header(output, description): def process_header(output, description):
if description["target"] != "kasli": if description["target"] != "kasli":
@ -473,6 +475,9 @@ def process(output, master_description, satellites):
def main(): def main():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="ARTIQ device database template builder") description="ARTIQ device database template builder")
parser.add_argument("--version", action="version",
version="ARTIQ v{}".format(artiq_version),
help="print the ARTIQ version number")
parser.add_argument("master_description", metavar="MASTER_DESCRIPTION", parser.add_argument("master_description", metavar="MASTER_DESCRIPTION",
help="JSON system description file for the standalone or master node") help="JSON system description file for the standalone or master node")
parser.add_argument("-o", "--output", parser.add_argument("-o", "--output",

View File

@ -12,6 +12,7 @@ from collections import defaultdict
from sipyco import common_args from sipyco import common_args
from artiq import __version__ as artiq_version
from artiq import __artiq_dir__ as artiq_dir from artiq import __artiq_dir__ as artiq_dir
from artiq.remoting import SSHClient, LocalClient from artiq.remoting import SSHClient, LocalClient
from artiq.frontend.bit2bin import bit2bin from artiq.frontend.bit2bin import bit2bin
@ -42,6 +43,10 @@ Prerequisites:
plugdev group: 'sudo adduser $USER plugdev' and re-login. plugdev group: 'sudo adduser $USER plugdev' and re-login.
""") """)
parser.add_argument("--version", action="version",
version="ARTIQ v{}".format(artiq_version),
help="print the ARTIQ version number")
common_args.verbosity_args(parser) common_args.verbosity_args(parser)
parser.add_argument("-n", "--dry-run", parser.add_argument("-n", "--dry-run",

View File

@ -12,6 +12,7 @@ from sipyco.logging_tools import Server as LoggingServer
from sipyco.broadcast import Broadcaster from sipyco.broadcast import Broadcaster
from sipyco import common_args from sipyco import common_args
from artiq import __version__ as artiq_version
from artiq.tools import atexit_register_coroutine from artiq.tools import atexit_register_coroutine
from artiq.master.log import log_args, init_log from artiq.master.log import log_args, init_log
from artiq.master.databases import DeviceDB, DatasetDB from artiq.master.databases import DeviceDB, DatasetDB
@ -25,6 +26,9 @@ logger = logging.getLogger(__name__)
def get_argparser(): def get_argparser():
parser = argparse.ArgumentParser(description="ARTIQ master") parser = argparse.ArgumentParser(description="ARTIQ master")
parser.add_argument("--version", action="version",
version="ARTIQ v{}".format(artiq_version),
help="print the ARTIQ version number")
common_args.simple_network_args(parser, [ common_args.simple_network_args(parser, [
("notify", "notifications", 3250), ("notify", "notifications", 3250),

View File

@ -14,6 +14,7 @@ from llvmlite_artiq import binding as llvm
from sipyco import common_args from sipyco import common_args
from artiq import __version__ as artiq_version
from artiq.language.environment import EnvExperiment, ProcessArgumentManager from artiq.language.environment import EnvExperiment, ProcessArgumentManager
from artiq.language.types import TBool from artiq.language.types import TBool
from artiq.master.databases import DeviceDB, DatasetDB from artiq.master.databases import DeviceDB, DatasetDB
@ -127,6 +128,9 @@ class DummyCCB:
def get_argparser(with_file=True): def get_argparser(with_file=True):
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Local experiment running tool") description="Local experiment running tool")
parser.add_argument("--version", action="version",
version="ARTIQ v{}".format(artiq_version),
help="print the ARTIQ version number")
common_args.verbosity_args(parser) common_args.verbosity_args(parser)
parser.add_argument("--device-db", default="device_db.py", parser.add_argument("--device-db", default="device_db.py",

View File

@ -3,7 +3,7 @@
import argparse import argparse
import sys import sys
import subprocess import subprocess
from artiq import __version__ as artiq_version
def get_argparser(): def get_argparser():
@ -11,6 +11,9 @@ def get_argparser():
description="ARTIQ session manager. " description="ARTIQ session manager. "
"Automatically runs the master, dashboard and " "Automatically runs the master, dashboard and "
"local controller manager on the current machine.") "local controller manager on the current machine.")
parser.add_argument("--version", action="version",
version="ARTIQ v{}".format(artiq_version),
help="print the ARTIQ version number")
parser.add_argument("-m", action="append", default=[], parser.add_argument("-m", action="append", default=[],
help="add argument to the master command line") help="add argument to the master command line")
parser.add_argument("-d", action="append", default=[], parser.add_argument("-d", action="append", default=[],