1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-01-17 14:18:16 +01:00
Grbl_Esp32/builder.py
Mitch Bradley 94b6feecce
Changed STATUS_ defines to enum class Error (#584)
* Changed STATUS_ defines  to enum class Error

* Added license blocks to new files

* Suppress  Compiling..Error.cpp  build script output

The filters that look for errors in the output were
triggering on the filename Error.cpp
2020-09-08 12:54:21 -10:00

31 lines
1.1 KiB
Python
Executable File

# This script is imported by build-machine.py and build-all.py
# It performs a platformio build with a given machine file.
# The verbose argument controls whether the full output is
# displayed, or filtered to show only summary information.
# extraArgs can be used to perform uploading after compilation.
from __future__ import print_function
import subprocess, os
env = dict(os.environ)
def buildMachine(baseName, verbose=True, extraArgs=None):
cmd = ['platformio','run']
if extraArgs:
cmd.append(extraArgs)
displayName = baseName
flags = '-DMACHINE_FILENAME=' + baseName
print('Building machine ' + displayName)
env['PLATFORMIO_BUILD_FLAGS'] = flags
if verbose:
app = subprocess.Popen(cmd, env=env)
else:
app = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1)
for line in app.stdout:
line = line.decode('utf8')
if "Took" in line or 'Uploading' in line or ("error" in line.lower() and "Compiling" not in line):
print(line, end='')
app.wait()
print()
return app.returncode