Ensure that the packaged Python is used to install dependencies.
When I try to: import cryptography.fernet I get: ImportError: No module named '_cffi_backend'
This is apparently since cryptography builds with 'm' (see PEP 3149) and briefcase's python does not. Test case at: https://github.com/jamesabel/hello_briefcase . See https://github.com/jamesabel/hello_briefcase/blob/master/out.txt for details.
BTW I'm at the PyCon sprints today (5/25/17) so we can discuss this.
In discussion with Glyph, this revealed an interesting edge case for non-pure Python programs.
pip install uses the platform identifier for the python used to invoke pip when requesting wheels from PyPI. So, if the Python in the virtual environment is 3.5m, then the 3.5m wheel will be downloaded and installed. This poses a problem if the support package is the non-PyMalloc version (3.5).
This also means that attempting to build a Linux package on macOS will fail if the app has binaries dependencies.
On a related note, it also points out that the support packages are non-PyMalloc builds; since there's no particularly compelling reason for that, the support builds should probably be modified.
Seems like the best approach to support as many linux versions as possible in the simplest way will be to run the build command inside an Ubuntu:16.04 based container. To do that we will need our own image to be built and published whenever we release a new briefcase version.
I can create a dockerfile based on tutorial 3 and modify briefcase to use this image when building on a linux. The only issue I have is the python3 version - apt-get install python3-dev installs 3.5.2 and it's quite ancient by now. Should we install a newer python and pip?
There's two different approaches we could take with Docker. One is to run Briefcase inside a Docker container; the other is to use Briefcase to run build commands inside Docker.
If we were doing the former approach, then yes: updating Python would be critical, as the version of Python in the container would affect the version used in the final packaged app.
However, the latter approach doesn't require an updated Python at all, because the build process on Linux isn't actually dependent on Python - it's the AppImage tooling, which is all shell and native binaries. The "host" Python (the one running briefcase and starting Docker) ultimately controls the version of Python that is packaged; if the end user is running Ubuntu 19.10 (or some other recent distro release), or they've got a manually configured Python install of their own, then they will be controlling which Python is packaged.
I believe the latter will ultimately be a more viable option, if only because it will simplify the end-user experience - we don't need to teach people how to use docker before they can package apps.
A few things:
- manylinux exists
- Starting with 3.8, pymalloc builds are ABI compatible, see https://docs.python.org/3/whatsnew/3.8.html#build-and-c-api-changes (it was changed to a runtime option instead of a compile-time one), so this problem will phase out.
Closing on the basis that (a) Python3.7 is the only affected version at this point, and (b) Briefcase now uses docker for Linux builds.