Skip to content

Commit ba6ad1b

Browse files
committed
Added executables to examples
1 parent 3ef3930 commit ba6ad1b

9 files changed

+21
-10
lines changed

examples/running/lossmap.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,15 @@
2727

2828

2929
# Run xboinc
30-
cmd = subprocess.run(['uname', '-ms'], stdout=subprocess.PIPE)
31-
architecture = cmd.stdout.decode('UTF-8').strip().lower().replace(' ','-')
32-
exec_file = list(Path.cwd().glob(f'xboinc_{xb.app_version}-{architecture}'))
33-
if len(exec_file)==0 or not exec_file[0].exists():
30+
cmd = subprocess.run(['uname', '-m'], stdout=subprocess.PIPE)
31+
arch = cmd.stdout.decode('UTF-8').strip().lower()
32+
cmd = subprocess.run(['uname', '-s'], stdout=subprocess.PIPE)
33+
thisos = cmd.stdout.decode('UTF-8').strip().lower()
34+
exec_files = list(Path.cwd().glob(f'xboinc_{xb.app_version}-*'))
35+
exec_files = [f for f in exec_files if arch in str(f) and thisos in str(f)]
36+
if len(exec_files)==0 or not exec_files[0].exists():
3437
raise ValueError("No executable found")
35-
exec_file = exec_file[0]
38+
exec_file = exec_files[0]
3639
cmd = subprocess.run(exec_file)
3740
if cmd.returncode != 0:
3841
raise RuntimeError(f"Tracking failed.")

examples/running/simple_line.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# copyright ############################### #
2+
# This file is part of the Xboinc Package. #
3+
# Copyright (c) CERN, 2023. #
4+
########################################### #
5+
16
import subprocess
27
from pathlib import Path
38
import numpy as np
@@ -17,12 +22,15 @@
1722

1823

1924
# Run xboinc
20-
cmd = subprocess.run(['uname', '-ms'], stdout=subprocess.PIPE)
21-
architecture = cmd.stdout.decode('UTF-8').strip().lower().replace(' ','-')
22-
exec_file = list(Path.cwd().glob(f'xboinc_{xb.app_version}-{architecture}'))
23-
if len(exec_file)==0 or not exec_file[0].exists():
25+
cmd = subprocess.run(['uname', '-m'], stdout=subprocess.PIPE)
26+
arch = cmd.stdout.decode('UTF-8').strip().lower()
27+
cmd = subprocess.run(['uname', '-s'], stdout=subprocess.PIPE)
28+
thisos = cmd.stdout.decode('UTF-8').strip().lower()
29+
exec_files = list(Path.cwd().glob(f'xboinc_{xb.app_version}-*'))
30+
exec_files = [f for f in exec_files if arch in str(f) and thisos in str(f)]
31+
if len(exec_files)==0 or not exec_files[0].exists():
2432
raise ValueError("No executable found")
25-
exec_file = exec_file[0]
33+
exec_file = exec_files[0]
2634
cmd = subprocess.run(exec_file)
2735
if cmd.returncode != 0:
2836
raise RuntimeError(f"Tracking failed.")
278 KB
Binary file not shown.
-278 KB
Binary file not shown.
-287 KB
Binary file not shown.
344 KB
Binary file not shown.
384 KB
Binary file not shown.
302 KB
Binary file not shown.

0 commit comments

Comments
 (0)