From 7e49ad81de439400655c022322486d738aeaeb09 Mon Sep 17 00:00:00 2001 From: Ian Rees Date: Sun, 10 Dec 2017 17:15:13 +1300 Subject: [PATCH 1/2] build_analyzer.py bails after first build error --- build_analyzer.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/build_analyzer.py b/build_analyzer.py index 4ddd7ee..594d9af 100644 --- a/build_analyzer.py +++ b/build_analyzer.py @@ -1,7 +1,8 @@ +# Python 3 script to build the analyzer + import os, glob, platform #find out if we're running on mac or linux and set the dynamic library extension -dylib_ext = "" if platform.system().lower() == "darwin": dylib_ext = ".dylib" else: @@ -45,6 +46,12 @@ link_dependencies = [ "-lAnalyzer" ] #refers to libAnalyzer.dylib or libAnalyzer debug_compile_flags = "-O0 -w -c -fpic -g" release_compile_flags = "-O3 -w -c -fpic" +def run_command(cmd): + "Display cmd, then run it in a subshell, raise if there's an error" + print(cmd) + if os.system(cmd): + raise Exception("Shell execution returned nonzero status") + #loop through all the cpp files, build up the gcc command line, and attempt to compile each cpp file for cpp_file in cpp_files: @@ -66,10 +73,8 @@ for cpp_file in cpp_files: debug_command += "\"" + "source/" + cpp_file + "\"" #the cpp file to compile #run the commands from the command line - print(release_command) - os.system( release_command ) - print(debug_command) - os.system( debug_command ) + run_command(release_command) + run_command(debug_command) #lastly, link #g++ @@ -111,9 +116,5 @@ for cpp_file in cpp_files: debug_command += "debug/" + cpp_file.replace( ".cpp", ".o" ) + " " #run the commands from the command line -print(release_command) -os.system( release_command ) -print(debug_command) -os.system( debug_command ) - - +run_command(release_command) +run_command(debug_command) From 721b8371a114b806147bdb79d81f77fbe8588df2 Mon Sep 17 00:00:00 2001 From: Ian Rees Date: Sun, 10 Dec 2017 17:31:05 +1300 Subject: [PATCH 2/2] Add example git clone command to readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 045a5b8..660e3e5 100644 --- a/readme.md +++ b/readme.md @@ -8,7 +8,7 @@ This repository should be used to create new analyzers for the Saleae software. First, fork, clone or download this repository. Forking is recommended if you plan to use version control or share your custom analyzer publicly. -Note - This repository contains a submodule. Be sure to include submodules when cloning. If you download the repository from Github, the submodules are not included. In that case you will also need to download the AnalyzerSDK repository linked above and place the AnalyzerSDK folder inside of the SampleAnalyzer folder. +Note - This repository contains a submodule. Be sure to include submodules when cloning, for example `git clone --recursive https://github.com/saleae/SampleAnalyzer.git`. If you download the repository from Github, the submodules are not included. In that case you will also need to download the AnalyzerSDK repository linked above and place the AnalyzerSDK folder inside of the SampleAnalyzer folder. Once downloaded, first run the script rename_analyzer.py. This script is used to rename the sample analyzer automatically. Specifically, it changes the class names in the source code, it changes the text name that will be displayed once the custom analyzer has been loaded into the Saleae Logic software, and it updates the visual studio project.