2 # SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
 
   4 # SPDX-License-Identifier: MIT
 
   6 export PORT="/dev/ttyUSB0"
 
   7 export MPYCROSS=`realpath ../../../micropython/mpy-cross/mpy-cross`
 
   8 export COPY="cp --parents "
 
   9 export ROOT="/media/cefn/PYBFLASH/"
 
  12 # switch to test sources
 
  14 # compile source .py files to .mpy
 
  15 find . -type f -name '*.py' | \
 
  16     xargs -n1 -I {} sh -c "echo compiling {} ...; ${MPYCROSS} {}"
 
  17 # upload bytecode .mpy files
 
  18 find ./ -type f -name '*.mpy' | \
 
  20         xargs -n1 -I {} sh -c "echo uploading {} ...; ${COPY} {} ${ROOT}"
 
  22 #switch to test libraries
 
  25 # Compile adafruit libraries to bytecode and upload
 
  26 for SUBMODULE in gps # `find . -mindepth 1 -maxdepth 1 -type d `
 
  29     # compile adafruit library .py files to .mpy
 
  30     find . -type f -name '*.py' | \
 
  31         grep -v -E "(^./conf.py|^./docs/conf.py|^./setup.py|^./example.*)" | \
 
  32         xargs -n1 -I {} sh -c "echo compiling {} ...; ${MPYCROSS} {}"
 
  33     # upload adafruit library .mpy files
 
  34     find ./ -type f -name '*.mpy' | \
 
  36             xargs -n1 -I {} sh -c "echo uploading {} ...; ${COPY} {} ${ROOT}"
 
  40 # switch to adafruit_blinka source
 
  43 # compile adafruit blinka .py files to .mpy
 
  44 find . -type f -name '*.py' | \
 
  45     xargs -n1 -I {} sh -c "echo compiling {} ...; ${MPYCROSS} {}"
 
  46 # upload adafruit blinka .mpy files
 
  47 find ./ -type f -name '*.mpy' | \
 
  49         xargs -n1 -I {} sh -c "echo uploading {} ...; ${COPY} {} ${ROOT}"