-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
73 lines (58 loc) · 2.3 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
.PHONY: help install lint clean docs
SHELL=/bin/bash
# You can specify exact version of python3 or venv name as environment variable
PYTHON_VERSION?=python3.8
VENV_NAME?=venv
VENV_BIN=$(shell pwd)/${VENV_NAME}/bin
VENV_ACTIVATE=source $(VENV_NAME)/bin/activate
PROJECT_DIR=virtual_warehouse
PYTHON=${VENV_NAME}/bin/python3
.DEFAULT: help
help:
@echo "Make file commands:"
@echo " make install"
@echo " Prepare complete development environment"
@echo " make lint"
@echo " Run pylint and mypy"
@echo " make resources"
@echo " Make qrc resources file - main_rc.py"
@echo " make package"
@echo " Create packaged application"
@echo " make run"
@echo " Run application"
@echo " make docs"
@echo " Generate HTML documentation"
@echo " make clean"
@echo " Clean repository"
install:
sudo apt-get -y install build-essential $(PYTHON_VERSION) $(PYTHON_VERSION)-dev
${PYTHON_VERSION} -m pip install pip
${PYTHON_VERSION} -m pip install virtualenv
make venv
${VENV_ACTIVATE}; pre-commit install
# Runs when the file changes
venv: $(VENV_NAME)/bin/activate
$(VENV_NAME)/bin/activate: requirements.txt requirements-dev.txt
test -d $(VENV_NAME) || virtualenv -p $(PYTHON_VERSION) $(VENV_NAME)
${PYTHON} -m pip install -U pip
${PYTHON} -m pip install -r requirements.txt -r requirements-dev.txt
touch $(VENV_NAME)/bin/activate
resources:
${VENV_ACTIVATE}; pyside2-rcc virtual_warehouse/main.qrc -o virtual_warehouse/main_rc.py
lint: venv
${PYTHON} -m pylint virtual_warehouse
${PYTHON} -m flake8 virtual_warehouse
package: resources
${VENV_ACTIVATE}; pyinstaller --name="Virtual Warehouse" --windowed --clean \
--onedir main.py --icon="virtual_warehouse/resources/images/icon.png" \
--add-data $(shell $(PYTHON) -c "import owlready2 as _; print(_.__file__[:-11])")/pellet:owlready2/pellet \
--add-data virtual_warehouse/plugins:virtual_warehouse/plugins
cd dist; tar -zcvf virtual-warehouse.tar.gz "Virtual Warehouse"
# ${VENV_ACTIVATE}; nuitka3 main.py --show-progress --standalone --plugin-enable=pyside2 --include-qt-plugins=all --windows-disable-console
run: resources
${PYTHON} main.py
docs:
${VENV_ACTIVATE}; cd docs; make html
clean:
find . -name '*.pyc' -exec rm --force {} +
rm -rf $(VENV_NAME) *.eggs *.egg-info dist build docs/_build .cache