-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
100 lines (81 loc) · 2.73 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Makefile for the 'i3menu' package.
#
# Author: Giacomo Spettoli <[email protected]>
# Last Change: Feb 27, 2016
.DEFAULT_GOAL = help
.PHONY: help install uninstall python sdist sdist_upload codecheck clean publish tests
PYTHON:=$(shell which python 2>/dev/null)
PIP:=$(shell which pip 2>/dev/null)
FLAKE8=$(shell which flake8 2>/dev/null)
WHEEL=$(shell $(PYTHON) -c "import wheel")
VIRTUALENV_DIR := $(CURDIR)/venv
ifndef PYTHON
$(error "python is not available. For debian like systems you can run: sudo apt-get install python")
endif
ifndef PIP
$(error "pip is not available. For debian like systems you can run: sudo apt-get install python-pip")
endif
CHECK_MENU_PROVIDERS = $(if $(shell which 'rofi'),'rofi found',\
$(if $(shell which 'dmenu'),'dmenu found',\
$(error "No menu provider found. At least one between 'rofi' and 'dmenu' is required")))
help:
@echo "Makefile for the 'i3menu' package"
@echo
@echo 'Commands:'
@echo
@echo ' make install install the package using pip'
@echo ' make uninstall uninstall the package using pip'
@echo ' make clean cleanup all temporary files'
@echo ' make codecheck check the coding style'
@echo ' make push push changes to GitHub'
@echo ' make sdist build the tarball of package to be published'
@echo ' make sdist_upload upload the tarball of package to pypi'
@echo
@echo 'Variables:'
@echo
@echo " PYTHON = $(PYTHON)"
@echo " PIP = $(PIP)"
venv: ${VIRTUALENV_DIR}/bin/activate
${VIRTUALENV_DIR}/bin/activate:
test -d ${VIRTUALENV_DIR} || virtualenv ${VIRTUALENV_DIR}
${VIRTUALENV_DIR}/bin/pip install pdbpp
touch ${VIRTUALENV_DIR}/bin/activate
tests: venv
${VIRTUALENV_DIR}/bin/pip install tox
${VIRTUALENV_DIR}/bin/tox -v
develop: venv
${VIRTUALENV_DIR}/bin/python setup.py develop
python:
$(PYTHON) setup.py build
install:
$(PIP) install .
uninstall:
$(PIP) uninstall i3menu
sdist: clean
$(PYTHON) setup.py sdist
sdist_upload: clean
$(PYTHON) setup.py sdist upload 2>&1 |tee upload.log
bdist_wheel: clean
test -x "$(WHEEL)" || $(PIP) install wheel
$(PYTHON) setup.py bdist_wheel --universal
bdist_wheel_upload: clean
test -x "$(WHEEL)" || $(PIP) install wheel
$(PYTHON) setup.py bdist_wheel --universal upload 2>&1 | tee upload.log
codecheck:
test -x "$(FLAKE8)" || $(PIP) install flake8
flake8
clean:
@echo "Cleaning up distutils stuff"
rm -rf build
rm -rf dist
# rm -rf ${VIRTUALENV_DIR}
rm -rf lib/i3menu.egg-info/
rm -rf .tox
rm -rf .coverage
rm -rf .cache
@echo "Cleaning up byte compiled python stuff"
find . -type f -regex ".*\.py[co]$$" -delete
find . -type f -name '*.pyc' -delete
find . -name "__pycache__" -delete
push: clean
git push origin && git push --tags origin