Giter Site home page Giter Site logo

Comments (4)

FeodorFitsner avatar FeodorFitsner commented on September 27, 2024

I've been about to post the same issue :)

TLDR: Despite _PYTHON_HOST_PLATFORM is kind of undocumented variable used in soon-to-be-deprecated-distutils I also think it could be the easiest way to fix tags for cross-compiled wheels.

Long version:

Re: #2102 (comment) and #2103.

According to PEP-730 and PEP-738 wheels tags should be:

Android:

  • android_21_arm64_v8a
  • android_21_armeabi_v7a
  • android_21_x86_64
  • android_21_x86

iOS:

  • ios_12_0_arm64_iphoneos
  • ios_12_0_arm64_iphonesimulator
  • ios_12_0_x86_64_iphonesimulator

This should be the value returned by sysconfig.get_platform() (with _ replaced to -).

After looking at Maturin code base I see there are at least two ways for that value to get into the program:

  • CARGO_BUILD_TARGET variable (or --target option).
  • target.detect_arch_from_python() method

CARGO_BUILD_TARGET expects a valid triple in the format {arch}-{vendor}-{os}[-env], so neither android_21_arm64_v8a, not ios_12_0_arm64_iphoneos won't work there.

On the other hand detect_arch_from_python() is currently tailored to macOS only (btw, python interpreter detection code refuses executable name without a version on the end - could be fixed as well). We could, potentially, add checks/parsing for iOS and Android, but Target structure would need to be extended with os_ver (or something) field to store 12.0 for iOS and 21 for Android. Also, build_context.get_platform_tag() would need to be improved to handle iOS and Android OSes.

So, checking _PYTHON_HOST_PLATFORM and using it for a wheel tag would be an easiest way to satisfy custom tags requirements :)

I can try implementing that and submit a PR.

from maturin.

messense avatar messense commented on September 27, 2024

Pull requests are welcome!

On the other hand detect_arch_from_python() is currently tailored to macOS only

Don't worry about this one, it's only for native macOS compilation.

from maturin.

FeodorFitsner avatar FeodorFitsner commented on September 27, 2024

@messense what do you think about #2122? I don't have much experience with Rust, please let me know if it could be made more elegantly.

The implementation is that easy indeed, worked like a charm for us.

from maturin.

messense avatar messense commented on September 27, 2024

#2122 looks good to me, thanks!

from maturin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.