adafruit / circuitpython-build-tools

Build scripts for CircuitPython libraries and the bundle
MIT License
28 stars 17 forks source link

Packages missing from built bundle #61

Open jamesbowman opened 3 years ago

jamesbowman commented 3 years ago

I am building the circuitpython community bundle, and followed the directions in the README:

git submodule init
git submodule update
./update-submodules.sh
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-bundle --library_location libraries --library_depth 2

the bundle builds without error.

I'm interested in drivers that are packages, for example wiichuck, but none of them are present in my bundle:

$ unzip -l bundles/adafruit-circuitpython-bundle-py-20210209.zip|grep wiichuck
      497  2021-02-09 19:18   adafruit-circuitpython-bundle-py-20210209/examples/wiichuck_simpletest.py

Whereas when I look in the public release bundle, wiichuck is present:

$ unzip -l circuitpython-community-bundle-py-20210209.zip | grep wiichuck
     4495  2021-02-09 05:09   circuitpython-community-bundle-py-20210209/lib/wiichuck/guitar.py
     3288  2021-02-09 05:09   circuitpython-community-bundle-py-20210209/lib/wiichuck/udraw.py
     2518  2021-02-09 05:09   circuitpython-community-bundle-py-20210209/lib/wiichuck/__init__.py
     4987  2021-02-09 05:09   circuitpython-community-bundle-py-20210209/lib/wiichuck/classic_controller.py
     5001  2021-02-09 05:09   circuitpython-community-bundle-py-20210209/lib/wiichuck/dj_table.py
     3465  2021-02-09 05:09   circuitpython-community-bundle-py-20210209/lib/wiichuck/nunchuk.py
      497  2021-02-09 05:09   circuitpython-community-bundle-py-20210209/examples/wiichuck_simpletest.py

I checked that libraries/drivers/wiichuck/ exists in my tree and is populated. It is strange the the wiichuck example does get built, but the driver does not.

The same is true of every submodule that builds a package. The .zip I build contains no subdirectories under lib/, only .py files.

Building on Python 3.8, with tools version 1.6.0 in a venv as recommended, on both Ubuntu 18.04 and 20.04.

tannewt commented 3 years ago

Looks like there is some package related tricks here: https://github.com/adafruit/CircuitPython_Community_Bundle/blob/master/.github/workflows/build.yml#L37

jamesbowman commented 3 years ago

Aha, thanks, so running this:

ls -RUx |
        gawk -F '\n' '{ match($1, /(drivers|helpers)\/(.+)\/(.+)\:/, arr) ; if (length(arr[0]) > 0 && match(arr[3], arr[2]) > 0) printf "%s, ", arr[3] }' |
        gawk '{ trimmed = substr($0, 1, length($0) - 2) ; print "\"" trimmed "\"" }'

outputs:

"nonblocking_timer, jepler_udecimal, dotstar_featherwing, gamblor21_ahrs, barbudor_ina3221, wiichuck, circuitpython_nrf24l01"

And then building with this string supplied as --package_folder_prefix does the expected thing:

circuitpython-build-bundles --filename_prefix adafruit-circuitpython-bundle --library_location libraries --library_depth 2 \
--package_folder_prefix "nonblocking_timer, jepler_udecimal, dotstar_featherwing, gamblor21_ahrs, barbudor_ina3221, wiichuck, circuitpython_nrf24l01"
jamesbowman commented 3 years ago

Shall I make a PR for CircuitPython_Community_Bundle with a shell script build.sh to do the above, and use it in the README?

tannewt commented 3 years ago

Yes please! That'd be great.