mirror of
https://github.com/naruxde/revpicommander.git
synced 2025-11-08 16:43:53 +01:00
Move version number from __init__.py to __main__.py
This will allow the access from outside the package. setup.py and the Makefile can use this version number. The __init__.py script imports the version number, so the module will have the __version__ variable as usual.
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||||
|
|
||||||
#define MyAppName "RevPi Commander"
|
#define MyAppName "RevPi Commander"
|
||||||
#define MyAppVersion "0.9.10rc3"
|
#define MyAppVersion "0.9.10rc4"
|
||||||
#define MyAppPublisher "Sven Sager"
|
#define MyAppPublisher "Sven Sager"
|
||||||
#define MyAppURL "https://revpimodio.org/"
|
#define MyAppURL "https://revpimodio.org/"
|
||||||
#define MyAppICO "data\revpicommander.ico"
|
#define MyAppICO "data\revpicommander.ico"
|
||||||
|
|||||||
4
setup.py
4
setup.py
@@ -6,9 +6,11 @@ __license__ = "GPLv3"
|
|||||||
|
|
||||||
from setuptools import find_namespace_packages, setup
|
from setuptools import find_namespace_packages, setup
|
||||||
|
|
||||||
|
from src.revpicommander.__main__ import __version__
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="revpicommander",
|
name="revpicommander",
|
||||||
version="0.9.10rc3",
|
version=__version__,
|
||||||
|
|
||||||
packages=find_namespace_packages("src"),
|
packages=find_namespace_packages("src"),
|
||||||
package_dir={'': 'src'},
|
package_dir={'': 'src'},
|
||||||
|
|||||||
@@ -3,4 +3,5 @@
|
|||||||
__author__ = "Sven Sager"
|
__author__ = "Sven Sager"
|
||||||
__copyright__ = "Copyright (C) 2023 Sven Sager"
|
__copyright__ = "Copyright (C) 2023 Sven Sager"
|
||||||
__license__ = "GPLv3"
|
__license__ = "GPLv3"
|
||||||
__version__ = "0.9.10rc3"
|
|
||||||
|
from .__main__ import __version__
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
__author__ = "Sven Sager"
|
__author__ = "Sven Sager"
|
||||||
__copyright__ = "Copyright (C) 2023 Sven Sager"
|
__copyright__ = "Copyright (C) 2023 Sven Sager"
|
||||||
__license__ = "GPLv3"
|
__license__ = "GPLv3"
|
||||||
|
__version__ = "0.9.10rc4"
|
||||||
|
|
||||||
# If we are running from a wheel, add the wheel to sys.path
|
# If we are running from a wheel, add the wheel to sys.path
|
||||||
if __package__ == "":
|
if __package__ == "":
|
||||||
@@ -16,7 +17,14 @@ if __package__ == "":
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import sys
|
import sys
|
||||||
from revpicommander.revpicommander import main
|
|
||||||
|
|
||||||
# Run the main application of this package
|
if len(sys.argv) == 2 and "--version" in sys.argv:
|
||||||
sys.exit(main())
|
# Catch --version, if this is the only argument (sys.argv[0] is always the script name)
|
||||||
|
print(__version__)
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
else:
|
||||||
|
from revpicommander.revpicommander import main
|
||||||
|
|
||||||
|
# Run the main application of this package
|
||||||
|
sys.exit(main())
|
||||||
|
|||||||
@@ -89,11 +89,12 @@ parser.add_argument(
|
|||||||
"-f", "--logfile", dest="logfile",
|
"-f", "--logfile", dest="logfile",
|
||||||
help="Save log entries to this file"
|
help="Save log entries to this file"
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-v", "--verbose", action="count", dest="verbose", default=0,
|
"-v", "--verbose", action="count", dest="verbose", default=0,
|
||||||
help="Switch on verbose logging"
|
help="Switch on verbose logging"
|
||||||
)
|
)
|
||||||
|
# The __main__ script will process the version number argument
|
||||||
|
parser.add_argument("--version", action="store_true", help="Print version number of program and exit")
|
||||||
pargs = parser.parse_args()
|
pargs = parser.parse_args()
|
||||||
|
|
||||||
# Check important objects and set to default if they do not exists
|
# Check important objects and set to default if they do not exists
|
||||||
|
|||||||
Reference in New Issue
Block a user