I'm trying to run sphinx-build via an adhoc tool a...
# general
p
I'm trying to run sphinx-build via an adhoc tool and it is.. kind of working. I have
Copy code
adhoc_tool(
    name="sphinx-build",
    runnable="//third_party/sphinx:build",
    args=["-M", "html", "docs/", "_build"],
    execution_dependencies=[
        ":sphinx-apidoc",
        "//enclosure/docs",
        "//enclosure/docs:index",
        "//enclosure/enclosure",
    ],
    output_directories=["_build"],
    root_output_directory="./_build",
    log_output=True,
)
But the
//enclosure/enclosure
dependency is only that level, is there a way I can say give me all dependencies under
//enclosure/enclosure
without specifying each subdir?
It seems like the transitive dependencies dependencies in
execution_dependencies
is not being pulled in. 🤔
Maybe this is the wrong way to go about this.. I need the source code and all of their dependencies in the executive sandbox to run sphinx-build
So maybe a pex_binary some how is actually what I need?
Maybe its a pex binary for sphinx-build pex-binary with all dependencies and the sphinx-build pex .. then run a script in it that executes sphinx-build ? 🤔
Oh maybe for the runnable dependency.. add all the dependencies there
h
There's no way to glob over dependencies, but I would expect
execution_dependencies
to be transitively in the sandbox, if you run with
--keep-sandboxes=always
are they not there?
p
That is correct, they are not there.
This was working before I moved things around
Copy code
python_sources(name="conf")

files(name="index", sources=["index.md"])

DOC_DEPS = [
    ":conf",
    ":index",
    ... other deps
]

SPHINX_DEPS = [
    ".build/requirements:reqs-dev#myst-parser",
    "//.build/requirements:reqs-dev#sphinx",
]

pex_binary(
    name="sphinx-apidoc",
    script="sphinx-apidoc",
    dependencies=SPHINX_DEPS,
)

adhoc_tool(
    name="build-apidoc",
    runnable=":build-apidoc",
    args=[
        "--force",
        "--module-first",
        "--output-dir",
        "enclosure/docs/source",
        "./../enclosure",
        "setup.py",
        "test/",
    ],
    execution_dependencies=[
        "//enclosure/enclosure",
        "//enclosure/docs",
        "//enclosure/docs:index",
    ],
    output_directories=["./_build"],
    root_output_directory="./_build",
    log_output=True,
)

pex_binary(
    name="sphinx-build",
    script="sphinx-build",
    dependencies=SPHINX_DEPS + DOC_DEPS,
)

adhoc_tool(
    name="build-html",
    runnable=":sphinx-build",
    args=["-M", "html", ".", "_build"],
    execution_dependencies=[":sphinx-apidoc"] + DOC_DEPS,
    output_directories=["_build"],
    root_output_directory="./_build",
    log_output=True,
)

archive(name="docs", files=[":build-apidoc"], format="zip")
h
Hmm, I just verified in the code that the transitive closure of the execution_dependencies is taken. Are you sure the files you expect to be in that closure actually are? Have you verified this with
pants dependencies --transitive //enclosure/enclosure
?