Commit ea14f325 authored by Jerome Flesch's avatar Jerome Flesch

Merge branch 'setuptools-scm' into 'master'

Switch to setuptools-scm for versioning

Closes #108

See merge request !115
parents e96fe9ba c0eb522d
ref-names: $Format:%D$
.git_archival.txt export-subst
VERSION_FILE = src/pyocr/_version.py
PYTHON = python3
build: build_c build_py
......@@ -7,18 +6,11 @@ install: install_py install_c
uninstall: uninstall_py
build_py: ${VERSION_FILE}
build_py:
${PYTHON} ./setup.py build
build_c:
${VERSION_FILE}:
echo -n "version = \"" >| $@
echo -n $(shell git describe --always) >> $@
echo "\"" >> $@
version: ${VERSION_FILE}
doc: install_py
(cd doc && make html)
cp doc/index.html doc/build/index.html
......@@ -27,7 +19,7 @@ check:
flake8
# pydocstyle src/pyocr
test: ${VERSION_FILE}
test:
tox
linux_exe:
......@@ -45,7 +37,6 @@ else
git tag -a ${RELEASE} -m ${RELEASE}
git push origin ${RELEASE}
make clean
make version
${PYTHON} ./setup.py sdist
twine upload dist/pyocr-${RELEASE}.tar.gz
@echo "All done"
......@@ -55,9 +46,8 @@ clean:
rm -rf doc/build
rm -rf build dist *.egg-info
rm -rf src/pyocr/__pycache__
rm -f ${VERSION_FILE}
install_py: ${VERSION_FILE}
install_py:
${PYTHON} ./setup.py install ${PIP_ARGS}
install_c:
......@@ -92,5 +82,4 @@ help:
release \
test \
uninstall \
uninstall_c \
version
uninstall_c
......@@ -3,21 +3,8 @@
import sys
from setuptools import setup
try:
with open("src/pyocr/_version.py", "r") as file_descriptor:
version = file_descriptor.read().strip()
version = version.split(" ")[2][1:-1]
print("PyOCR version: {}".format(version))
if "-" in version:
version = version.split("-")[0]
except FileNotFoundError:
print("ERROR: _version.py file is missing")
print("ERROR: Please run 'make version' first")
sys.exit(1)
setup(
name="pyocr",
version=version,
description=("A Python wrapper for OCR engines (Tesseract, Cuneiform,"
" etc)"),
keywords="tesseract cuneiform ocr",
......@@ -44,8 +31,7 @@ setup(
'pyocr.libtesseract',
],
package_dir={
'pyocr': 'src/pyocr',
'pyocr.libtesseract': 'src/pyocr/libtesseract',
'': 'src',
},
data_files=[],
scripts=[],
......@@ -54,4 +40,11 @@ setup(
"Pillow",
"six",
],
setup_requires=[
'setuptools_scm',
'setuptools_scm_git_archive',
],
use_scm_version={
'write_to': 'src/pyocr/_version.py',
},
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment