Skip to content

T34559 migrate to 16 alpha#116

Merged
dbnicholson merged 2 commits into
developfrom
T34559-migrate-to-16-alpha
May 8, 2023
Merged

T34559 migrate to 16 alpha#116
dbnicholson merged 2 commits into
developfrom
T34559-migrate-to-16-alpha

Conversation

@manuq
Copy link
Copy Markdown

@manuq manuq commented Apr 14, 2023

Comment thread src/kolibri_android/main_activity/activity.py Outdated
@dylanmccall dylanmccall force-pushed the T34559-migrate-to-16-alpha branch 2 times, most recently from 2d5660c to 83ede9c Compare May 5, 2023 02:53
@dylanmccall dylanmccall force-pushed the T34559-migrate-to-16-alpha branch 2 times, most recently from 049a769 to 9de0b71 Compare May 5, 2023 03:18
@dylanmccall dylanmccall marked this pull request as ready for review May 5, 2023 03:18
@dylanmccall dylanmccall force-pushed the T34559-migrate-to-16-alpha branch from 9de0b71 to 82b4293 Compare May 5, 2023 03:26

logger.info("Applying DynamicWhiteNoise workarounds")
kolibri_whitenoise.DynamicWhiteNoise = DynamicWhiteNoise
kolibri_whitenoise.DynamicWhiteNoise = AndroidDynamicWhiteNoise
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative to monkey patching this is to just define your own WSGI application instead, I would think, which may feel neater? Might be a few more lines of code though.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I should play with that properly :) The reason I didn't here is because Kolibri's wsgi.py has a fair bit of stuff in it. Looking at it again, it doesn't change very frequently, so not really that scary, and it would indeed make the rest of it simpler.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I gave it a try in #121. I agree, I like it better that way 👍

@dylanmccall dylanmccall force-pushed the T34559-migrate-to-16-alpha branch 2 times, most recently from e3910ca to 8de6e78 Compare May 5, 2023 03:40
from .android_utils import stat_file

# We import from evil_kolibri so we can monkey-patch DynamicWhiteNoise from
# kolibri without creating a circular dependency.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything that installs an evil_kolibri package. Did I miss something?

Copy link
Copy Markdown

@dylanmccall dylanmccall May 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, good catch! I forgot to commit that. Fixed now in the newest version of this commit, with some new stuff added to the Makefile: copying some code from kolibri to evil_kolibri, and applying the patch I had added.

By adding a patch to lightly refactor kolibri_whitenoise, we can change
android_whitenoise to use a subclass of DynamicWhiteNoise.

It is still necessary to copy DynamicWhiteNoise in order to subclass it,
because the same class in Kolibri itself needs to be monkey-patched with
our version. However, that copy can now be created automatically.

https://phabricator.endlessm.com/T34559
@dylanmccall dylanmccall force-pushed the T34559-migrate-to-16-alpha branch from 8de6e78 to 90501bc Compare May 8, 2023 16:53
Copy link
Copy Markdown
Member

@dbnicholson dbnicholson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I trust this does the right thing and the copying is necessary.

@dbnicholson dbnicholson merged commit ca913f4 into develop May 8, 2023
@dbnicholson dbnicholson deleted the T34559-migrate-to-16-alpha branch May 8, 2023 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants