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:
8
src/revpi_middleware/__about__.py
Normal file
8
src/revpi_middleware/__about__.py
Normal 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"
|
||||||
5
src/revpi_middleware/__init__.py
Normal file
5
src/revpi_middleware/__init__.py
Normal 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__
|
||||||
28
src/revpi_middleware/__main__.py
Normal file
28
src/revpi_middleware/__main__.py
Normal 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)
|
||||||
Reference in New Issue
Block a user