Skip to content

How do I provide a file as a dependency to an external crate's build.rs? #2552

Answered by akesling
akesling asked this question in Q&A
Discussion options

You must be logged in to vote

Thank you so much for the help!

To close the loop here (in case someone stumbles across this looking for how to actually get this working w/ PyO3):

To get the equivalent of PYO3_CONFIG_FILE="$(pwd)/pyo3_build_config.txt" PYO3_NO_PYTHON=1 cargo build --release --bin runtime -p python-embedder, the following annotations work....

...
    annotations = {
        "pyo3-build-config": [crate.annotation(
            build_script_data = ["@//python_embedder:pyo3_build_config.txt"],
            build_script_env = {
                "PYO3_NO_PYTHON": "1",
                "PYO3_CONFIG_FILE": "$(execpath @//python_embedder:pyo3_build_config.txt)",
            },
        )],
    },
...

Note that we're …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@akesling
Comment options

@illicitonion
Comment options

@akesling
Comment options

Answer selected by akesling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants