tsfpga.tools package

Submodules

tsfpga.tools.sphinx_doc module

class tsfpga.tools.sphinx_doc.Release(repo, release_notes_file)

Bases: object

Used to represent a release.

__init__(repo, release_notes_file)

Initialize self. See help(type(self)) for accurate signature.

static get_git_date_from_tag(repo, tag)

Get a formatted date string, gathered from git log based on tag name.

tsfpga.tools.sphinx_doc.build_sphinx(build_path, output_path)

Execute sphinx on command line to build HTML documentation.

Parameters
  • build_path (pathlib.Path) – The location that contains conf.py and index.rst.

  • output_path (pathlib.Path) – Where to place the generated HTML.

tsfpga.tools.sphinx_doc.generate_release_notes(repo_root, release_notes_directory, project_name)

Generate release notes in RST format based on a directory full of release note files. Will match each file to a git tag.

Parameters
  • repo_root (pathlib.Path) – Git commands will be executed here.

  • release_notes_directory (pathlib.Path) – Location of release notes files.

  • project_name (str) – Name of project will be used for the gitlab link.

Returns

RST code with release notes.

Return type

str

tsfpga.tools.version_number_handler module

class tsfpga.tools.version_number_handler.VersionNumberHandler(repo, version_file_path)

Bases: object

Class for handling the version number in __init__.py.

__init__(repo, version_file_path)
Parameters
  • repo (git.Repo) – The git repository to work with.

  • version_file_path (pathlib.Path) – The __init__.py file that shall be modified.

bump_to_prelease()

Bump to next version number. E.g. go from 8.0.2 to 8.0.3-dev.

update(new_version)

Set a new version number.

Parameters

new_version (str) – Version number.

tsfpga.tools.version_number_handler.commit_and_tag_release(repo, version, git_tag)

Make a git commit with a “release” message, and tag it.

Parameters
  • repo (git.Repo) – The git repository to work with.

  • version (str) – New version.

  • git_tag (str) – New git tag.

tsfpga.tools.version_number_handler.make_commit(repo, commit_message)

Make a git commit, and check that it worked.

Parameters
  • repo (git.Repo) – The git repository to work with.

  • commit_message (str) – Commit message to use.

tsfpga.tools.version_number_handler.verify_new_version_number(repo, pypi_project_name, new_version, unreleased_notes_file)

Verify that the new version number is sane for this project. Will check git log and PyPI release history.

Parameters
  • repo (git.Repo) – The git repository to work with.

  • pypi_project_name (str) – The name of this project on PyPI.

  • version (str) – New version.

  • unreleased_notes_file (pathlib.Path) – Path to the “unreleased.rst” release notes file. Must not be empty.