-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Daniel Nyga
committed
Feb 21, 2024
1 parent
cf9eab5
commit 03ebe32
Showing
1 changed file
with
37 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,70 @@ | ||
PKG_NAME=pyjpt | ||
PKG_VERSION=$(shell cat src/jpt/.version) | ||
PYTHON_PATH=/usr/bin/python3.8 | ||
PYTHON_VERSION=$(shell ${PYTHON_PATH} -c "import sys; print('%d.%d' % (sys.version_info.major, sys.version_info.minor))") | ||
ENV_NAME=.venv/${PKG_NAME}-${PKG_VERSION}-py-${PYTHON_VERSION} | ||
BASEDIR=$(shell pwd) | ||
|
||
PKG_VERSION=`test -f src/jpt/.version && cat src/jpt/.version || echo 0.0.0` | ||
|
||
ENV_PYTHON_VERSION=`test -n "${PYTHON_VERSION}" && echo ${PYTHON_VERSION} || echo 3.10` | ||
|
||
PY_VERSION_STR=$(shell echo ${ENV_PYTHON_VERSION} | tr -d '.') | ||
|
||
ARCH_STR=linux_`uname -p` | ||
|
||
PYTHON_CMD=python${ENV_PYTHON_VERSION} | ||
|
||
ENV_NAME=.venv/${PKG_NAME}-${PKG_VERSION}-cp${PY_VERSION_STR} | ||
|
||
BASEDIR=`pwd` | ||
|
||
RELEASE_NAME=${PKG_NAME}-${PKG_VERSION} | ||
|
||
versioncheck: virtualenv | ||
test ${PKG_VERSION} = `. ${ENV_NAME}/bin/activate && export PYTHONPATH=${BASEDIR}/src/jpt && python -c "import version; print(version.__version__)"` | ||
@echo Version check passed: ${PKG_VERSION} | ||
|
||
rmvirtualenv: | ||
preload: | ||
@(echo Package Name: "${PKG_NAME}") | ||
@(echo pyJPT Package Version: "${PKG_VERSION}") | ||
@(echo Python Version: "${ENV_PYTHON_VERSION}") | ||
@(echo Python Version String: "${PY_VERSION_STR}") | ||
@(echo Virtual Env Name: "${ENV_NAME}") | ||
@(echo Architecture: "${ARCH_STR}") | ||
|
||
rmvirtualenv: preload | ||
@(rm -rf .venv) | ||
|
||
virtualenv: | ||
@(virtualenv ${ENV_NAME} --python ${PYTHON_PATH}) | ||
virtualenv: preload | ||
@(virtualenv ${ENV_NAME} --python ${PYTHON_CMD}) | ||
@(. ${ENV_NAME}/bin/activate && pip install -U pip) | ||
@(. ${ENV_NAME}/bin/activate && pip install -U -r requirements.txt) # -r requirements-dev.txt) | ||
|
||
sdist: virtualenv versioncheck | ||
sdist: preload virtualenv | ||
@(echo "Build ${PKG_NAME} sdist package...") | ||
@(. ${ENV_NAME}/bin/activate && pip install -r requirements-dev.txt && python setup.py sdist) | ||
|
||
bdist: virtualenv versioncheck | ||
bdist: preload virtualenv | ||
@(echo "Build ${PKG_NAME} bdist package...") | ||
@(. ${ENV_NAME}/bin/activate && pip install -r requirements-dev.txt && python setup.py bdist) | ||
|
||
wheel: virtualenv | ||
wheel: preload virtualenv | ||
@(echo "Build ${PKG_NAME} bdist_wheel package...") | ||
@(. ${ENV_NAME}/bin/activate && pip install wheel) | ||
@(. ${ENV_NAME}/bin/activate && pip install -U wheel pip) | ||
@(. ${ENV_NAME}/bin/activate && pip install -r requirements-dev.txt && python setup.py bdist_wheel) | ||
|
||
release: clean sdist bdist wheel tests | ||
release: preload clean sdist bdist wheel tests | ||
@mkdir -p releases/${RELEASE_NAME} | ||
@cp -r dist/* releases/${RELEASE_NAME}/ | ||
@git tag ${PKG_VERSION} | ||
@git add releases/${RELEASE_NAME}/ | ||
@git commit releases/${RELEASE_NAME}/ -m 'Added: release ${RELEASE_NAME}.' | ||
|
||
all: clean virtualenv versioncheck tests sdist bdist wheel | ||
all: preload clean virtualenv tests sdist bdist wheel | ||
|
||
tests: wheel | ||
tests: preload virtualenv wheel | ||
@(echo "Running all tests...") | ||
@(. ${ENV_NAME}/bin/activate &&\ | ||
pip install dist/${PKG_NAME}-0.0.0-cp38-cp38-linux_x86_64.whl &&\ | ||
pip install dist/${PKG_NAME}-${PKG_VERSION}-cp${PY_VERSION_STR}-cp${PY_VERSION_STR}-${ARCH_STR}.whl &&\ | ||
cd test &&\ | ||
python -m unittest) | ||
|
||
clean: rmvirtualenv | ||
clean: preload rmvirtualenv | ||
rm -rf dist build src/*.egg-info *.log ~/.pyxbld/ | ||
|
||
update_pkg: | ||
update_pkg: preload | ||
@(. ${ENV_NAME}/bin/activate && pip install -U pip) | ||
@(. ${ENV_NAME}/bin/activate && pip install -U `cat requirements.txt`) |