Ejemplo n.º 1
0
def make_cookie(session: nox.Session, backend: str) -> None:
    tmp_dir = session.create_tmp()
    # Nox sets TMPDIR to a relative path - fixed in nox 2022.1.7
    session.env["TMPDIR"] = os.path.abspath(tmp_dir)
    session.cd(tmp_dir)

    package_dir = Path(f"cookie-{backend}")

    with open("input.yml", "w") as f:
        f.write(JOB_FILE.format(backend=backend))

    session.run(
        "cookiecutter",
        "--no-input",
        str(DIR),
        "--config-file=input.yml",
    )
    session.cd(package_dir)
    session.run("git", "init", "-q", external=True)
    session.run("git", "add", ".", external=True)
    session.run(
        "git",
        "-c",
        "user.name=Bot",
        "-c",
        "[email protected]",
        "commit",
        "-qm",
        "feat: initial version",
        external=True,
    )
    session.run("git", "tag", "v0.1.0", external=True)
Ejemplo n.º 2
0
def do_docs(session: nox.Session, *, live: bool) -> None:
    session.install(".")
    install_requirement(session, "docs-base")
    if live:
        install_requirement(session, "docs-live")

    session.cd("docs")
    wipe(session, "_build")

    cmd: Tuple[str, ...]
    if not live:
        cmd = ("sphinx-build", ".", "_build", "-W", "--keep-going", "-n")
    else:
        cmd = ("sphinx-autobuild", ".", "_build", "-a", "-n")
    session.run(*cmd, *session.posargs)
    if not live:
        uri = (THIS_DIR / "docs" / "_build" / "index.html").as_uri()
        session.log(f"Built docs: {uri}")
Ejemplo n.º 3
0
def docs(session: nox.Session) -> None:
    """Build the documentation."""
    output_dir = os.path.join(session.create_tmp(), "output")
    doctrees, html = map(
        functools.partial(os.path.join, output_dir), ["doctrees", "html"]
    )
    shutil.rmtree(output_dir, ignore_errors=True)
    session.install("-r", "requirements-test.txt")
    session.install(".")
    session.cd("docs")
    sphinx_args = ["-b", "html", "-W", "-d", doctrees, ".", html]

    if not session.interactive:
        sphinx_cmd = "sphinx-build"
    else:
        sphinx_cmd = "sphinx-autobuild"
        sphinx_args.insert(0, "--open-browser")

    session.run(sphinx_cmd, *sphinx_args)
Ejemplo n.º 4
0
def downstream_botocore(session: nox.Session) -> None:
    root = os.getcwd()
    tmp_dir = session.create_tmp()

    session.cd(tmp_dir)
    git_clone(session, "https://github.com/boto/botocore")
    session.chdir("botocore")
    session.run("git", "rev-parse", "HEAD", external=True)
    session.run("python", "scripts/ci/install")

    session.cd(root)
    session.install(".", silent=False)
    session.cd(f"{tmp_dir}/botocore")

    session.run("python", "-c", "import urllib3; print(urllib3.__version__)")
    session.run("python", "scripts/ci/run-tests")
Ejemplo n.º 5
0
def downstream_requests(session: nox.Session) -> None:
    root = os.getcwd()
    tmp_dir = session.create_tmp()

    session.cd(tmp_dir)
    git_clone(session, "https://github.com/psf/requests")
    session.chdir("requests")
    session.run("git", "apply", f"{root}/ci/requests.patch", external=True)
    session.run("git", "rev-parse", "HEAD", external=True)
    session.install(".[socks]", silent=False)
    session.install("-r", "requirements-dev.txt", silent=False)

    session.cd(root)
    session.install(".", silent=False)
    session.cd(f"{tmp_dir}/requests")

    session.run("python", "-c", "import urllib3; print(urllib3.__version__)")
    session.run("pytest", "tests")