-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
31 lines (25 loc) · 850 Bytes
/
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
VIRTUAL_ENV = venv
PYTHON = $(VIRTUAL_ENV)/bin/python3
PIP = $(VIRTUAL_ENV)/bin/pip3
NAME = asxlistener
INSTALL_BASE = /usr/local/bin
INSTALL_DIR = $(INSTALL_BASE)/$(NAME)-bin
INSTALL_EXE = $(INSTALL_BASE)/$(NAME)
venv:
virtualenv -p /usr/bin/python3 $(VIRTUAL_ENV);
$(PIP) install -r ./requirements.txt
clear_venv:
rm -rf ./$(VIRTUAL_ENV)
uninstall:
rm -rf $(INSTALL_DIR)
rm -f $(INSTALL_EXE)
install: venv uninstall
# Create folder for dependencies
mkdir $(INSTALL_DIR)
# Move Virtual environment and script
cp -r ./$(VIRTUAL_ENV) $(INSTALL_DIR)/$(VIRTUAL_ENV)
cp ./$(NAME).py $(INSTALL_DIR)/$(NAME).py
# Create executable script for running python script with the virtual environment
echo '#!/bin/bash' >> $(INSTALL_EXE)
echo '$(INSTALL_DIR)/$(PYTHON) $(INSTALL_DIR)/$(NAME).py "$$@"' >> $(INSTALL_EXE)
chmod +x $(INSTALL_EXE)