-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild_python
executable file
·68 lines (61 loc) · 1.74 KB
/
build_python
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
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# TEST_VERSIONS: 2.7.12 3.5.2
### Description
# This script uses fpm to build and package Python.
# In order to not interfere with the system version of Python, I
# opted to call this package 'python-local'. Dependencies for
# python-local are based on the packages used to build python-local
# and the existing Debian Python dependency tree.
# Required Environment Variables:
# - BUILD_VERSION
# - BUILD_ITERATION
# - BUILD_OUTPUT_DIR
# Example Usage:
# The following command will create /tmp/python-local-3.5.2-1.deb
# $ BUILD_VERSION=3.5.2 BUILD_ITERATION=1 BUILD_OUTPUT_DIR=/tmp build_python
# Install dependencies
apt-get update
apt-get install -y \
build-essential \
libbz2-dev \
libdb-dev \
libexpat1-dev \
libffi-dev \
libgdbm-dev \
liblzma-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
python-dev \
tk-dev \
wget \
zlib1g-dev
# Build Python
cd /tmp
wget https://www.python.org/ftp/python/${BUILD_VERSION}/Python-${BUILD_VERSION}.tgz
tar xfv Python-${BUILD_VERSION}.tgz
cd Python-${BUILD_VERSION}
./configure --prefix=/usr/local; make
mkdir /tmp/python_build
make install DESTDIR=/tmp/python_build
# Create .deb package
fpm -s dir -t deb \
-C /tmp/python_build/ \
--name python-local \
--version ${BUILD_VERSION} \
--iteration ${BUILD_ITERATION} \
--package ${BUILD_OUTPUT_DIR}/python-local-VERSION-ITERATION.deb \
--description "Install Python ${BUILD_VERSION} to /usr/local/" \
--depends libbz2-1.0 \
--depends libc6 \
--depends libdb5.3 \
--depends libexpat1 \
--depends libffi6 \
--depends libncursesw5 \
--depends libreadline6 \
--depends libsqlite3-0 \
--depends libssl1.0.0 \
--depends libtinfo5 \
--depends mime-support \
--depends zlib1g