GithubHelp home page GithubHelp logo

Comments (5)

henryiii avatar henryiii commented on June 3, 2024 1

(Not disagreeing with better docs, btw)

from cibuildwheel.

joerick avatar joerick commented on June 3, 2024 1

Agreed on the docs. It's one of those things that was implied and never said.

from cibuildwheel.

henryiii avatar henryiii commented on June 3, 2024

This is just subprocess.run with shell=True. Python respects the $SHELL environment variable on Posix. Generally, this is whatever you are running on macOS. On Linux, since it runs in the manylinux docker container, you'll have bash. Not sure if it's always cmd on Windows or if it respects what you run it from.

In general, it's probably best to keep this simple and cross-platform, and then manually run a bash/bat/whatever script with complex commands if you need them. Or a Python script. :)

from cibuildwheel.

JP-Ellis avatar JP-Ellis commented on June 3, 2024

Yeah, I had a hunch it would just be calling subprocess.run. I guess for me, it just wasn't clear and other than trial and error, it was difficult to figure out.

I think there's a few things that could help here:

  1. Improving the docs to make what you explained really clear.
  2. Perhaps adding some clearer diagnostics in the CI logs that show which shell interpreter is being used.

Ultimately, it would be awesome to be able to specify the interpreter to allow something like:

before-build = {
  shell = "python",
  script = 'import shutil; shutil.rm("{package}/bin")'
}

Though I'm not sure if there's a desire for that, and it might complicate things significantly.

from cibuildwheel.

henryiii avatar henryiii commented on June 3, 2024

You can do that today. Use

before-build = [
 """python -c 'import shutil; shutil.rm("{package}/bin")'""",
]

Same for bash, etc. Better yet, stick the contents in a file, stick #!/usr/bin/env python (or bash, etc) at the top, make it executable, then run the file, like

before-build = [
 "./tools/remove_bin.py",
]

These are all cross platform and don’t depend on the shell Python uses.

Also, your example was invalid TOML (though it will be valid in TOML 1.1 eventually). Inline tables must be one line in 1.0. :(

from cibuildwheel.

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.