Fix Makefile

make check now uses a venv
make CI uses the environment
Fix rar test
This commit is contained in:
Timmy Welch 2022-04-19 14:45:36 -07:00
parent d78c3e3039
commit 02f365b93f
2 changed files with 33 additions and 15 deletions

View File

@ -2,6 +2,15 @@ PIP ?= pip3
PYTHON ?= python3
VERSION_STR := $(shell $(PYTHON) setup.py --version)
SITE_PACKAGES := $(shell $(PYTHON) -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')
PACKAGE_PATH = $(SITE_PACKAGES)/comictagger-$(VERSION_STR).dist-info
VENV := $(shell echo $${VIRTUAL_ENV-venv})
PY3 := $(shell command -v python3 2> /dev/null)
PYTHON_VENV := $(VENV)/bin/python
INSTALL_STAMP := $(VENV)/.install.stamp
ifeq ($(OS),Windows_NT)
OS_VERSION=win-$(PROCESSOR_ARCHITECTURE)
APP_NAME=comictagger.exe
@ -15,33 +24,33 @@ else
FINAL_NAME=ComicTagger-$(VERSION_STR)
endif
.PHONY: all clean pydist upload dist CI
.PHONY: all clean pydist upload dist CI check
all: clean dist
$(PYTHON_VENV):
@if [ -z $(PY3) ]; then echo "Python 3 could not be found."; exit 2; fi
$(PY3) -m venv $(VENV)
clean:
rm -rf *~ *.pyc *.pyo
rm -rf scripts/*.pyc
cd comictaggerlib; rm -f *~ *.pyc *.pyo
find . -type d -name "__pycache__" | xargs rm -rf {};
rm -rf $(INSTALL_STAMP)
rm -rf dist MANIFEST
rm -rf *.deb
rm -rf logdict*.log
$(MAKE) -C mac clean
rm -rf build
rm -rf comictaggerlib/ui/__pycache__
rm comictaggerlib/ctversion.py
CI:
CI: ins
black .
isort .
flake8 .
pytest
check:
black --check .
isort --check .
flake8 .
pytest
check: install
$(VENV)/bin/black --check .
$(VENV)/bin/isort --check .
$(VENV)/bin/flake8 .
$(VENV)/bin/pytest
pydist: CI
make clean
@ -55,7 +64,16 @@ upload:
$(PYTHON) setup.py register
$(PYTHON) setup.py sdist --formats=gztar upload
install: $(INSTALL_STAMP)
$(INSTALL_STAMP): $(PYTHON_VENV) requirements.txt requirements_dev.txt
$(PYTHON_VENV) -m pip install -r requirements_dev.txt
$(PYTHON_VENV) -m pip install -e .
touch $(INSTALL_STAMP)
ins: $(PACKAGE_PATH)
$(PACKAGE_PATH):
$(PIP) -m pip install .
dist: CI
$(PIP) install .
pyinstaller -y comictagger.spec
cd dist && zip -r $(FINAL_NAME).zip $(APP_NAME)

View File

@ -9,7 +9,7 @@ from comicapi.genericmetadata import GenericMetadata, PageType, md_test
thisdir = dirname(abspath(__file__))
@pytest.mark.xfail(rar_support, reason="rar support")
@pytest.mark.xfail(not rar_support, reason="rar support")
def test_getPageNameList():
ComicArchive.logo_data = b""
c = ComicArchive(join(thisdir, "data", "fake_cbr.cbr"))