Skip to content

Latest commit

 

History

History
98 lines (65 loc) · 3.71 KB

README.md

File metadata and controls

98 lines (65 loc) · 3.71 KB

Qtsdk

Overview

The qtsdk repository provides tools used in packaging.

Requirements

  • Python version 3.11.3 (for installation, see pyenv or pyenv-win)
  • Pip version 18.0 or higher
  • 7z command line utility added to PATH
  • Relevant toolchains for building e.g. GCC, MinGW, MSVC

Running the packaging scripts

Scripts in this repository are intended to be run inside a virtual environment.

The officially recommended tool Pipenv is used to manage Python dependencies and create virtualenv.

For more information see Pipenv documentation and the following subsections.

Setting up Python virtual environment

Use the package manager pip to install Pipenv.

Note: It is recommended to do user installation with --user to avoid breaking any system-wide packages.

pip install pipenv --user

Inside the repository, install the virtual environment from Pipfile, which contains the required Python dependencies.

This will create a virtualenv environment with the dependencies installed.

Note: It is recommended to skip Pipfile.lock generation with --skip-lock as this file is not committed to the repository.

pipenv install --skip-lock

Using the virtual environment

Activate Pipenv shell to run commands inside the newly created virtual environment:

pipenv shell

Alternatively, to run a single command you can usepipenv run. For example, the following will execute python --version printing out the Python version in the virtualenv:

pipenv run python --version

Contributing

Instructions for Gerrit can be found in Qt Wiki: Setting up Gerrit

Installing the development packages

Install the development packages to your virtual environment with the --dev option:

pipenv install --dev --skip-lock

Setting up Git hooks

Follow the instructions on Setting up git hooks and install the following hooks:

  • commit-msg hook if not already installed. (Gerrit Commit-Ids)
  • (Optional) post-commit hook. (Sanity Bot)

Hooks for unit tests and quality assurance

In addition, this repository uses hooks from pre-commit framework to run unit tests and perform several code quality checks on changed files.

The configuration file for pre-commit hooks is .pre-commit-config.yaml located at the root of the repository.

It is recommended to enable these additional hooks to spot new regressions early and ensure compliance with the code style.

The following command available in the virtual environment will enable the pre-commit hooks in the repository:

pre-commit install

If you would like to for whatever reason skip the pre-commit validations when for example working on a WIP commit, you can use --no-verify to temporarily disable hooks:

git commit --no-verify

To manually run hooks, you may use the following:

pre-commit run  # All hooks
pre-commit run pytest  # Only run the specified hook, 'pytest'. See the configuration file for list of hooks

Hint: to specify custom files to pass to the hooks, add filters --all-files, --files <pattern> or --exclude <pattern>

For more pre-commit usage examples and details, see the documentation