artiq/artiq/frontend/lda_controller.py
Robert Jordens 6cc3a9d973 frontend/*: move to artiq.frontend, make entry_points
* solves the trouble of having to setup PATH and PYTHONPATH in a project
  specific way and keep them changing
* works well with virtualenvs
* works under windows where the shebang is meaningless
* works if your python is not named "python3"

* can use "pip3 install --user --editable ."
  * creates an egg-link in ~/.local/share/... pointing to $PWD
  * generates the scripts and copies them to ~/.local/bin which is likely
    already in your $PATH
  * analogously under windows

* or call scripts as "python3 -m artiq.frontend.master"
2015-01-17 16:02:43 +08:00

31 lines
935 B
Python
Executable File

#!/usr/bin/env python3
import argparse
from artiq.devices.lda.driver import Lda, Ldasim
from artiq.management.pc_rpc import simple_server_loop
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--device', default="LDA-102",
choices=["LDA-102", "LDA-602", "sim"])
parser.add_argument('--bind', default="::1",
help="hostname or IP address to bind to")
parser.add_argument('-p', '--port', default=3253, type=int,
help="TCP port to listen to")
parser.add_argument('-s', '--serial', default=None,
help="USB serial number of the device")
args = parser.parse_args()
if args.device == "sim":
lda = Ldasim()
else:
lda = Lda(args.serial, args.device)
simple_server_loop({"lda": lda},
args.bind, args.port)
if __name__ == "__main__":
main()