Skip to content
  • Georges Racinet's avatar
    rust: new rust options in setup.py · 94167e701e12
    Georges Racinet authored
    The --rust global option turns on usage (and by default compilation)
    of the rust-cpython based mercurial.rustext.
    
    Similarly to what's previously done for zstd, there is a --no-rust
    option for the build_ext subcommand in order not to build
    mercurial.rustext, allowing for an OS distribution to prebuild it.
    
    The HGWITHRUSTEXT environment variable is still honored, and has
    the same effect as before, but now it works mostly by making
    the --rust global option defaulting to True, with some special
    cases for the direct-ffi case (see more about that below)
    
    Coincidentally, the --rust flag can also be passed from the make
    commands, like actually all global options, in the PURE variable
    
       make local PURE=--rust
    
    This feels inappropriate, though, and we should follow up with
    a proper make variable for that case.
    
    Although the direct-ffi bindings aren't directly useful any more, we
    keep them at this stage because
    
    - they provide a short prototyping path for experiments in which a C extension
      module has to call into a Rust extension. The proper way of doing that would
      be to use capsules, and it's best to wait for our pull request onto
      rust-cpython for that: https://github.com/dgrunwald/rust-cpython/pull/169
    - Build support for capsules defined in Rust will probably need to reuse
      some of what's currently in use for direct-ffi.
    94167e701e12