Skip to content

🚨 Depreciation warning fixes #2227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2020

Conversation

AndreMiras
Copy link
Member

Fixes running tox outputs warnings:

  • replaces the imp module by the importlib one
  • simplifies downloader dropping FancyURLopener

The warnings were:

pythonforandroid/util.py:17
  /home/andre/workspace/python-for-android/pythonforandroid/util.py:17:
DeprecationWarning: WgetDownloader style of invoking requests is deprecated. Use newer urlopen functions/methods
    urlretrieve = WgetDownloader().retrieve

pythonforandroid/toolchain.py:84
  /home/andre/workspace/python-for-android/pythonforandroid/toolchain.py:84:
DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    import imp

Fixes running `tox` outputs warnings:
- replaces the `imp` module by the `importlib` one
- simplifies downloader dropping `FancyURLopener`

The warnings were:
```
pythonforandroid/util.py:17
  /home/andre/workspace/python-for-android/pythonforandroid/util.py:17:
DeprecationWarning: WgetDownloader style of invoking requests is deprecated. Use newer urlopen functions/methods
    urlretrieve = WgetDownloader().retrieve

pythonforandroid/toolchain.py:84
  /home/andre/workspace/python-for-android/pythonforandroid/toolchain.py:84:
DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    import imp
```
BuildInterruptingException)


def import_recipe(module, filename):
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved to pythonforandroid/util.py and renamed to load_source

version = ('Wget/1.17.1')


urlretrieve = WgetDownloader().retrieve
Copy link
Member Author

Choose a reason for hiding this comment

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

Fully replaced by simply from urllib.request import urlretrieve

Comment on lines +85 to +88
else:
# Python 3.3 and 3.4:
from importlib.machinery import SourceFileLoader
return SourceFileLoader(module, filename).load_module()
Copy link
Member Author

Choose a reason for hiding this comment

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

I was tempted to completely ditch the Python 3.3/3.4 part, but didn't want to risk it in this one. Let's keep it for later

@AndreMiras AndreMiras requested review from inclement and opacam June 3, 2020 07:36
Copy link
Member

@opacam opacam left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!!

💯

@AndreMiras AndreMiras merged commit 9c601cf into kivy:develop Jun 5, 2020
@AndreMiras AndreMiras deleted the feature/fix_warnings branch June 5, 2020 10:49
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.

2 participants