Change the version mechanism.
setuptools_scm is no longer used to get the version of msspec. This commit is an attempt to sanitize this.
This commit is contained in:
parent
39ba8c3983
commit
5b76612c72
11
src/Makefile
11
src/Makefile
|
@ -9,13 +9,12 @@ sdist: dist/msspec-$(VERSION).tar.gz
|
|||
frontend: $(INSTALL_PREFIX)/bin/msspec
|
||||
|
||||
|
||||
dist/msspec-$(VERSION).tar.gz: VERSION
|
||||
dist/msspec-$(VERSION).tar.gz: msspec/VERSION
|
||||
@echo "Creating Python source distribution..."
|
||||
@+$(INSIDE_VENV) pip install build
|
||||
@+$(INSIDE_VENV) $(PYTHON_EXE) -m build
|
||||
@+$(INSIDE_VENV) pip install build && python -m build
|
||||
|
||||
|
||||
$(INSTALL_PREFIX)/bin/msspec: msspec.sh.template VERSION
|
||||
$(INSTALL_PREFIX)/bin/msspec: msspec.sh.template msspec/VERSION
|
||||
@echo "Installing frontend command..."
|
||||
@mkdir -p $(dir $@)
|
||||
@cat $< | sed -e 's#__VENV_PATH__#$(VENV_PATH)#' > $@
|
||||
|
@ -26,7 +25,7 @@ pybinding:
|
|||
@echo "Building Python binding for phagen and spec..."
|
||||
@+$(MAKE) -C msspec/phagen/fortran all
|
||||
@+$(MAKE) -C msspec/spec/fortran all
|
||||
@echo "$(VERSION)" > VERSION
|
||||
@echo "$(VERSION)" > msspec/VERSION
|
||||
|
||||
|
||||
results: msspec/results.txt
|
||||
|
@ -54,7 +53,7 @@ clean::
|
|||
# remove previous sdist
|
||||
@rm -rf dist
|
||||
@rm -rf *.egg*
|
||||
@rm -f VERSION
|
||||
@rm -f msspec/VERSION
|
||||
|
||||
|
||||
help:
|
||||
|
|
|
@ -23,29 +23,37 @@
|
|||
|
||||
import os
|
||||
|
||||
from setuptools_scm import get_version
|
||||
from importlib.metadata import version
|
||||
import subprocess
|
||||
|
||||
# find the version number
|
||||
# 1- If it fails, try to read it from the distribution file
|
||||
# 2- Try to read it from the git info
|
||||
# 3- If it fails, try to read it from the VERSION file
|
||||
# 1- Try to read it from the git info
|
||||
# 2- If it fails, try to read it from the VERSION file
|
||||
# 3- If it fails, try to read it from the distribution file
|
||||
|
||||
PKGNAME = 'msspec'
|
||||
|
||||
try:
|
||||
__version__ = get_version(root='../..', relative_to=__file__)
|
||||
except Exception as err:
|
||||
try:
|
||||
__version__ = version(PKGNAME)
|
||||
cmd = ["git describe|sed 's/-\([0-9]\+\)-.*/.dev\\1/g'"]
|
||||
result = subprocess.run(cmd, stdout=subprocess.PIPE, shell=True)
|
||||
__version__ = result.stdout.decode('utf-8').strip()
|
||||
if __version__ != "":
|
||||
print("from git: ", __version__)
|
||||
else:
|
||||
raise NameError("Not a git repo")
|
||||
except Exception as err:
|
||||
print(err)
|
||||
try:
|
||||
thisfile_path = os.path.abspath(__file__)
|
||||
thisfile_dir = os.path.dirname(thisfile_path)
|
||||
versionfile = os.path.join(thisfile_dir, "../VERSION")
|
||||
versionfile = os.path.join(thisfile_dir, "./VERSION")
|
||||
with open(versionfile, "r") as fd:
|
||||
__version__ = fd.readline().strip()
|
||||
print("from VERSION: ", __version__)
|
||||
except Exception as err:
|
||||
try:
|
||||
__version__ = version(PKGNAME)
|
||||
print("from metadata: ", __version__)
|
||||
except Exception as err:
|
||||
print("Unable to get the version number!")
|
||||
__version__ = "0.0.0"
|
||||
|
|
|
@ -41,7 +41,7 @@ F2PYFLAGS_DBG = --debug-capi --debug
|
|||
# /!\ DO NOT EDIT BELOW THAT LINE (unlesss you know what you're doing...) #
|
||||
# CORE CONFIGURATION #
|
||||
################################################################################
|
||||
VERSION:=$(shell git describe)
|
||||
VERSION:=$(shell git describe|sed 's/-\([0-9]\+\)-.*/.dev\1/g')
|
||||
VENV_PATH := $(INSTALL_PREFIX)/src/msspec_venv_$(VERSION)
|
||||
|
||||
|
||||
|
|
|
@ -50,5 +50,6 @@ install_requires =
|
|||
terminaltables
|
||||
|
||||
[options.package_data]
|
||||
msspec.phagen.fortran = *.so
|
||||
msspec.spec.fortran = *.so
|
||||
msspec.phagen = fortran/*.so
|
||||
msspec.spec = fortran/*.so
|
||||
msspec = VERSION
|
||||
|
|
Loading…
Reference in New Issue