Skip to content

Commit

Permalink
(DiamondLightSource/hyperion#1474) fixes to save_panda script
Browse files Browse the repository at this point in the history
  • Loading branch information
rtuck99 committed Aug 6, 2024
1 parent a4556b1 commit 2b778af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ dev = [

[project.scripts]
dodal = "dodal.__main__:main"
save-panda = "dodal.devices.util.save_panda"
save-panda = "dodal.devices.util.save_panda:main"

[project.urls]
GitHub = "https://github.com/DiamondLightSource/dodal"
Expand Down
10 changes: 8 additions & 2 deletions src/dodal/devices/util/save_panda.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def save_to_file():
RE(save_to_file())


def _main():
def main():
parser = ArgumentParser(description="Save an ophyd_async device to yaml")
parser.add_argument(
"--beamline", help="beamline to save from e.g. i03. Defaults to BEAMLINE"
Expand All @@ -34,6 +34,12 @@ def _main():

if beamline:
os.environ["BEAMLINE"] = beamline
else:
beamline = os.environ["BEAMLINE"]

if not beamline:
print(f"BEAMLINE not set and --beamline not specified")
return 1

RE = RunEngine()

Expand All @@ -51,4 +57,4 @@ def _main():


if __name__ == "__main__":
sys.exit(_main())
sys.exit(main())

0 comments on commit 2b778af

Please sign in to comment.