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
|
frontend: $(INSTALL_PREFIX)/bin/msspec
|
||||||
|
|
||||||
|
|
||||||
dist/msspec-$(VERSION).tar.gz: VERSION
|
dist/msspec-$(VERSION).tar.gz: msspec/VERSION
|
||||||
@echo "Creating Python source distribution..."
|
@echo "Creating Python source distribution..."
|
||||||
@+$(INSIDE_VENV) pip install build
|
@+$(INSIDE_VENV) pip install build && python -m build
|
||||||
@+$(INSIDE_VENV) $(PYTHON_EXE) -m build
|
|
||||||
|
|
||||||
|
|
||||||
$(INSTALL_PREFIX)/bin/msspec: msspec.sh.template VERSION
|
$(INSTALL_PREFIX)/bin/msspec: msspec.sh.template msspec/VERSION
|
||||||
@echo "Installing frontend command..."
|
@echo "Installing frontend command..."
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
@cat $< | sed -e 's#__VENV_PATH__#$(VENV_PATH)#' > $@
|
@cat $< | sed -e 's#__VENV_PATH__#$(VENV_PATH)#' > $@
|
||||||
|
@ -26,7 +25,7 @@ pybinding:
|
||||||
@echo "Building Python binding for phagen and spec..."
|
@echo "Building Python binding for phagen and spec..."
|
||||||
@+$(MAKE) -C msspec/phagen/fortran all
|
@+$(MAKE) -C msspec/phagen/fortran all
|
||||||
@+$(MAKE) -C msspec/spec/fortran all
|
@+$(MAKE) -C msspec/spec/fortran all
|
||||||
@echo "$(VERSION)" > VERSION
|
@echo "$(VERSION)" > msspec/VERSION
|
||||||
|
|
||||||
|
|
||||||
results: msspec/results.txt
|
results: msspec/results.txt
|
||||||
|
@ -54,7 +53,7 @@ clean::
|
||||||
# remove previous sdist
|
# remove previous sdist
|
||||||
@rm -rf dist
|
@rm -rf dist
|
||||||
@rm -rf *.egg*
|
@rm -rf *.egg*
|
||||||
@rm -f VERSION
|
@rm -f msspec/VERSION
|
||||||
|
|
||||||
|
|
||||||
help:
|
help:
|
||||||
|
|
|
@ -23,29 +23,37 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from setuptools_scm import get_version
|
|
||||||
from importlib.metadata import version
|
from importlib.metadata import version
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
# find the version number
|
# find the version number
|
||||||
# 1- If it fails, try to read it from the distribution file
|
# 1- Try to read it from the git info
|
||||||
# 2- 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 VERSION file
|
# 3- If it fails, try to read it from the distribution file
|
||||||
|
|
||||||
PKGNAME = 'msspec'
|
PKGNAME = 'msspec'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
__version__ = get_version(root='../..', relative_to=__file__)
|
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:
|
except Exception as err:
|
||||||
try:
|
print(err)
|
||||||
__version__ = version(PKGNAME)
|
|
||||||
except Exception as err:
|
|
||||||
try:
|
try:
|
||||||
thisfile_path = os.path.abspath(__file__)
|
thisfile_path = os.path.abspath(__file__)
|
||||||
thisfile_dir = os.path.dirname(thisfile_path)
|
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:
|
with open(versionfile, "r") as fd:
|
||||||
__version__ = fd.readline().strip()
|
__version__ = fd.readline().strip()
|
||||||
|
print("from VERSION: ", __version__)
|
||||||
|
except Exception as err:
|
||||||
|
try:
|
||||||
|
__version__ = version(PKGNAME)
|
||||||
|
print("from metadata: ", __version__)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print("Unable to get the version number!")
|
print("Unable to get the version number!")
|
||||||
__version__ = "0.0.0"
|
__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...) #
|
# /!\ DO NOT EDIT BELOW THAT LINE (unlesss you know what you're doing...) #
|
||||||
# CORE CONFIGURATION #
|
# 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)
|
VENV_PATH := $(INSTALL_PREFIX)/src/msspec_venv_$(VERSION)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,5 +50,6 @@ install_requires =
|
||||||
terminaltables
|
terminaltables
|
||||||
|
|
||||||
[options.package_data]
|
[options.package_data]
|
||||||
msspec.phagen.fortran = *.so
|
msspec.phagen = fortran/*.so
|
||||||
msspec.spec.fortran = *.so
|
msspec.spec = fortran/*.so
|
||||||
|
msspec = VERSION
|
||||||
|
|
Loading…
Reference in New Issue