aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside-tools/project/__init__.py
blob: e57a9ff889f0b7e1d746f89494c177b6b0ae4e6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

from dataclasses import dataclass

QTPATHS_CMD = "qtpaths6"
MOD_CMD = "pyside6-metaobjectdump"

PROJECT_FILE_SUFFIX = ".pyproject"
QMLDIR_FILE = "qmldir"

QML_IMPORT_NAME = "QML_IMPORT_NAME"
QML_IMPORT_MAJOR_VERSION = "QML_IMPORT_MAJOR_VERSION"
QML_IMPORT_MINOR_VERSION = "QML_IMPORT_MINOR_VERSION"
QT_MODULES = "QT_MODULES"

METATYPES_JSON_SUFFIX = "metatypes.json"
TRANSLATION_SUFFIX = ".ts"
SHADER_SUFFIXES = ".vert", ".frag"


class Singleton(type):
    _instances = {}

    def __call__(cls, *args, **kwargs):
        if cls not in cls._instances:
            cls._instances[cls] = super().__call__(*args, **kwargs)
        return cls._instances[cls]


@dataclass(frozen=True)
class ClOptions(metaclass=Singleton):
    """
    Dataclass to store the cl options that needs to be passed as arguments.
    """
    dry_run: bool
    quiet: bool
    force: bool
    qml_module: bool


from .utils import (run_command, requires_rebuild, remove_path, package_dir, qtpaths,
                    qt_metatype_json_dir, resolve_project_file)
from .project_data import (is_python_file, ProjectData, QmlProjectData,
                           check_qml_decorators)
from .newproject import new_project, ProjectType