diff --git a/.gitignore b/.gitignore index 3c038a7794..b88f771e8b 100644 --- a/.gitignore +++ b/.gitignore @@ -54,8 +54,6 @@ paparazzi.sublime-workspace /var /dox -/paparazzi - # /conf/ /conf/conf.xml /conf/conf.xml.20* diff --git a/Makefile b/Makefile index bfc5a138e6..35d2a0add2 100644 --- a/Makefile +++ b/Makefile @@ -137,7 +137,7 @@ conf/%.xml :conf/%_example.xml conf/tools/blacklisted: conf/tools/blacklisted_example cp conf/tools/blacklisted_example conf/tools/blacklisted -ground_segment: _print_building update_google_version conf libpprz subdirs commands static +ground_segment: _print_building update_google_version conf libpprz subdirs static ground_segment.opt: ground_segment cockpit.opt tmtc.opt static: cockpit tmtc generators sim_static joystick static_h @@ -246,20 +246,10 @@ ac_h ac fbw ap: static conf generators ext sim: sim_static -# -# Commands -# - # stuff to build and upload the lpc bootloader ... include Makefile.lpctools lpctools: lpc21iap -commands: paparazzi - -paparazzi: - cat src/paparazzi | sed s#OCAMLRUN#$(OCAMLRUN)# | sed s#OCAML#$(OCAML)# > $@ - chmod a+x $@ - # # doxygen html documentation @@ -276,7 +266,7 @@ dox: # clean: - $(Q)rm -fr dox build-stamp configure-stamp conf/%gconf.xml paparazzi + $(Q)rm -fr dox build-stamp configure-stamp conf/%gconf.xml $(Q)rm -f $(GEN_HEADERS) $(Q)MESSAGES_INSTALL=$(MESSAGES_INSTALL) $(MAKE) -C $(PPRZLINK_DIR) uninstall $(Q)rm -fr $(MAVLINK_DIR) @@ -348,6 +338,6 @@ test_sim: all .PHONY: all print_build_version _print_building _save_build_version update_google_version init dox ground_segment ground_segment.opt \ subdirs $(SUBDIRS) conf ext libpprz libpprzlink cockpit cockpit.opt tmtc tmtc.opt generators\ -static sim_static lpctools commands opencv_bebop\ +static sim_static lpctools opencv_bebop\ clean cleanspaces ab_clean dist_clean distclean dist_clean_irreversible \ test test_examples test_math test_sim test_all_confs diff --git a/paparazzi b/paparazzi new file mode 100755 index 0000000000..d0ca8a7f51 --- /dev/null +++ b/paparazzi @@ -0,0 +1,21 @@ +#!/usr/bin/env /usr/bin/python3 + +import os +import sys + +dirname = os.path.dirname(os.path.abspath(__file__)) +PAPARAZZI_HOME = os.getenv("PAPARAZZI_HOME",dirname) +PAPARAZZI_SRC = os.getenv("PAPARAZZI_SRC",PAPARAZZI_HOME) +env = os.environ +env['PAPARAZZI_HOME'] = PAPARAZZI_HOME +env['PAPARAZZI_SRC'] = PAPARAZZI_SRC + +if len(sys.argv) > 1 and sys.argv[1] == "-python": + path = os.path.normpath(os.path.join(dirname, 'sw', 'supervision', 'python', 'main.py')) + args = sys.argv[2:] + os.execve(path, args, env) +else: + path = os.path.normpath(os.path.join(dirname, 'sw', 'supervision', 'paparazzicenter')) + args = sys.argv[1:] + os.execve(path, args, env) + diff --git a/src/paparazzi b/src/paparazzi deleted file mode 100755 index 9f998a7036..0000000000 --- a/src/paparazzi +++ /dev/null @@ -1,24 +0,0 @@ -#!OCAMLRUN OCAML -#load "unix.cma";; -let (//) = Filename.concat -let dirname = Filename.dirname Sys.argv.(0) -let dirname = if Filename.is_relative dirname && dirname <> Filename.current_dir_name then Sys.getcwd () // dirname else dirname -let env = - Array.map (fun var -> - let value = try Sys.getenv var with _ -> dirname in - let value = if value = "." then Sys.getcwd () else value in - Printf.sprintf "%s=%s" var value) - [|"PAPARAZZI_SRC"; "PAPARAZZI_HOME"|] -let com = - if Array.length (Sys.argv) > 1 then begin - Printf.printf "%d\n" (Array.length (Sys.argv)); - if Sys.argv.(1) = "-python" then - dirname // "sw/supervision/python/main.py" - else - dirname // "sw/supervision/paparazzicenter" - end - else - dirname // "sw/supervision/paparazzicenter";; -Sys.argv.(0) <- com;; -let env = Array.append env (Unix.environment ());; -Unix.execve com Sys.argv env