-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
58 lines (51 loc) · 1.54 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
VENV_NAME = myenv
REQUIREMENTS = requirements.txt
help:
@echo "Usage: make [COMMAND]"
@echo
@echo "Commands:"
@echo " install Installs dependencies"
@echo " setup Sets up a new virtual environment and activates it"
@echo " activate Activates the virtual environment"
@echo " update Updates the virtual environment and requirements"
@echo " add Adds new dependency to requirements.txt"
@echo " clean Cleans the virtual environment"
@echo
@echo "Example usage:"
@echo " make install"
@echo " make setup"
@echo " make activate"
@echo " make update"
@echo " make add requests"
@echo " make clean"
install:
@echo "Installing dependencies..."
python3 -m venv $(VENV_NAME)
source $(VENV_NAME)/bin/activate && pip install -r $(REQUIREMENTS)
@echo "Install complete."
setup:
@echo "Setting up virtual environment..."
python3 -m venv $(VENV_NAME)
source $(VENV_NAME)/bin/activate
@echo "Setup complete."
activate:
@echo "Activating virtual environment..."
source $(VENV_NAME)/bin/activate
@echo "Environment activated."
update:
@echo "Updating virtual environment..."
source $(VENV_NAME)/bin/activate && pip install -r $(REQUIREMENTS)
@echo "Update complete."
add:
ifndef PACKAGE
@echo "Usage: make add PACKAGE=<dependency>"
@exit 1
endif
@echo "Adding dependency $(PACKAGE) to requirements.txt..."
echo $(PACKAGE) >> $(REQUIREMENTS)
@echo "Dependency added."
clean:
@echo "Cleaning virtual environment..."
deactivate || true
rm -rf $(VENV_NAME)
@echo "Clean complete."