scripts/install-dependencies.py

Wed, 13 Jul 2022 14:55:47 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 13 Jul 2022 14:55:47 +0200
branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9314
7ba79b00ea96
permissions
-rw-r--r--

Reformatted the source code using the 'Black' utility.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Copyright (c) 2022 Detlev Offenbach <detlev@die-offenbachs.de>
#
# This script installs all packages eric depends on.

"""
Installation script for the eric IDE dependencies.
"""

import subprocess
import sys


def pipInstall(packageName):
    """
    Install the given package via pip.

    @param packageName name of the package to be installed
    @type str
    @return flag indicating a successful installation
    @rtype bool
    """
    ok = False
    exitCode = subprocess.run(  # secok
        [
            sys.executable,
            "-m",
            "pip",
            "install",
            "--prefer-binary",
            "--upgrade",
            packageName,
        ]
    ).returncode
    ok = exitCode == 0

    return ok


def main():
    """
    Function to install the eric dependencies.
    """
    packages = (
        "wheel",
        "PyQt6>=6.2.0",
        "PyQt6-Charts>=6.2.0",
        "PyQt6-WebEngine>=6.2.0",
        "PyQt6-QScintilla>=2.13.0",
        "docutils",
        "Markdown",
        "pyyaml",
        "tomlkit",
        "chardet",
        "asttokens",
        "EditorConfig",
        "Send2Trash",
        "Pygments",
        "parso",
        "jedi",
        "packaging",
        "pipdeptree",
        "cyclonedx-python-lib",
        "cyclonedx-bom",
        "trove-classifiers",
    )

    failedPackages = []
    for package in packages:
        ok = pipInstall(package)
        if not ok:
            failedPackages.append(package)

    print()
    print("Installation Summary")
    print("--------------------")
    if failedPackages:
        print("These packages could not be installed:")
        for package in failedPackages:
            print("    " + package)
    else:
        print("All packages installed successfully.")


if __name__ == "__main__":
    main()

#
# eflag: noqa = M801

eric ide

mercurial