Makefile 1.65 KB
Newer Older
1 2
HERE = $(shell pwd)
PYTHON_VER ?= 2.7
3 4
PYTHON_PATH = $(HERE)/pythons/$(PYTHON_VER)
PYTHON_BUILD_DIR = $(HERE)/python_builds
5

Hanno Schlichting's avatar
Hanno Schlichting committed
6
ifeq ($(PYTHON_VER),2.6)
7 8 9 10
	PYTHON_MINOR ?= 2.6.8
endif
ifeq ($(PYTHON_VER),2.7)
	PYTHON_MINOR ?= 2.7.3
11
endif
Hanno Schlichting's avatar
Hanno Schlichting committed
12
ifeq ($(PYTHON_VER),3.2)
13
	PYTHON_MINOR ?= 3.2.3
14
endif
Hanno Schlichting's avatar
Hanno Schlichting committed
15
ifeq ($(PYTHON_VER),3.3)
16 17
	PYTHON_MINOR ?= 3.3.0
endif
18 19 20 21
ifeq ($(PYTHON_VER),3.4)
	PYTHON_MINOR ?= 3.4.2
	PYTHON_CONFIGURE_ARGS ?= --without-ensurepip
endif
22 23 24

ifndef PYTHON_MINOR
    $(error Please specify desired PYTHON_MINOR for Python $(PYTHON_VER))
Hanno Schlichting's avatar
Hanno Schlichting committed
25 26 27
endif

PYTHON_ARCHIVE ?= Python-$(PYTHON_MINOR)
28
PYTHON_DOWNLOAD = https://www.python.org/ftp/python/$(PYTHON_MINOR)/$(PYTHON_ARCHIVE).tgz
Hanno Schlichting's avatar
Hanno Schlichting committed
29
PYTHON_EXE = python$(PYTHON_VER)
30 31

.PHONY: all build test
Hanno Schlichting's avatar
Hanno Schlichting committed
32
BUILD_DIRS = $(PYTHON_PATH) bin build develop-eggs eggs parts
33 34 35

all: build

36
$(PYTHON_PATH)/bin/$(PYTHON_EXE):
37 38
	@echo "Installing Python"
	mkdir -p $(PYTHON_PATH)
39 40
	mkdir -p $(PYTHON_BUILD_DIR)
	cd $(PYTHON_BUILD_DIR) && \
41
	curl --progress-bar --location $(PYTHON_DOWNLOAD) | tar -zx
42
ifeq ($(PYTHON_VER),2.6)
43
	cd $(PYTHON_BUILD_DIR) && \
44
	curl --progress-bar -L https://raw.github.com/collective/buildout.python/ad45adb78bfa37542d62a394392d5146fce5af34/src/issue12012-sslv2-py26.patch > ssl.patch
45
	cd $(PYTHON_BUILD_DIR)/$(PYTHON_ARCHIVE) && \
Marius Gedminas's avatar
Marius Gedminas committed
46
	patch -p0 < ../ssl.patch
47
endif
48
	cd $(PYTHON_BUILD_DIR)/$(PYTHON_ARCHIVE) && \
49
	./configure --prefix $(PYTHON_PATH) $(PYTHON_CONFIGURE_ARGS) >/dev/null 2>&1 && \
50 51
	make >/dev/null 2>&1 && \
	make install >/dev/null 2>&1
52 53
	@echo "Finished installing Python"

54
build: $(PYTHON_PATH)/bin/$(PYTHON_EXE)
Hanno Schlichting's avatar
Hanno Schlichting committed
55
	$(PYTHON_PATH)/bin/$(PYTHON_EXE) dev.py
56

Hanno Schlichting's avatar
Hanno Schlichting committed
57
clean:
58
	rm -rf $(BUILD_DIRS) $(PYTHON_BUILD_DIR)
Hanno Schlichting's avatar
Hanno Schlichting committed
59

60
test:
61
	$(HERE)/bin/test -1 -v