diff --git a/.travis.yml b/.travis.yml index a9c908ab46..4f89bd92c7 100755 --- a/.travis.yml +++ b/.travis.yml @@ -74,7 +74,7 @@ before_script: - sudo apt-get install -y python3-pip - pip3 install --user sh click - ([[ -z "$TRAVIS_TESTS" ]] || sudo pip install --upgrade cpp-coveralls) - - (! var_search "${TRAVIS_TESTS-}" docs || pip install --user 'Sphinx<1.8.0' sphinx-rtd-theme recommonmark) + - (! var_search "${TRAVIS_TESTS-}" docs || pip install --user 'Sphinx<1.8.0' sphinx-rtd-theme 'recommonmark<0.5.0') - (! var_search "${TRAVIS_TESTS-}" translations || pip3 install --user polib) # report some good version numbers to the build @@ -86,8 +86,8 @@ before_script: script: # Build mpy-cross first because other builds depend on it. - echo 'Building mpy-cross' && echo 'travis_fold:start:mpy-cross' - - make -C mpy-cross -j2 ; echo status $? > status - - echo 'travis_fold:end:mpy-cross' && cat status + - make -C mpy-cross -j2 ; echo $? > status + - echo 'travis_fold:end:mpy-cross' && tools/print_status.py status # Use unbuffered output because building all the releases can take a long time. # Travis will cancel the job if it sees no output for >10 minutes. @@ -95,8 +95,8 @@ script: - cd .. - echo 'Building unix' && echo 'travis_fold:start:unix' - - (! var_search "${TRAVIS_TESTS-}" unix || (make -C ports/unix deplibs -j2 && make -C ports/unix -j2 && make -C ports/unix coverage -j2)) ; echo status $? > status - - echo 'travis_fold:end:unix' && cat status + - (! var_search "${TRAVIS_TESTS-}" unix || (make -C ports/unix deplibs -j2 && make -C ports/unix -j2 && make -C ports/unix coverage -j2)) ; echo $? > status + - echo 'travis_fold:end:unix' && tools/print_status.py status # run tests without coverage info #- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests -j1) @@ -104,28 +104,28 @@ script: # run tests with coverage info - echo 'Test all' && echo 'travis_fold:start:test_all' - - (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1)) ; echo status $? > status - - echo 'travis_fold:end:test_all' && cat status + - (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1)) ; echo $? > status + - echo 'travis_fold:end:test_all' && tools/print_status.py status - echo 'Test threads' && echo 'travis_fold:start:test_threads' - - (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 -d thread)) ; echo status $? >status - - echo 'travis_fold:end:test_threads' && cat status + - (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 -d thread)) ; echo $? >status + - echo 'travis_fold:end:test_threads' && tools/print_status.py status - echo 'Testing with native' && echo 'travis_fold:start:test_native' - - (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --emit native)) ; echo status $? >status - - echo 'travis_fold:end:test_native' && cat status + - (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --emit native)) ; echo $? >status + - echo 'travis_fold:end:test_native' && tools/print_status.py status - (echo 'Testing with mpy' && echo 'travis_fold:start:test_mpy') - (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float)) ; echo "Testing with mpy status: $?" >status - - echo 'travis_fold:end:test_mpy' && cat status + - echo 'travis_fold:end:test_mpy' && tools/print_status.py status - (echo 'Building docs' && echo 'travis_fold:start:build_docs') - - (! var_search "${TRAVIS_TESTS-}" docs || sphinx-build -E -W -b html . _build/html) ; echo status $? >status - - echo 'travis_fold:end:build_docs' && cat status + - (! var_search "${TRAVIS_TESTS-}" docs || sphinx-build -E -W -b html . _build/html) ; echo $? >status + - echo 'travis_fold:end:build_docs' && tools/print_status.py status - (echo 'Building translations' && echo 'travis_fold:start:build_translations') - - (! var_search "${TRAVIS_TESTS-}" translations || make check-translate) ; echo status $? >status - - echo 'travis_fold:end:build_translations' && cat status + - (! var_search "${TRAVIS_TESTS-}" translations || make check-translate) ; echo $? >status + - echo 'travis_fold:end:build_translations' && tools/print_status.py status # run coveralls coverage analysis (try to, even if some builds/tests failed) #- (cd ports/unix && coveralls --root ../.. --build-root . --gcov $(which gcov) --gcov-options '\-o build-coverage/' --include py --include extmod) diff --git a/README.rst b/README.rst index 13672b689c..deb085522e 100644 --- a/README.rst +++ b/README.rst @@ -157,7 +157,7 @@ Behavior API ~~~ -- Unified hardware APIs: `audioio `_, `analogio `_, `busio `_, `digitalio `_, `pulseio `_, `touchio `_, `microcontroller `_, `board `_, `bitbangio `_ +- Unified hardware APIs: `audioio `_, `analogio `_, `bleio `_, `busio `_, `digitalio `_, `pulseio `_, `touchio `_, `microcontroller `_, `board `_, `bitbangio `_ - No ``machine`` API on Atmel SAMD21 port. Modules diff --git a/shared-bindings/bleio/CharacteristicBuffer.c b/shared-bindings/bleio/CharacteristicBuffer.c index 74ca609f0d..d28cd54cf0 100644 --- a/shared-bindings/bleio/CharacteristicBuffer.c +++ b/shared-bindings/bleio/CharacteristicBuffer.c @@ -42,7 +42,8 @@ //| //| :param bleio.Characteristic characteristic: The characteristic to monitor //| :param int buffer_size: Size of ring buffer that stores incoming data coming from client. -//| Must be >= 1. +//| Must be >= 1. +//| STATIC mp_obj_t bleio_characteristic_buffer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *pos_args) { mp_arg_check_num(n_args, n_kw, 1, 2, true); bleio_characteristic_buffer_obj_t *self = m_new_obj(bleio_characteristic_buffer_obj_t); diff --git a/shared-bindings/bleio/Device.c b/shared-bindings/bleio/Device.c index cf5eb68737..cbad9fb7ea 100644 --- a/shared-bindings/bleio/Device.c +++ b/shared-bindings/bleio/Device.c @@ -52,10 +52,10 @@ //| When a device is created without any parameter passed to the constructor, //| it will be set to the Peripheral role. If a address is passed, the device //| will be a Central. For a Peripheral you can set the `name`, add services -//| via `add_service` and then start and stop advertising via `start_advertising` -//| and `stop_advertising`. For the Central, you can `bleio.Device.connect` and `bleio.Device.disconnect` +//| via `add_service` and then start and stop advertising via `bleio.Device.start_advertising` +//| and `bleio.Device.stop_advertising`. For the Central, you can `bleio.Device.connect` and `bleio.Device.disconnect` //| to the device, once a connection is established, the device's services can -//| be accessed using `services`. +//| be accessed using `bleio.Device.services`. //| //| Usage:: //| diff --git a/shared-bindings/bleio/UUID.c b/shared-bindings/bleio/UUID.c index 2b42ab05cc..703bc1c654 100644 --- a/shared-bindings/bleio/UUID.c +++ b/shared-bindings/bleio/UUID.c @@ -50,7 +50,7 @@ //| - a buffer object (bytearray, bytes) of 16 bytes in little-endian order (128-bit UUID) //| //| :param int/buffer value: The uuid value to encapsulate - +//| STATIC mp_obj_t bleio_uuid_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *pos_args) { mp_arg_check_num(n_args, n_kw, 1, 1, false); diff --git a/shared-bindings/bleio/__init__.c b/shared-bindings/bleio/__init__.c index e23efe36c7..42bd093f19 100644 --- a/shared-bindings/bleio/__init__.c +++ b/shared-bindings/bleio/__init__.c @@ -57,9 +57,12 @@ //| AddressType //| AdvertisementData //| Adapter +//| Broadcaster //| Characteristic +//| CharacteristicBuffer //| Descriptor //| Device +//| Peripheral //| ScanEntry //| Scanner //| Service diff --git a/tools/print_status.py b/tools/print_status.py new file mode 100755 index 0000000000..ed563fd68b --- /dev/null +++ b/tools/print_status.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +import sys +if len(sys.argv) != 2: + print("""\ +Usage: print_status.py STATUS_FILENAME + STATUS_FILENAME contains one line with an integer status.""" + ) + sys.exit(1) +with open(sys.argv[1], 'r') as status_in: + status = int(status_in.readline()) + +print('{} with status {}'.format( + "\033[32msucceeded\033[0m" if status == 0 else "\033[31mfailed\033[0m", + status))