File: Makefile.virtualenv

package info (click to toggle)
python-rapidjson 1.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,368 kB
  • sloc: cpp: 3,332; python: 1,990; makefile: 106
file content (48 lines) | stat: -rw-r--r-- 1,294 bytes parent folder | download | duplicates (2)
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
# -*- coding: utf-8 -*-
# :Project:   python-rapidjson -- Virtualenv related targets
# :Author:    Lele Gaifax <lele@metapensiero.it>
# :License:   MIT License
# :Copyright: © 2017 Lele Gaifax
#

ACTIVATE_SCRIPT := $(VENVDIR)/bin/activate
PIP := $(VENVDIR)/bin/pip
REQUIREMENTS ?= requirements.txt
REQUIREMENTS_TIMESTAMP := $(VENVDIR)/$(REQUIREMENTS).timestamp

help::
	@printf "\nPython virtualenv related targets\n"
	@printf   "=================================\n\n"

help::
	@printf "virtualenv\n\tsetup the Python virtualenv and install required packages\n"

.PHONY: virtualenv
virtualenv: $(VENVDIR) requirements

$(VENVDIR):
	@echo "Bootstrapping Python 3 virtualenv..."
	@$(SYS_PYTHON) -m venv --prompt $(notdir $(TOPDIR)) $@ 2>/dev/null || $(SYS_PYTHON) -m venv $@
	@$(MAKE) upgrade-pip

help::
	@printf "upgrade-pip\n\tupgrade pip\n"

.PHONY: upgrade-pip
upgrade-pip:
	@echo "Upgrading pip..."
	@$(PIP) install --no-cache-dir --upgrade pip

help::
	@printf "requirements\n\tinstall/update required Python packages\n"

.PHONY: requirements
requirements: $(REQUIREMENTS_TIMESTAMP)

$(REQUIREMENTS_TIMESTAMP): $(REQUIREMENTS)
	@echo "Installing pre-requirements..."
	@PATH=$(TOPDIR)/bin:$(PATH) $(PIP) install --no-cache-dir -r $(REQUIREMENTS)
	@touch $@

distclean::
	rm -rf $(VENVDIR)