add pip package build/upload, check version tags
This commit is contained in:
parent
0969d626b8
commit
0403f2bc64
13
README.md
13
README.md
@ -141,6 +141,19 @@ make cython-build
|
|||||||
However, in a production environment, a proper installation of the module with
|
However, in a production environment, a proper installation of the module with
|
||||||
`make cython-install` is recommended for system-wide availability of the module.
|
`make cython-install` is recommended for system-wide availability of the module.
|
||||||
|
|
||||||
|
#### Installation with pip
|
||||||
|
|
||||||
|
The package is also available in the [Python Package Index](https://pypi.org)
|
||||||
|
at [IMCtermite](https://pypi.org/project/IMCtermite/).
|
||||||
|
To install the latest version simply do
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
python3 -m pip install IMCtermite
|
||||||
|
```
|
||||||
|
|
||||||
|
Note, that _python3_setuptools_ and _gcc version >= 10.2.0_ are required to
|
||||||
|
successfully install and use it.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### CLI
|
### CLI
|
||||||
|
@ -14,7 +14,7 @@ extensions = Extension(
|
|||||||
)
|
)
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
version='0.1',
|
version='1.2.2',
|
||||||
description='IMCtermite cython extension',
|
description='IMCtermite cython extension',
|
||||||
author='Record Evolution GmbH',
|
author='Record Evolution GmbH',
|
||||||
author_email='mario.fink@record-evolution.de',
|
author_email='mario.fink@record-evolution.de',
|
||||||
|
71
makefile
71
makefile
@ -1,5 +1,7 @@
|
|||||||
#-----------------------------------------------------------------------------#
|
#-----------------------------------------------------------------------------#
|
||||||
|
|
||||||
|
SHELL := /bin/bash
|
||||||
|
|
||||||
# name of executable and CLI tool
|
# name of executable and CLI tool
|
||||||
EXE = imctermite
|
EXE = imctermite
|
||||||
|
|
||||||
@ -17,9 +19,11 @@ CC = g++ -std=c++17
|
|||||||
#OPT = -O3 -Wall -mavx -mno-tbm -mf16c -mno-f16c
|
#OPT = -O3 -Wall -mavx -mno-tbm -mf16c -mno-f16c
|
||||||
OPT = -O3 -Wall -Werror -Wunused-variable -Wsign-compare
|
OPT = -O3 -Wall -Werror -Wunused-variable -Wsign-compare
|
||||||
|
|
||||||
# determine git version/commit tag
|
# determine git version/commit and release tag
|
||||||
GTAG := $(shell git tag | tail -n1)
|
GTAG := $(shell git tag | tail -n1)
|
||||||
GHSH := $(shell git rev-parse HEAD | head -c8)
|
GHSH := $(shell git rev-parse HEAD | head -c8)
|
||||||
|
RTAG := v$(shell cat pip/setup.py | grep version | grep -oP "([0-9]\.){2}[0-9]")
|
||||||
|
CTAG := v$(shell cat cython/setup.py | grep version | grep -oP "([0-9]\.){2}[0-9]")
|
||||||
|
|
||||||
# define install location
|
# define install location
|
||||||
INST := /usr/local/bin
|
INST := /usr/local/bin
|
||||||
@ -28,8 +32,8 @@ INST := /usr/local/bin
|
|||||||
# C++ and CLI tool
|
# C++ and CLI tool
|
||||||
|
|
||||||
# build exectuable
|
# build exectuable
|
||||||
$(EXE) : main.o
|
$(EXE) : check-vtag $(RTAG) main.o
|
||||||
$(CC) $(OPT) $^ -o $@
|
$(CC) $(OPT) main.o -o $@
|
||||||
|
|
||||||
# build main.cpp and include git version/commit tag
|
# build main.cpp and include git version/commit tag
|
||||||
main.o : src/main.cpp $(HPP)
|
main.o : src/main.cpp $(HPP)
|
||||||
@ -45,10 +49,22 @@ install : $(EXE)
|
|||||||
uninstall : $(INST)/$(EXE)
|
uninstall : $(INST)/$(EXE)
|
||||||
rm $<
|
rm $<
|
||||||
|
|
||||||
clean :
|
cpp-clean :
|
||||||
rm -vf $(EXE)
|
rm -vf $(EXE)
|
||||||
rm -vf *.o
|
rm -vf *.o
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------#
|
||||||
|
# check version consistency of git tags and version string in package.json
|
||||||
|
|
||||||
|
$(GTAG) :
|
||||||
|
@echo "consistent versions check successful: building $(GTAG)"
|
||||||
|
|
||||||
|
check-vtag:
|
||||||
|
@echo "git tag version: "$(GTAG)
|
||||||
|
@echo "git commit hash: "$(GHSH)
|
||||||
|
@echo "release version: "$(RTAG)
|
||||||
|
@echo "module version: "$(CTAG)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------#
|
#-----------------------------------------------------------------------------#
|
||||||
# Docker
|
# Docker
|
||||||
|
|
||||||
@ -61,48 +77,27 @@ docker-run:
|
|||||||
#-----------------------------------------------------------------------------#
|
#-----------------------------------------------------------------------------#
|
||||||
# python
|
# python
|
||||||
|
|
||||||
cython-build : $(CYT)setup.py $(CYT)imc_termite.pxd $(CYT)py_imc_termite.pyx $(HPP)
|
cython-build : check-vtag $(CTAG) $(CYT)setup.py $(CYT)imc_termite.pxd $(CYT)py_imc_termite.pyx $(HPP)
|
||||||
python3 $< build_ext --inplace
|
python3 $(CYT)setup.py build_ext --inplace
|
||||||
cp -v imc_termite.cpython-*.so $(PYT)
|
cp -v imc_termite.cpython-*.so $(PYT)
|
||||||
|
|
||||||
cython-install : $(CYT)setup.py $(CYT)imc_termite.pxd $(CYT)py_imc_termite.pyx $(HPP)
|
cython-install : check-vtag $(CTAG) $(CYT)setup.py $(CYT)imc_termite.pxd $(CYT)py_imc_termite.pyx $(HPP)
|
||||||
python3 $< install --record files_imctermite.txt
|
python3 $(CYT)setup.py install --record files_imctermite.txt
|
||||||
|
|
||||||
cython-clean :
|
cython-clean :
|
||||||
rm -vf imc_termite.cpython-*.so
|
rm -vf imc_termite.cpython-*.so
|
||||||
rm -vf $(PYT)imc_termite.cpython-*.so
|
rm -vf $(PYT)imc_termite.cpython-*.so
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------#
|
#-----------------------------------------------------------------------------#
|
||||||
# Python (to be removed)
|
# pip
|
||||||
|
|
||||||
# build python module
|
pip-release: check-vtag $(RTAG) cython-build
|
||||||
py : $(CYT)setup_raw_eater.py $(CYT)raw_eater.pyx $(CYT)raw_eater.pxd $(LIB)raweat.hpp \
|
cd ./pip/ && make publish
|
||||||
$(CYT)setup_raw_meat.py $(CYT)raw_meat.pyx $(CYT)raw_meat.pxd $(LIB)rawmerge.hpp \
|
|
||||||
output
|
#-----------------------------------------------------------------------------#
|
||||||
python3 $(CYT)setup_raw_eater.py build_ext --inplace
|
# clean
|
||||||
python3 $(CYT)setup_raw_meat.py build_ext --inplace
|
|
||||||
cp raw_eater.cpython-*.so $(PYT)
|
clean: cpp-clean cython-clean
|
||||||
cp raw_meat.cpython-*.so $(PYT)
|
cd ./pip/ && make clean
|
||||||
rm *.so
|
|
||||||
|
|
||||||
py-install: $(CYT)setup_raw_eater.py $(CYT)raw_eater.pyx $(CYT)raw_eater.pxd $(LIB)raweat.hpp \
|
|
||||||
$(CYT)setup_raw_meat.py $(CYT)raw_meat.pyx $(CYT)raw_meat.pxd $(LIB)rawmerge.hpp
|
|
||||||
python3 $(CYT)setup_raw_eater.py install --record files_raw_eater.txt
|
|
||||||
python3 $(CYT)setup_raw_meat.py install --record files_raw_meat.txt
|
|
||||||
|
|
||||||
py-clean :
|
|
||||||
rm -f raw_eater.cpython-*.so
|
|
||||||
rm -f $(PYT)raw_eater.cpython-*.so
|
|
||||||
rm -f $(CYT)raw_eater.cpp
|
|
||||||
rm -f raw_meat.cpython-*.so
|
|
||||||
rm -f $(PYT)raw_meat.cpython-*.so
|
|
||||||
rm -f $(CYT)raw_meat.cpp
|
|
||||||
rm -rf build/
|
|
||||||
rm -f *.txt
|
|
||||||
rm -rf output/
|
|
||||||
|
|
||||||
# prepare directory for test output
|
|
||||||
output :
|
|
||||||
mkdir -pv output/
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------#
|
#-----------------------------------------------------------------------------#
|
||||||
|
4
pip/MANIFEST.in
Normal file
4
pip/MANIFEST.in
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
include *.hpp
|
||||||
|
include *.cpp
|
||||||
|
include *.pyx
|
||||||
|
include *.pxd
|
4
pip/bkup.pyproject.toml
Normal file
4
pip/bkup.pyproject.toml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = [
|
||||||
|
"setuptools"
|
||||||
|
]
|
26
pip/makefile
Normal file
26
pip/makefile
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
SHELL := /bin/bash
|
||||||
|
|
||||||
|
publish: sdist upload
|
||||||
|
|
||||||
|
sdist: ../cython/py_imc_termite.pyx ../cython/imc_termite.pxd ../cython/py_imc_termite.cpp
|
||||||
|
cp -v $? ./
|
||||||
|
cp -v $(shell ls ../lib/imc_*.hpp) ./
|
||||||
|
tail -n $(($(cat README.md | wc -l)-10)) README.md > ./README.md
|
||||||
|
cp -v ../LICENSE ./
|
||||||
|
python3 setup.py sdist
|
||||||
|
|
||||||
|
upload:
|
||||||
|
python3 -m twine upload dist/$(shell ls -t dist/ | head -n1)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rvf dist/
|
||||||
|
rm -rvf *.egg-info
|
||||||
|
rm -rvf build/
|
||||||
|
rm -rvf cython/
|
||||||
|
rm -vf *.pyx *.pxd
|
||||||
|
rm -vf *.cpp *.c *.hpp
|
||||||
|
rm -vf README.md LICENSE
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------- #
|
37
pip/setup.py
Normal file
37
pip/setup.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
from setuptools import setup, Extension
|
||||||
|
import os
|
||||||
|
|
||||||
|
with open("README.md", "r", encoding="utf-8") as fh:
|
||||||
|
long_description = fh.read()
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name="IMCtermite",
|
||||||
|
version="1.2.2",
|
||||||
|
author="Record Evolution GmbH",
|
||||||
|
author_email="mario.fink@record-evolution.de",
|
||||||
|
maintainer="Record Evolution GmbH",
|
||||||
|
license="MIT",
|
||||||
|
description="Enables extraction of measurement data from binary files with extension 'raw' used by proprietary software imcFAMOS/imcSTUDIO and facilitates its storage in open source file formats",
|
||||||
|
keywords="IMC raw imcFAMOS imcSTUDIO imcCRONOS",
|
||||||
|
long_description=long_description,
|
||||||
|
long_description_content_type="text/markdown",
|
||||||
|
url="https://github.com/RecordEvolution/IMCtermite.git",
|
||||||
|
project_urls={
|
||||||
|
"Bug Tracker": "https://github.com/RecordEvolution/IMCtermite/issues",
|
||||||
|
},
|
||||||
|
classifiers=[
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
|
"License :: OSI Approved :: MIT License",
|
||||||
|
"Operating System :: OS Independent",
|
||||||
|
],
|
||||||
|
ext_modules=[Extension("imc_termite",
|
||||||
|
["py_imc_termite.cpp"],
|
||||||
|
# libraries_dirs=["cython/"],
|
||||||
|
# include_dirs=["3rdparty/pugixml/","lib/"],
|
||||||
|
# depends=["../lib/tdm_termite.hpp"]
|
||||||
|
language='c++',
|
||||||
|
extra_compile_args=['-std=c++17','-Wno-unused-variable'],
|
||||||
|
extra_link_args=['-std=c++17'],
|
||||||
|
)],
|
||||||
|
)
|
Loading…
x
Reference in New Issue
Block a user