feat: Add python base project files

These files create a callable Python package and manage the version
number of the complete project in the __about__.py file only. All other
parts, including Makefile, will use that version number.
This commit is contained in:
Sven Sager
2023-10-02 14:46:06 +02:00
committed by Sven Sager
parent 251bec2b38
commit cc5eb516bf
3 changed files with 41 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
# SPDX-FileCopyrightText: 2025 KUNBUS GmbH
# SPDX-License-Identifier: GPL-2.0-or-later
"""Metadata of package."""
__author__ = "Sven Sager"
__copyright__ = "Copyright (C) 2025 KUNBUS GmbH"
__license__ = " GPL-2.0-or-later"
__version__ = "0.0.1"

View File

@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# SPDX-FileCopyrightText: 2025 KUNBUS GmbH
# SPDX-License-Identifier: GPL-2.0-or-later
"""Package: revpi_middleware."""
from .__about__ import __author__, __copyright__, __license__, __version__

View File

@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# SPDX-FileCopyrightText: 2025 KUNBUS GmbH
# SPDX-License-Identifier: GPL-2.0-or-later
"""Start main application of this package."""
# If we are running from a wheel, add the wheel to sys.path
if __package__ == "":
from os.path import dirname
from sys import path
# __file__ is package-*.whl/package/__main__.py
# Resulting path is the name of the wheel itself
package_path = dirname(dirname(__file__))
path.insert(0, package_path)
if __name__ == "__main__":
import sys
try:
# Use absolute import in the __main__ module
from revpi_middleware.main_application import main
# Run the main application of this package
sys.exit(main())
except Exception as e:
sys.stderr.write(f"Can not start __main__ module: {e}\n")
sys.exit(1)