Skip to content
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

Python 3.12 doesn't support distutils #1699

Closed
Julian-O opened this issue Sep 15, 2023 · 6 comments · Fixed by #1812
Closed

Python 3.12 doesn't support distutils #1699

Julian-O opened this issue Sep 15, 2023 · 6 comments · Fixed by #1812

Comments

@Julian-O
Copy link
Contributor

Versions

  • Python: 3.12rc2
  • OS: Ubuntu
  • Buildozer: master

Description

I did an experiment; I added '3.12.0-rc.2' to the Python matrix in test_python.yml to see if any wave of pain is coming down the pipe.

Indeed there is:

buildozer/targets/android.py:36: in
from distutils.version import LooseVersion
E ModuleNotFoundError: No module named 'distutils'

What happened? PEP 632 happened:

In Python 3.12, distutils will no longer be installed by make install or any of the first-party distribution. Third-party redistributors should no longer include distutils in their bundles or repositories.

LooseVersion has been giving deprecation warnings anyway. Time for a replacement.

@misl6 misl6 added the easy label Sep 15, 2023
@misl6
Copy link
Member

misl6 commented Sep 15, 2023

On kivy/kivy#8070 we made use of packaging.version, as suggested by PEP632 migration advice.

@Julian-O
Copy link
Contributor Author

Julian-O commented Sep 16, 2023

In kivy/python-for-android#2866, I also used packaging.version - packaging was already installed.

In that case, I investigated the version numbers being used and confirmed they conformed to the tighter definitions of packaging. The library has a LegacyVersion and a parse(), so I imagine it could be made to work, but I haven't done this. So some effort to be done there. I wanted to raise the issue because I didn't have time to investigate immediately.

Also, I don't think Buildozer has packaging installed, put it does have libs/version.py . So, could use that, maybe. Except, I just checked and it appears to have been copied from packaging at least 8 years ago.

So the task list:

  • Check that in practice, the tools versions confirm to packaging rules.
  • Figure if we need to call parse() or just packaging.Version()
  • Delete the unmaintained version of the library from source code.
  • Add a packaging dependency to setup.py
    • Perhaps under [android] extras? Doesn't seem warranted just to avoid ios developers needing to have it automatically pip installed when they don't need it.
  • Update any existing clients - i.e. android.py
  • Commit '3.12.0-rc.2' to the matrix, to be updated to `3.12' when GitHub supports it.

@Julian-O Julian-O changed the title Python 3.12 won't support distutils Python 3.12 doesn't support distutils Oct 24, 2023
@Julian-O Julian-O added the bug label Oct 25, 2023
@misl6
Copy link
Member

misl6 commented Oct 29, 2023

Also, I don't think Buildozer has packaging installed, put it does have libs/version.py . So, could use that, maybe. Except, I just checked and it appears to have been copied from packaging at least 8 years ago.

Do we really want to continue vendoring this outdated code? I do not think so. Better migrating to packaging IMHO, if that works for us.

@Julian-O
Copy link
Contributor Author

Do we really want to continue vendoring this outdated code? I do not think so. Better migrating to packaging IMHO, if that works for us.

I absolutely agree. My task list included:

  • Delete the unmaintained version of the library from source code.

by which I mean get rid of libs/version.py

@Bill-Robinson63
Copy link

So.... How do I make buildozer work for me now? Quickest, easiest...

@eMPee584
Copy link

@misl6 maybe a new release should be cut that actually contains these changes, as more and more distros ship python 3.12 by default and 1.5.0 fails on all these.

So.... How do I make buildozer work for me now? Quickest, easiest...

pipx/pip3 install […] git+https://github.com/kivy/buildozer will install current master branch (1.5.1.dev0 as of now) which works with python 3.12.. @Bill-Robinson63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants