Repository navigation
Micropython support - #514
Conversation
| def is_micropython(): | ||
| return sys.implementation.name == "micropython" | ||
|
|
||
| def chain_exception(exception, cause): |
There was a problem hiding this comment.
I'm not sure if I like how I did this... Micropython doesn't support exception chaining, so we have to suppress the from when running on that interpreter. But now chain_exception shows up in the call stack.
There was a problem hiding this comment.
I guess we could implement our own Exception subclass, that would carry its parent exception around, but I am not sure if that would be any better than what you did.
| cd ~/ | ||
|
|
||
| # Build micropython from source | ||
| # TODO: cache micropython build output |
There was a problem hiding this comment.
Here is how I did it:
Adding a path to travis cache:
https://github.com/ddemidov/amgcl/blob/master/.travis.yml#L39-L42
Checking if path exists (that is, if cache was unpacked successfully):
https://github.com/ddemidov/amgcl/blob/master/.travis/install_boost.sh#L5
There was a problem hiding this comment.
Done. Thanks for the reference!
ddemidov
left a comment
There was a problem hiding this comment.
That is surprisingly small amount of changes to support micropython. Looks good to me!
| raise driver_error | ||
|
|
||
| if driver_error.errno == errno.EINVAL: | ||
| driver_errorno = driver_error.args[0] if is_micropython() else driver_error.errno |
There was a problem hiding this comment.
It would feel nicer if this would be implemented as a function (driver_errno()) but I guess it is OK as is, since this is the only place we need it.
| tags: true | ||
| condition: $TRAVIS_TAG != ev3dev-stretch/* | ||
| condition: | ||
| - $TRAVIS_TAG != ev3dev-stretch/* |
There was a problem hiding this comment.
I suspect that this (the list for condition) isn't right. I need to take another look and figure out how to do it correctly.
There was a problem hiding this comment.
Never mind... although the documentation says
condition: deploy when a single bash condition evaluates to true. This must be a string value, and is equivalent to
if [[ <condition> ]]; then <deploy>; fi.
It emits the correct script:
if [[ ($TRAVIS_REPO_SLUG = "ev3dev/ev3dev-lang-python") && ($TRAVIS_TAG != ev3dev-stretch/*) && ($USE_MICROPYTHON = false) && ("$TRAVIS_TAG" != "") ]]; then
Document usage under Micropython(Add documentation for Micropython usage #528)micropython.nativedecorator to see if it worksExample build: https://travis-ci.org/ev3dev/ev3dev-lang-python/builds/426662475
Depends on ev3dev/ev3dev-lang-fake-sys#13
Fixes #492