2019-11-02 16:56:03 -04:00
|
|
|
# A quick installation script for painless discord bots.
|
|
|
|
# v1.1.0
|
2019-10-05 01:28:52 -04:00
|
|
|
# Copyright (c) 2019 0x5c
|
|
|
|
# Released under the terms of the MIT license.
|
2019-11-02 16:56:03 -04:00
|
|
|
# Part of:
|
|
|
|
# https://github.com/0x5c/quick-bot-no-pain
|
2019-10-05 01:28:52 -04:00
|
|
|
|
|
|
|
|
2019-10-03 22:17:36 -04:00
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
|
2019-11-02 16:56:03 -04:00
|
|
|
### Variables ###
|
2019-10-03 22:17:36 -04:00
|
|
|
# Those are the defaults; they can be over-ridden if specified
|
|
|
|
# at en environment level or as 'make' arguments.
|
|
|
|
BOTENV ?= botenv
|
2019-11-02 16:56:03 -04:00
|
|
|
PYTHON_BIN ?= python3.7
|
|
|
|
PIP_OUTPUT ?= -q
|
2019-10-03 22:17:36 -04:00
|
|
|
|
|
|
|
|
2019-11-02 16:56:03 -04:00
|
|
|
### Support targets ###
|
2019-10-03 22:17:36 -04:00
|
|
|
|
2019-11-02 16:56:03 -04:00
|
|
|
.PHONY: help
|
2019-10-03 22:17:36 -04:00
|
|
|
help:
|
|
|
|
@echo ""
|
|
|
|
@echo "\033[97m>>>>>> Default dummy target <<<<<<"
|
|
|
|
@echo "\033[37mYou might want to specify a target:"
|
|
|
|
@echo "\033[32m --> make install"
|
|
|
|
@echo "\033[94m --> make clean"
|
|
|
|
@echo "\033[0m"
|
|
|
|
|
|
|
|
|
2019-11-02 16:56:03 -04:00
|
|
|
### Actual install/setup targets ###
|
2019-10-03 22:17:36 -04:00
|
|
|
|
|
|
|
# Main install target
|
2019-11-02 16:56:03 -04:00
|
|
|
.PHONY: install
|
2019-10-03 22:17:36 -04:00
|
|
|
install: $(BOTENV)/req_done options.py keys.py
|
|
|
|
|
|
|
|
# Virual environment setup
|
|
|
|
$(BOTENV)/success:
|
|
|
|
ifneq ("$(wildcard ./$(BOTENV).)",)
|
|
|
|
@echo "\033[94m--> Creating the virtual environment...\033[0m"
|
2019-11-02 16:56:03 -04:00
|
|
|
@$(PYTHON_BIN) -m venv $(BOTENV)
|
2019-10-03 22:17:36 -04:00
|
|
|
@touch $(BOTENV)/success
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Installing requirements
|
|
|
|
$(BOTENV)/req_done: requirements.txt $(BOTENV)/success
|
|
|
|
@echo "\033[34;1m--> Installing the dependencies...\033[0m"
|
|
|
|
@. $(BOTENV)/bin/activate; \
|
2019-11-02 16:56:03 -04:00
|
|
|
pip install ${PIP_OUTPUT} -U pip setuptools wheel; \
|
|
|
|
pip install ${PIP_OUTPUT} -U -r requirements.txt
|
2019-10-03 22:17:36 -04:00
|
|
|
@touch $(BOTENV)/req_done
|
2019-11-04 09:51:17 -05:00
|
|
|
|
|
|
|
data:
|
|
|
|
mkdir data
|
2019-10-03 22:17:36 -04:00
|
|
|
|
|
|
|
# Copying templates
|
2019-11-04 09:51:07 -05:00
|
|
|
options.py keys.py: | data
|
2019-10-03 22:17:36 -04:00
|
|
|
@echo "\033[34;1m--> Copying template files...\033[0m"
|
2019-11-02 16:56:03 -04:00
|
|
|
@cp -nv ./templates/template_$@ ./data/$@
|
|
|
|
@touch ./data/$@
|
2019-10-03 22:17:36 -04:00
|
|
|
|
|
|
|
# Deletes the python cache and the virtual environment
|
2019-11-02 16:56:03 -04:00
|
|
|
.PHONY: clean
|
2019-10-03 22:17:36 -04:00
|
|
|
clean:
|
|
|
|
@echo "\033[34;1m--> Removing python cache files...\033[0m"
|
|
|
|
rm -rf __pycache__
|
|
|
|
@echo "\033[34;1m--> Removing the virtual environment...\033[0m"
|
|
|
|
rm -rf $(BOTENV)
|
|
|
|
|
|
|
|
|
2019-11-02 16:56:03 -04:00
|
|
|
### Dev targets ###
|
2019-10-03 22:17:36 -04:00
|
|
|
|
|
|
|
|
2019-11-02 16:56:03 -04:00
|
|
|
### Special targets ###
|
|
|
|
.PHONY: onlyenv
|
2019-10-03 22:17:36 -04:00
|
|
|
onlyenv: $(BOTENV)/success
|