8000 Add Makefile to setup venv and run the project by kakra · Pull Request #23 · cakama3a/Polling · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add Makefile to setup venv and run the project #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
VENV_NAME ?= venv
APP ?= Polling.py

PYTHON := $(VENV_NAME)/bin/python3
PIP := $(VENV_NAME)/bin/pip
ACTIVATE := $(VENV_NAME)/bin/activate

.PHONY: install update clean run

virtual: $(PIP) $(ACTIVATE)

requirements: requirements.txt $(PIP)
$(PIP) --require-virtualenv install -Ur $<

install: install.py $(ACTIVATE) | requirements
( source $(ACTIVATE); $(PYTHON) install.py; )

update: update.py $(ACTIVATE) | requirements
( source $(ACTIVATE); $(PYTHON) update.py; )

run: $(APP) $(ACTIVATE) | requirements
( source $(ACTIVATE); $(PYTHON) $(APP); )

clean:
rm -Rf $(VENV_NAME)

$(VENV_NAME):
virtualenv -p /usr/bin/python3 $(VENV_NAME)

$(PIP) $(ACTIVATE): $(VENV_NAME)
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,12 @@ source env/bin/activate
pip install -r requirements.txt
python Polling.py
```

On Linux, you can also use `make` to install/update the requirement and run the project:
```bash
# install or update requirements only:
make requirements

# installs or updates the requirements and runs the project:
make run
```
0