1+
2+ """# Launcher python bindings
3+ # launch and stop processes
4+ """
15import os
26import shlex
37import sys
48from time import *
59import subprocess
610import signal
7- from machinekit .hal import compat
11+ from machinekit .hal . cycompat import compat
812
913_processes = []
1014_realtime_started = False
@@ -16,6 +20,7 @@ def end_session():
1620 stop_processes ()
1721 if _realtime_started : # Stop realtime only when explicitly started
1822 stop_realtime ()
23+ """# ends a running Machinekit session"""
1924
2025
2126# checks wheter a single command is available or not
@@ -25,13 +30,15 @@ def check_command(command):
2530 if process .returncode != 0 :
2631 print (command + ' not found, check Machinekit installation' )
2732 sys .exit (1 )
33+ """# checks wheter a single command is available or not"""
2834
2935
3036# checks the whole Machinekit installation
3137def check_installation ():
3238 commands = ['realtime' , 'configserver' , 'halcmd' , 'haltalk' ]
3339 for command in commands :
3440 check_command (command )
41+ """# checks the whole Machinekit installation"""
3542
3643
3744# checks for a running session and cleans it up if necessary
@@ -56,6 +63,7 @@ def cleanup_session():
5663 except OSError :
5764 pass
5865 sys .stdout .write ('done\n ' )
66+ """# checks for a running session and cleans it up if necessary"""
5967
6068
6169# starts a command, waits for termination and checks the output
@@ -64,6 +72,7 @@ def check_process(command):
6472 sys .stdout .flush ()
6573 subprocess .check_call (command , shell = True )
6674 sys .stdout .write ('done\n ' )
75+ """# starts a command, waits for termination and checks the output"""
6776
6877
6978# starts and registers a process
@@ -79,6 +88,7 @@ def start_process(command, check=True, wait=1.0):
7988 raise subprocess .CalledProcessError (process .returncode , command , None )
8089 _processes .append (process )
8190 sys .stdout .write ('done\n ' )
91+ """# starts and registers a process"""
8292
8393
8494# stops a registered process by its name
@@ -91,6 +101,7 @@ def stop_process(command):
91101 os .killpg (process .pid , signal .SIGTERM )
92102 process .wait ()
93103 sys .stdout .write ('done\n ' )
104+ """# stops a registered process by its name"""
94105
95106
96107# stops all registered processes
@@ -101,6 +112,7 @@ def stop_processes():
101112 os .killpg (process .pid , signal .SIGTERM )
102113 process .wait ()
103114 sys .stdout .write ('done\n ' )
115+ """# stops all registered processes"""
104116
105117
106118# loads a HAL configuration file
@@ -110,14 +122,15 @@ def load_hal_file(filename, ini=None):
110122
111123 _ , ext = os .path .splitext (filename )
112124 if ext == '.py' :
113- from machinekit import rtapi
125+ from machinekit . hal . cyruntime import rtapi
114126
115127 if not rtapi .__rtapicmd :
116128 rtapi .init_RTAPI ()
117129 if ini is not None :
118- from machinekit import config
130+ # from machinekit import config
119131
120- config .load_ini (ini )
132+ #config.load_ini(ini)
133+ ini = machinekit_hal_ini_file
121134 with open (filename , 'r' ) as f :
122135 data = compile (f .read (), filename , 'exec' )
123136 globals_ = {}
@@ -260,6 +273,7 @@ def _exit_handler(signum, frame):
260273# set the Machinekit debug level
261274def set_debug_level (level ):
262275 os .environ ['DEBUG' ] = str (level )
276+ """# set the Machinekit debug level"""
263277
264278
265279# set the Machinekit ini
0 commit comments