コード例 #1
0
ファイル: findpaths.py プロジェクト: 3dip0/Napp-Academy
def _parse_ini_config(path: Path) -> iniconfig.IniConfig:
    """Parse the given generic '.ini' file using legacy IniConfig parser, returning
    the parsed object.

    Raise UsageError if the file cannot be parsed.
    """
    try:
        return iniconfig.IniConfig(str(path))
    except iniconfig.ParseError as exc:
        raise UsageError(str(exc)) from exc
コード例 #2
0
def release(c):
    """Run the whole release process.

    Steps:
    - Pull all changes in ``master``.
    - Tag last commit using version information from setup.cfg/pyproject.toml.
    - Update the ``latest`` tag to point to the last commit.
    - Build package (``sdist`` and ``wheel``).
    - Upload package to PyPI.
    - Push new tags.
    """
    c.run("git checkout master")
    c.run("git pull")

    res = c.run("git status -s", hide=True)
    if res.stdout != "":
        raise Exit("Working tree is not clean. Aborting.")

    # run all tests
    try:
        all(c)
    except Exit as e:
        if e.code != pytest.ExitCode.OK:
            raise e

    version = iniconfig.IniConfig("setup.cfg").get("metadata", "version")
    # sanity checks while we have two places containing the version.
    with open("pyproject.toml", "rb") as f:
        toml_version = tomli.load(f)["project"]["version"]
    assert (toml_version == version
            ), "Different versions in pyproject.toml and setup.cfg. Aborting."

    c.run(f"git tag {version}")  # fails if the tag exists
    c.run("git tag -f latest")  # `latest` tag for binder

    build_dists(c)
    upload(c)

    c.run("git push -f --tags")
    c.run("git push")