mirror of
https://github.com/naruxde/revpicommander.git
synced 2025-11-09 08:58:04 +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:
@@ -3,4 +3,5 @@
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2023 Sven Sager"
|
||||
__license__ = "GPLv3"
|
||||
__version__ = "0.9.10rc3"
|
||||
|
||||
from .__main__ import __version__
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2023 Sven Sager"
|
||||
__license__ = "GPLv3"
|
||||
__version__ = "0.9.10rc4"
|
||||
|
||||
# If we are running from a wheel, add the wheel to sys.path
|
||||
if __package__ == "":
|
||||
@@ -16,7 +17,14 @@ if __package__ == "":
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
from revpicommander.revpicommander import main
|
||||
|
||||
# Run the main application of this package
|
||||
sys.exit(main())
|
||||
if len(sys.argv) == 2 and "--version" in sys.argv:
|
||||
# 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",
|
||||
help="Save log entries to this file"
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-v", "--verbose", action="count", dest="verbose", default=0,
|
||||
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()
|
||||
|
||||
# Check important objects and set to default if they do not exists
|
||||
|
||||
Reference in New Issue
Block a user