Change the version mechanism
This commit is contained in:
parent
6785e7228a
commit
6f254e688e
|
@ -2,12 +2,11 @@
|
||||||
|
|
||||||
SCRIPT_PATH="$0"
|
SCRIPT_PATH="$0"
|
||||||
SCRIPT_NAME=$(basename "$SCRIPT_PATH")
|
SCRIPT_NAME=$(basename "$SCRIPT_PATH")
|
||||||
VERSION="__VERSION__"
|
|
||||||
VENV_PATH="__VENV_PATH__"
|
VENV_PATH="__VENV_PATH__"
|
||||||
|
|
||||||
# Check venv path
|
# Check venv path
|
||||||
if ! [ -d "$VENV_PATH" ]; then
|
if ! [ -d "$VENV_PATH" ]; then
|
||||||
echo "ERROR: Unable to find version $VERSION of msspec!!"
|
echo "ERROR: Unable to find msspec!!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -15,6 +14,10 @@ launch_script() {
|
||||||
. "$VENV_PATH/bin/activate" && python "$@"
|
. "$VENV_PATH/bin/activate" && python "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
show_version () {
|
||||||
|
. "$VENV_PATH/bin/activate" && python -c "import msspec; print(msspec.__version__)"
|
||||||
|
}
|
||||||
|
|
||||||
show_help () {
|
show_help () {
|
||||||
echo "Usage: 1) $SCRIPT_NAME -p [PYTHON OPTIONS] SCRIPT [ARGUMENTS...]"
|
echo "Usage: 1) $SCRIPT_NAME -p [PYTHON OPTIONS] SCRIPT [ARGUMENTS...]"
|
||||||
echo " 2) $SCRIPT_NAME [-l FILE | -i | -h]"
|
echo " 2) $SCRIPT_NAME [-l FILE | -i | -h]"
|
||||||
|
@ -92,7 +95,7 @@ while getopts "hvil:p:eu" option; do
|
||||||
;;
|
;;
|
||||||
u) uninstall
|
u) uninstall
|
||||||
;;
|
;;
|
||||||
v) echo $VERSION
|
v) show_version
|
||||||
;;
|
;;
|
||||||
*|h) show_help
|
*|h) show_help
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -17,12 +17,13 @@
|
||||||
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# Source file : src/msspec/version.py
|
# Source file : src/msspec/version.py
|
||||||
# Last modified: Thu, 06 Oct 2022 18:27:24 +0200
|
# Last modified: Wed, 26 Oct 2022 17:15:24 +0200
|
||||||
# Committed by : Sylvain Tricot <sylvain.tricot@univ-rennes1.fr> 1665073644 +0200
|
# Committed by : Sylvain Tricot <sylvain.tricot@univ-rennes1.fr> 1666797324 +0200
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from setuptools_scm import get_version
|
||||||
from importlib.metadata import version
|
from importlib.metadata import version
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
@ -34,14 +35,10 @@ import subprocess
|
||||||
PKGNAME = 'msspec'
|
PKGNAME = 'msspec'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
__version__ = version(PKGNAME)
|
__version__ = get_version(root='../..', relative_to=__file__)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
try:
|
try:
|
||||||
p = subprocess.run(["git", "describe"], capture_output=True, text=True)
|
__version__ = version(PKGNAME)
|
||||||
if p.stdout not in ("", None):
|
|
||||||
__version__ = p.stdout.strip()
|
|
||||||
else:
|
|
||||||
raise NameError("git describe failed!")
|
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
try:
|
try:
|
||||||
thisfile_path = os.path.abspath(__file__)
|
thisfile_path = os.path.abspath(__file__)
|
||||||
|
@ -51,4 +48,4 @@ except Exception as err:
|
||||||
__version__ = fd.readline().strip()
|
__version__ = fd.readline().strip()
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print("Unable to get the version number!")
|
print("Unable to get the version number!")
|
||||||
__version__ = "9.9.9"
|
__version__ = "0.0.0"
|
||||||
|
|
Loading…
Reference in New Issue