-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2990 from branchvincent/pyproject
Make pyproject.toml's version dynamic
- Loading branch information
Showing
4 changed files
with
6 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,30 +11,15 @@ | |
|
||
# Import system libs | ||
import locale | ||
import os | ||
import platform | ||
import re | ||
import signal | ||
import sys | ||
import tracemalloc | ||
from importlib import metadata | ||
|
||
# Global name | ||
# Version is now set in the pyproject.toml file | ||
# and should start and end with a numerical char | ||
# Version should start and end with a numerical char | ||
# See https://packaging.python.org/specifications/core-metadata/#version | ||
try: | ||
# Read the version from the metadata (when deployed with Pypi) | ||
__version__ = metadata.version("glances") | ||
except metadata.PackageNotFoundError: | ||
if os.path.exists('pyproject.toml'): | ||
# In local try to read the version in the pyproject.toml file | ||
# Dirty but it make the job | ||
with open('pyproject.toml', encoding='utf-8') as f: | ||
__version__ = re.search(r"^version = ['\"]([^'\"]*)['\"]", f.read(), re.M).group(1) | ||
else: | ||
# Else set a unknown version | ||
__version__ = "0.0.0+unknown" | ||
__version__ = "4.3.0_dev02" | ||
__apiversion__ = '4' | ||
__author__ = 'Nicolas Hennion <[email protected]>' | ||
__license__ = 'LGPLv3' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters