Skip to content

Instantly share code, notes, and snippets.

@dropwhile
Last active June 3, 2019 13:51
Show Gist options
  • Select an option

  • Save dropwhile/7744519 to your computer and use it in GitHub Desktop.

Select an option

Save dropwhile/7744519 to your computer and use it in GitHub Desktop.

Revisions

  1. @cactus cactus revised this gist Jun 30, 2018. 2 changed files with 6 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions py27.txt
    Original file line number Diff line number Diff line change
    @@ -97,6 +97,9 @@ fpm -s dir -t rpm -n python${PY_SHORT} -v ${BUILD_VER} -C ${INSTALL_DIR} \
    --directories=/usr/local/include/python${PY_BUILD_VER}/ \
    usr/local

    # move rpm to download dir
    mv python${PY_SHORT}*.rpm ../

    # note: after install, you may need to do the following, depending no use of --enable-shared in the configure step:
    # echo '/usr/local/lib' > /etc/ld.so.conf.d/usr-local.conf
    # ldconfig -v
    3 changes: 3 additions & 0 deletions py3x.txt
    Original file line number Diff line number Diff line change
    @@ -100,6 +100,9 @@ fpm -s dir -t rpm -n python${PY_SHORT} -v ${BUILD_VER} -C ${INSTALL_DIR} \
    --directories=/usr/local/lib/python${PY_BUILD_VER}/ \
    --directories=/usr/local/include/python${PY_BUILD_VER}m/ \
    usr/local

    # move rpm to download dir
    mv python${PY_SHORT}*.rpm ../

    # note: after install, you may need to do the following, depending no use of --enable-shared in the configure step:
    # echo '/usr/local/lib' > /etc/ld.so.conf.d/usr-local.conf
  2. @cactus cactus revised this gist Jun 30, 2018. 2 changed files with 41 additions and 9 deletions.
    26 changes: 21 additions & 5 deletions py27.txt
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,32 @@
    ##### Configurable options

    BUILD_VER=2.7.14
    # strip symbols to slightly reduce runtime memory footprint
    STRIP="yes"
    # use altinstall to NOT symlink python and python2 to the python2.7 executable
    ALTINSTALL="yes"
    # build as user, requires configured sudo (for yum and fpm gem install).
    # if not "yes", then build should be done as root
    USE_SUDO="yes"

    ##### Build section

    PY_BUILD_VER="${BUILD_VER%.*}"
    PY_SHORT="${PY_BUILD_VER//.}"


    INSTALL_DIR=/tmp/pybuild2x/installdir
    BUILD_DIR=/tmp/pybuild2x/download

    if [ "$USE_SUDO" = "yes" ]; then
    CMD_SUDO="sudo"
    else
    if [ "$(id -u)" -ne 0 ] || [ "$(whoami)" != root ]; then
    printf "%s\n" "USE_SUDO != 'yes', so must be run as root. aborting."
    exit 1
    fi
    CMD_SUDO=""
    fi

    mkdir -p "${INSTALL_DIR}" "${BUILD_DIR}"
    cd "${BUILD_DIR}"
    curl -LO http://python.org/ftp/python/${BUILD_VER}/Python-${BUILD_VER}.tgz
    @@ -19,10 +35,10 @@ tar xf Python-${BUILD_VER}.tgz
    cd Python-${BUILD_VER}

    # install compilers, devtools
    yum groupinstall -y "development tools"
    $CMD_SUDO yum groupinstall -y "development tools"

    # install build deps
    yum -y install \
    $CMD_SUDO yum -y install \
    bzip2-devel \
    db4-devel \
    expat-devel \
    @@ -36,8 +52,8 @@ yum -y install \
    zlib-devel

    # install fpm
    yum install ruby ruby-devel rubygems
    gem install fpm
    $CMD_SUDO yum install ruby ruby-devel rubygems
    $CMD_SUDO gem install fpm

    # note: if you want multiple minor version of python on the system, eg system python is 2.7.5 and you want 2.7.13,
    # then remove --enable-shared from the configure line below.
    24 changes: 20 additions & 4 deletions py3x.txt
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,31 @@
    ##### Configurable options

    BUILD_VER=3.7.0
    # strip symbols to slightly reduce runtime memory footprint
    STRIP="yes"
    # use altinstall to NOT symlink python3 to the python3.x executable (note: does not symlink python->python3.x either way)
    ALTINSTALL="no"
    # build as user, requires sudo (for yum and fpm gem install)
    USE_SUDO="yes"

    ##### Build section

    PY_BUILD_VER="${BUILD_VER%.*}"
    PY_SHORT="${PY_BUILD_VER//.}"

    INSTALL_DIR=/tmp/pybuild/installdir
    BUILD_DIR=/tmp/pybuild/download

    if [ "$USE_SUDO" = "yes" ]; then
    CMD_SUDO="sudo"
    else
    if [ "$(id -u)" -ne 0 ] || [ "$(whoami)" != root ]; then
    printf "%s\n" "USE_SUDO != 'yes', so must be run as root. aborting."
    exit 1
    fi
    CMD_SUDO=""
    fi

    mkdir -p "${INSTALL_DIR}" "${BUILD_DIR}"
    cd "${BUILD_DIR}"
    curl -LO http://python.org/ftp/python/${BUILD_VER}/Python-${BUILD_VER}.tgz
    @@ -18,10 +34,10 @@ tar xf Python-${BUILD_VER}.tgz
    cd Python-${BUILD_VER}

    # install compilers, devtools
    yum groupinstall -y "development tools"
    $CMD_SUDO yum groupinstall -y "development tools"

    # install build deps
    yum -y install \
    $CMD_SUDO yum -y install \
    bzip2-devel \
    db4-devel \
    expat-devel \
    @@ -35,8 +51,8 @@ yum -y install \
    zlib-devel

    # install fpm
    yum install ruby ruby-devel rubygems
    gem install fpm
    $CMD_SUDO yum install ruby ruby-devel rubygems
    $CMD_SUDO gem install fpm

    # note: if you want multiple minor version of python on the system, eg system
    # python is 2.7.5 and you want 2.7.13, then remove --enable-shared from the
  3. @cactus cactus revised this gist Jun 30, 2018. No changes.
  4. @cactus cactus revised this gist Jun 30, 2018. 2 changed files with 45 additions and 21 deletions.
    25 changes: 18 additions & 7 deletions py27.txt
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,12 @@ ALTINSTALL="yes"
    PY_BUILD_VER="${BUILD_VER%.*}"
    PY_SHORT="${PY_BUILD_VER//.}"

    mkdir download /tmp/installdir; cd download;

    INSTALL_DIR=/tmp/pybuild2x/installdir
    BUILD_DIR=/tmp/pybuild2x/download

    mkdir -p "${INSTALL_DIR}" "${BUILD_DIR}"
    cd "${BUILD_DIR}"
    curl -LO http://python.org/ftp/python/${BUILD_VER}/Python-${BUILD_VER}.tgz

    tar xf Python-${BUILD_VER}.tgz
    @@ -22,13 +27,18 @@ yum -y install \
    db4-devel \
    expat-devel \
    gdbm-devel \
    libffi-devel \
    ncurses-devel \
    openssl-devel \
    readline-devel \
    sqlite-devel \
    xz-devel \
    zlib-devel

    # install fpm
    yum install ruby ruby-devel rubygems
    gem install fpm

    # note: if you want multiple minor version of python on the system, eg system python is 2.7.5 and you want 2.7.13,
    # then remove --enable-shared from the configure line below.
    # this will remove the ability to load python as a shared library (include python in other apps), but also avoides python
    @@ -40,26 +50,27 @@ yum -y install \
    make -j2

    if [ "$ALTINSTALL" = "yes" ]; then
    make altinstall DESTDIR=/tmp/installdir
    make altinstall DESTDIR="${INSTALL_DIR}"
    else
    make install DESTDIR=/tmp/installdir
    make install DESTDIR="${INSTALL_DIR}"
    fi

    if [ "$STRIP" = "yes" ]; then
    for f in /tmp/installdir/usr/local/lib/libpython*; do
    [ ! -L "$f" ] && chmod 755 "$f" && strip "$f"
    done
    strip /tmp/installdir/usr/local/bin/python${PY_BUILD_VER}
    strip /tmp/installdir/usr/local/bin/python${PY_BUILD_VER}m
    strip ${INSTALL_DIR}/usr/local/bin/python${PY_BUILD_VER}
    strip ${INSTALL_DIR}/usr/local/bin/python${PY_BUILD_VER}m
    fi

    echo '/sbin/ldconfig' > /tmp/installdir/run-ldconfig.sh
    fpm -s dir -t rpm -n python${PY_SHORT} -v ${BUILD_VER} -C /tmp/installdir \
    echo '/sbin/ldconfig' > ${INSTALL_DIR}/run-ldconfig.sh
    fpm -s dir -t rpm -n python${PY_SHORT} -v ${BUILD_VER} -C ${INSTALL_DIR} \
    --after-install /tmp/installdir/run-ldconfig.sh \
    -d 'bzip2' \
    -d 'db4' \
    -d 'expat' \
    -d 'gdbm' \
    -d 'libffi' \
    -d 'ncurses' \
    -d 'openssl' \
    -d 'readline' \
    41 changes: 27 additions & 14 deletions py3x.txt
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    BUILD_VER=3.6.4
    BUILD_VER=3.7.0
    # strip symbols to slightly reduce runtime memory footprint
    STRIP="yes"
    # use altinstall to NOT symlink python3 to the python3.x executable (note: does not symlink python->python3.x either way)
    @@ -7,7 +7,11 @@ ALTINSTALL="no"
    PY_BUILD_VER="${BUILD_VER%.*}"
    PY_SHORT="${PY_BUILD_VER//.}"

    mkdir download /tmp/installdir; cd download;
    INSTALL_DIR=/tmp/pybuild/installdir
    BUILD_DIR=/tmp/pybuild/download

    mkdir -p "${INSTALL_DIR}" "${BUILD_DIR}"
    cd "${BUILD_DIR}"
    curl -LO http://python.org/ftp/python/${BUILD_VER}/Python-${BUILD_VER}.tgz

    tar xf Python-${BUILD_VER}.tgz
    @@ -22,46 +26,55 @@ yum -y install \
    db4-devel \
    expat-devel \
    gdbm-devel \
    libffi-devel \
    ncurses-devel \
    openssl-devel \
    readline-devel \
    sqlite-devel \
    xz-devel \
    zlib-devel

    # note: if you want multiple minor version of python on the system, eg system python is 2.7.5 and you want 2.7.13,
    # then remove --enable-shared from the configure line below.
    # this will remove the ability to load python as a shared library (include python in other apps), but also avoides python
    # loading the wrong minor library version depending on your libary path (and avoids messing with the system python)
    # install fpm
    yum install ruby ruby-devel rubygems
    gem install fpm

    # note: if you want multiple minor version of python on the system, eg system
    # python is 2.7.5 and you want 2.7.13, then remove --enable-shared from the
    # configure line below.
    # this will remove the ability to load python as a shared library (include
    # python in other apps), but also avoides python # loading the wrong minor
    # library version depending on your libary path (and avoids messing with the
    # system python)
    ./configure --prefix=/usr/local --enable-optimizations --enable-ipv6 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
    # ./configure --prefix=/usr/local --enable-optimizations --enable-ipv6 LDFLAGS="-Wl,-rpath /usr/local/lib"

    # build
    make -j2

    if [ "$ALTINSTALL" = "yes" ]; then
    make altinstall DESTDIR=/tmp/installdir
    make altinstall DESTDIR="${INSTALL_DIR}"
    else
    make install DESTDIR=/tmp/installdir
    make install DESTDIR="${INSTALL_DIR}"
    fi

    if [ "$STRIP" = "yes" ]; then
    for f in /tmp/installdir/usr/local/lib/libpython*; do
    for f in ${INSTALL_DIR}/usr/local/lib/libpython*; do
    [ ! -L "$f" ] && chmod 755 "$f" && strip "$f"
    done
    strip /tmp/installdir/usr/local/bin/python${PY_BUILD_VER}
    strip /tmp/installdir/usr/local/bin/python${PY_BUILD_VER}m
    strip ${INSTALL_DIR}/usr/local/bin/python${PY_BUILD_VER}
    strip ${INSTALL_DIR}/usr/local/bin/python${PY_BUILD_VER}m
    fi

    echo '/sbin/ldconfig' > /tmp/installdir/run-ldconfig.sh
    fpm -s dir -t rpm -n python${PY_SHORT} -v ${BUILD_VER} -C /tmp/installdir \
    --after-install /tmp/installdir/run-ldconfig.sh \
    echo '/sbin/ldconfig' > ${INSTALL_DIR}/run-ldconfig.sh
    fpm -s dir -t rpm -n python${PY_SHORT} -v ${BUILD_VER} -C ${INSTALL_DIR} \
    --after-install ${INSTALL_DIR}/run-ldconfig.sh \
    --provides "python(abi) = ${PY_SHORT}" \
    --provides "python${PY_SHORT} = ${BUILD_VER}" \
    -d 'bzip2' \
    -d 'db4' \
    -d 'expat' \
    -d 'gdbm' \
    -d 'libffi' \
    -d 'ncurses' \
    -d 'openssl' \
    -d 'readline' \
  5. @cactus cactus revised this gist Dec 29, 2017. 2 changed files with 5 additions and 5 deletions.
    2 changes: 1 addition & 1 deletion py27.txt
    Original file line number Diff line number Diff line change
    @@ -47,7 +47,7 @@ fi

    if [ "$STRIP" = "yes" ]; then
    for f in /tmp/installdir/usr/local/lib/libpython*; do
    [ ! -L "$f" ] && strip "$f"
    [ ! -L "$f" ] && chmod 755 "$f" && strip "$f"
    done
    strip /tmp/installdir/usr/local/bin/python${PY_BUILD_VER}
    strip /tmp/installdir/usr/local/bin/python${PY_BUILD_VER}m
    8 changes: 4 additions & 4 deletions py3x.txt
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    BUILD_VER=3.6.3
    BUILD_VER=3.6.4
    # strip symbols to slightly reduce runtime memory footprint
    STRIP="yes"
    # use altinstall to NOT symlink python3 to the python3.x executable (note: does not symlink python->python3.x either way)
    @@ -33,8 +33,8 @@ yum -y install \
    # then remove --enable-shared from the configure line below.
    # this will remove the ability to load python as a shared library (include python in other apps), but also avoides python
    # loading the wrong minor library version depending on your libary path (and avoids messing with the system python)
    # ./configure --prefix=/usr/local --enable-optimizations --enable-ipv6 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
    ./configure --prefix=/usr/local --enable-optimizations --enable-ipv6 LDFLAGS="-Wl,-rpath /usr/local/lib"
    ./configure --prefix=/usr/local --enable-optimizations --enable-ipv6 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
    # ./configure --prefix=/usr/local --enable-optimizations --enable-ipv6 LDFLAGS="-Wl,-rpath /usr/local/lib"

    # build
    make -j2
    @@ -47,7 +47,7 @@ fi

    if [ "$STRIP" = "yes" ]; then
    for f in /tmp/installdir/usr/local/lib/libpython*; do
    [ ! -L "$f" ] && strip "$f"
    [ ! -L "$f" ] && chmod 755 "$f" && strip "$f"
    done
    strip /tmp/installdir/usr/local/bin/python${PY_BUILD_VER}
    strip /tmp/installdir/usr/local/bin/python${PY_BUILD_VER}m
  6. @cactus cactus revised this gist Oct 26, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions py3x.txt
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    BUILD_VER=3.6.3
    # strip symbols to slightly reduce runtime memory footprint
    STRIP="yes"
    # use altinstall to NOT symlink python to the python3 executable
    ALTINSTALL="yes"
    # use altinstall to NOT symlink python3 to the python3.x executable (note: does not symlink python->python3.x either way)
    ALTINSTALL="no"

    PY_BUILD_VER="${BUILD_VER%.*}"
    PY_SHORT="${PY_BUILD_VER//.}"
  7. @cactus cactus revised this gist Oct 26, 2017. 2 changed files with 28 additions and 7 deletions.
    20 changes: 18 additions & 2 deletions py27.txt
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,9 @@
    BUILD_VER=2.7.14
    # strip symbols to slightly reduce runtime memory footprint
    STRIP="yes"
    # use altinstall to NOT symlink python and python2 to the python2.7 executable
    ALTINSTALL="yes"

    PY_BUILD_VER="${BUILD_VER%.*}"
    PY_SHORT="${PY_BUILD_VER//.}"

    @@ -34,8 +39,19 @@ yum -y install \
    # build
    make -j2

    # change make install to make altinstall if you do not want to symlink python and python2 to the python2.7 executable
    make altinstall DESTDIR=/tmp/installdir
    if [ "$ALTINSTALL" = "yes" ]; then
    make altinstall DESTDIR=/tmp/installdir
    else
    make install DESTDIR=/tmp/installdir
    fi

    if [ "$STRIP" = "yes" ]; then
    for f in /tmp/installdir/usr/local/lib/libpython*; do
    [ ! -L "$f" ] && strip "$f"
    done
    strip /tmp/installdir/usr/local/bin/python${PY_BUILD_VER}
    strip /tmp/installdir/usr/local/bin/python${PY_BUILD_VER}m
    fi

    echo '/sbin/ldconfig' > /tmp/installdir/run-ldconfig.sh
    fpm -s dir -t rpm -n python${PY_SHORT} -v ${BUILD_VER} -C /tmp/installdir \
    15 changes: 10 additions & 5 deletions py3x.txt
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,11 @@
    BUILD_VER=3.6.3
    # strip symbols to slightly reduce runtime memory footprint
    STRIP="yes"
    # use altinstall to NOT symlink python to the python3 executable
    ALTINSTALL="yes"

    PY_BUILD_VER="${BUILD_VER%.*}"
    PY_SHORT="${PY_BUILD_VER//.}"
    STRIP="yes"

    mkdir download /tmp/installdir; cd download;
    curl -LO http://python.org/ftp/python/${BUILD_VER}/Python-${BUILD_VER}.tgz
    @@ -35,11 +39,12 @@ yum -y install \
    # build
    make -j2

    # change make install to make altinstall if you do not want to symlink python to the python3.x executable
    # make install DESTDIR=/tmp/installdir
    make altinstall DESTDIR=/tmp/installdir
    if [ "$ALTINSTALL" = "yes" ]; then
    make altinstall DESTDIR=/tmp/installdir
    else
    make install DESTDIR=/tmp/installdir
    fi

    # optinally strip symbols to slightly reduce runtime memory footprint
    if [ "$STRIP" = "yes" ]; then
    for f in /tmp/installdir/usr/local/lib/libpython*; do
    [ ! -L "$f" ] && strip "$f"
  8. @cactus cactus revised this gist Oct 26, 2017. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions py27.txt
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    BUILD_VER=2.7.13
    BUILD_VER=2.7.14
    PY_BUILD_VER="${BUILD_VER%.*}"
    PY_SHORT="${PY_BUILD_VER//.}"

    @@ -28,7 +28,8 @@ yum -y install \
    # then remove --enable-shared from the configure line below.
    # this will remove the ability to load python as a shared library (include python in other apps), but also avoides python
    # loading the wrong minor library version depending on your libary path (and avoids messing with the system python)
    ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-ipv6 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
    # ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-ipv6 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
    ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-ipv6 LDFLAGS="-Wl,-rpath /usr/local/lib"

    # build
    make -j2
  9. @cactus cactus revised this gist Oct 26, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion py3x.txt
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    BUILD_VER=3.6.1
    BUILD_VER=3.6.3
    PY_BUILD_VER="${BUILD_VER%.*}"
    PY_SHORT="${PY_BUILD_VER//.}"
    STRIP="yes"
  10. @cactus cactus revised this gist Oct 26, 2017. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions py3x.txt
    Original file line number Diff line number Diff line change
    @@ -29,13 +29,15 @@ yum -y install \
    # then remove --enable-shared from the configure line below.
    # this will remove the ability to load python as a shared library (include python in other apps), but also avoides python
    # loading the wrong minor library version depending on your libary path (and avoids messing with the system python)
    ./configure --prefix=/usr/local --enable-optimizations --enable-ipv6 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
    # ./configure --prefix=/usr/local --enable-optimizations --enable-ipv6 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
    ./configure --prefix=/usr/local --enable-optimizations --enable-ipv6 LDFLAGS="-Wl,-rpath /usr/local/lib"

    # build
    make -j2

    # change make install to make altinstall if you do not want to symlink python to the python3.x executable
    make install DESTDIR=/tmp/installdir
    # make install DESTDIR=/tmp/installdir
    make altinstall DESTDIR=/tmp/installdir

    # optinally strip symbols to slightly reduce runtime memory footprint
    if [ "$STRIP" = "yes" ]; then
  11. @cactus cactus revised this gist Jul 1, 2017. 1 changed file with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion py3x.txt
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    BUILD_VER=3.6.1
    PY_BUILD_VER="${BUILD_VER%.*}"
    PY_SHORT="${PY_BUILD_VER//.}"
    STRIP="yes"

    mkdir download /tmp/installdir; cd download;
    curl -LO http://python.org/ftp/python/${BUILD_VER}/Python-${BUILD_VER}.tgz
    @@ -36,6 +37,15 @@ make -j2
    # change make install to make altinstall if you do not want to symlink python to the python3.x executable
    make install DESTDIR=/tmp/installdir

    # optinally strip symbols to slightly reduce runtime memory footprint
    if [ "$STRIP" = "yes" ]; then
    for f in /tmp/installdir/usr/local/lib/libpython*; do
    [ ! -L "$f" ] && strip "$f"
    done
    strip /tmp/installdir/usr/local/bin/python${PY_BUILD_VER}
    strip /tmp/installdir/usr/local/bin/python${PY_BUILD_VER}m
    fi

    echo '/sbin/ldconfig' > /tmp/installdir/run-ldconfig.sh
    fpm -s dir -t rpm -n python${PY_SHORT} -v ${BUILD_VER} -C /tmp/installdir \
    --after-install /tmp/installdir/run-ldconfig.sh \
    @@ -54,7 +64,7 @@ fpm -s dir -t rpm -n python${PY_SHORT} -v ${BUILD_VER} -C /tmp/installdir \
    --directories=/usr/local/lib/python${PY_BUILD_VER}/ \
    --directories=/usr/local/include/python${PY_BUILD_VER}m/ \
    usr/local

    # note: after install, you may need to do the following, depending no use of --enable-shared in the configure step:
    # echo '/usr/local/lib' > /etc/ld.so.conf.d/usr-local.conf
    # ldconfig -v
  12. @cactus cactus revised this gist Jul 1, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion py3x.txt
    Original file line number Diff line number Diff line change
    @@ -52,7 +52,7 @@ fpm -s dir -t rpm -n python${PY_SHORT} -v ${BUILD_VER} -C /tmp/installdir \
    -d 'xz' \
    -d 'zlib' \
    --directories=/usr/local/lib/python${PY_BUILD_VER}/ \
    --directories=/usr/local/include/python${PY_BUILD_VER}/ \
    --directories=/usr/local/include/python${PY_BUILD_VER}m/ \
    usr/local

    # note: after install, you may need to do the following, depending no use of --enable-shared in the configure step:
  13. @cactus cactus revised this gist Jul 1, 2017. No changes.
  14. @cactus cactus revised this gist Jul 1, 2017. 2 changed files with 87 additions and 12 deletions.
    39 changes: 27 additions & 12 deletions gistfile1.txt → py27.txt
    Original file line number Diff line number Diff line change
    @@ -1,43 +1,58 @@
    BUILD_VER=2.7.13
    PY_BUILD_VER="${BUILD_VER%.*}"
    PY_SHORT="${PY_BUILD_VER//.}"

    mkdir download /tmp/installdir; cd download;
    curl -LO http://python.org/ftp/python/${BUILD_VER}/Python-${BUILD_VER}.tgz

    tar xf Python-${BUILD_VER}.tgz
    cd Python-${BUILD_VER}

    # install compilers, devtools
    yum groupinstall -y "development tools"

    # install build deps
    yum -y install openssl-devel readline-devel bzip2-devel sqlite-devel zlib-devel ncurses-devel db4-devel expat-devel gdbm-devel
    yum -y install \
    bzip2-devel \
    db4-devel \
    expat-devel \
    gdbm-devel \
    ncurses-devel \
    openssl-devel \
    readline-devel \
    sqlite-devel \
    xz-devel \
    zlib-devel

    # note: if you want multiple minor version of python on the system, eg system python is 2.7.5 and you want 2.7.13,
    # then remove --enable-shared from the configure line below.
    # this will remove the ability to load python as a shared library (include python in other apps), but also avoides python
    # loading the wrong minor library version depending on your libary path (and avoids messing with the system python)
    ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-ipv6 --enable-shared
    ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-ipv6 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"

    # build
    make -j2

    # change make install to make altinstall if you do not want to symlink python and python2 to the python2.7 executable
    make install DESTDIR=/tmp/installdir
    make altinstall DESTDIR=/tmp/installdir

    echo '/sbin/ldconfig' > /tmp/installdir/run-ldconfig.sh
    fpm -s dir -t rpm -n python27 -v ${BUILD_VER} -C /tmp/installdir \
    fpm -s dir -t rpm -n python${PY_SHORT} -v ${BUILD_VER} -C /tmp/installdir \
    --after-install /tmp/installdir/run-ldconfig.sh \
    -d 'openssl' \
    -d 'bzip2' \
    -d 'zlib' \
    -d 'expat' \
    -d 'db4' \
    -d 'sqlite' \
    -d 'expat' \
    -d 'gdbm' \
    -d 'ncurses' \
    -d 'openssl' \
    -d 'readline' \
    -d 'gdbm' \
    --directories=/usr/local/lib/python2.7/ \
    --directories=/usr/local/include/python2.7/ \
    -d 'sqlite' \
    -d 'xz' \
    -d 'zlib' \
    --directories=/usr/local/lib/python${PY_BUILD_VER}/ \
    --directories=/usr/local/include/python${PY_BUILD_VER}/ \
    usr/local


    # note: after install, you may need to do the following, depending no use of --enable-shared in the configure step:
    # echo '/usr/local/lib' > /etc/ld.so.conf.d/usr-local.conf
    # ldconfig -v
    60 changes: 60 additions & 0 deletions py3x.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,60 @@
    BUILD_VER=3.6.1
    PY_BUILD_VER="${BUILD_VER%.*}"
    PY_SHORT="${PY_BUILD_VER//.}"

    mkdir download /tmp/installdir; cd download;
    curl -LO http://python.org/ftp/python/${BUILD_VER}/Python-${BUILD_VER}.tgz

    tar xf Python-${BUILD_VER}.tgz
    cd Python-${BUILD_VER}

    # install compilers, devtools
    yum groupinstall -y "development tools"

    # install build deps
    yum -y install \
    bzip2-devel \
    db4-devel \
    expat-devel \
    gdbm-devel \
    ncurses-devel \
    openssl-devel \
    readline-devel \
    sqlite-devel \
    xz-devel \
    zlib-devel

    # note: if you want multiple minor version of python on the system, eg system python is 2.7.5 and you want 2.7.13,
    # then remove --enable-shared from the configure line below.
    # this will remove the ability to load python as a shared library (include python in other apps), but also avoides python
    # loading the wrong minor library version depending on your libary path (and avoids messing with the system python)
    ./configure --prefix=/usr/local --enable-optimizations --enable-ipv6 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"

    # build
    make -j2

    # change make install to make altinstall if you do not want to symlink python to the python3.x executable
    make install DESTDIR=/tmp/installdir

    echo '/sbin/ldconfig' > /tmp/installdir/run-ldconfig.sh
    fpm -s dir -t rpm -n python${PY_SHORT} -v ${BUILD_VER} -C /tmp/installdir \
    --after-install /tmp/installdir/run-ldconfig.sh \
    --provides "python(abi) = ${PY_SHORT}" \
    --provides "python${PY_SHORT} = ${BUILD_VER}" \
    -d 'bzip2' \
    -d 'db4' \
    -d 'expat' \
    -d 'gdbm' \
    -d 'ncurses' \
    -d 'openssl' \
    -d 'readline' \
    -d 'sqlite' \
    -d 'xz' \
    -d 'zlib' \
    --directories=/usr/local/lib/python${PY_BUILD_VER}/ \
    --directories=/usr/local/include/python${PY_BUILD_VER}/ \
    usr/local

    # note: after install, you may need to do the following, depending no use of --enable-shared in the configure step:
    # echo '/usr/local/lib' > /etc/ld.so.conf.d/usr-local.conf
    # ldconfig -v
  15. @cactus cactus revised this gist Dec 19, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ cd Python-${BUILD_VER}
    # install build deps
    yum -y install openssl-devel readline-devel bzip2-devel sqlite-devel zlib-devel ncurses-devel db4-devel expat-devel gdbm-devel

    # note: if you want multiple minor version of python on the system, eg system python is 2.7.5 and you want 2.7.12,
    # note: if you want multiple minor version of python on the system, eg system python is 2.7.5 and you want 2.7.13,
    # then remove --enable-shared from the configure line below.
    # this will remove the ability to load python as a shared library (include python in other apps), but also avoides python
    # loading the wrong minor library version depending on your libary path (and avoids messing with the system python)
  16. @cactus cactus revised this gist Dec 19, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    BUILD_VER=2.7.12
    BUILD_VER=2.7.13

    mkdir download /tmp/installdir; cd download;
    curl -LO http://python.org/ftp/python/${BUILD_VER}/Python-${BUILD_VER}.tgz
  17. @cactus cactus revised this gist Dec 8, 2016. 1 changed file with 14 additions and 2 deletions.
    16 changes: 14 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -5,10 +5,22 @@ curl -LO http://python.org/ftp/python/${BUILD_VER}/Python-${BUILD_VER}.tgz

    tar xf Python-${BUILD_VER}.tgz
    cd Python-${BUILD_VER}

    # install build deps
    yum -y install openssl-devel readline-devel bzip2-devel sqlite-devel zlib-devel ncurses-devel db4-devel expat-devel gdbm-devel
    ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared --enable-ipv6

    # note: if you want multiple minor version of python on the system, eg system python is 2.7.5 and you want 2.7.12,
    # then remove --enable-shared from the configure line below.
    # this will remove the ability to load python as a shared library (include python in other apps), but also avoides python
    # loading the wrong minor library version depending on your libary path (and avoids messing with the system python)
    ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-ipv6 --enable-shared

    # build
    make -j2

    # change make install to make altinstall if you do not want to symlink python and python2 to the python2.7 executable
    make install DESTDIR=/tmp/installdir

    echo '/sbin/ldconfig' > /tmp/installdir/run-ldconfig.sh
    fpm -s dir -t rpm -n python27 -v ${BUILD_VER} -C /tmp/installdir \
    --after-install /tmp/installdir/run-ldconfig.sh \
    @@ -26,6 +38,6 @@ fpm -s dir -t rpm -n python27 -v ${BUILD_VER} -C /tmp/installdir \
    usr/local


    # note: after install, you may need to do the following:
    # note: after install, you may need to do the following, depending no use of --enable-shared in the configure step:
    # echo '/usr/local/lib' > /etc/ld.so.conf.d/usr-local.conf
    # ldconfig -v
  18. @cactus cactus revised this gist Dec 8, 2016. No changes.
  19. @cactus cactus revised this gist Dec 8, 2016. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,7 @@ BUILD_VER=2.7.12

    mkdir download /tmp/installdir; cd download;
    curl -LO http://python.org/ftp/python/${BUILD_VER}/Python-${BUILD_VER}.tgz

    tar xf Python-${BUILD_VER}.tgz
    cd Python-${BUILD_VER}
    yum -y install openssl-devel readline-devel bzip2-devel sqlite-devel zlib-devel ncurses-devel db4-devel expat-devel gdbm-devel
    @@ -23,3 +24,8 @@ fpm -s dir -t rpm -n python27 -v ${BUILD_VER} -C /tmp/installdir \
    --directories=/usr/local/lib/python2.7/ \
    --directories=/usr/local/include/python2.7/ \
    usr/local


    # note: after install, you may need to do the following:
    # echo '/usr/local/lib' > /etc/ld.so.conf.d/usr-local.conf
    # ldconfig -v
  20. @cactus cactus revised this gist Dec 8, 2016. No changes.
  21. @cactus cactus revised this gist Dec 8, 2016. No changes.
  22. @cactus cactus revised this gist Dec 8, 2016. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ mkdir download /tmp/installdir; cd download;
    curl -LO http://python.org/ftp/python/${BUILD_VER}/Python-${BUILD_VER}.tgz
    tar xf Python-${BUILD_VER}.tgz
    cd Python-${BUILD_VER}
    yum -y install openssl-devel readline-devel bzip2-devel sqlite-devel zlib-devel ncurses-devel db4-devel expat-devel
    yum -y install openssl-devel readline-devel bzip2-devel sqlite-devel zlib-devel ncurses-devel db4-devel expat-devel gdbm-devel
    ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared --enable-ipv6
    make -j2
    make install DESTDIR=/tmp/installdir
    @@ -19,6 +19,7 @@ fpm -s dir -t rpm -n python27 -v ${BUILD_VER} -C /tmp/installdir \
    -d 'sqlite' \
    -d 'ncurses' \
    -d 'readline' \
    -d 'gdbm' \
    --directories=/usr/local/lib/python2.7/ \
    --directories=/usr/local/include/python2.7/ \
    usr/local
  23. @cactus cactus revised this gist Dec 8, 2016. 1 changed file with 6 additions and 4 deletions.
    10 changes: 6 additions & 4 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,15 @@
    BUILD_VER=2.7.12

    mkdir download /tmp/installdir; cd download;
    curl -LO http://python.org/ftp/python/2.7.6/Python-2.7.6.tgz
    tar xf Python-2.7.6.tgz
    cd Python-2.7.6
    curl -LO http://python.org/ftp/python/${BUILD_VER}/Python-${BUILD_VER}.tgz
    tar xf Python-${BUILD_VER}.tgz
    cd Python-${BUILD_VER}
    yum -y install openssl-devel readline-devel bzip2-devel sqlite-devel zlib-devel ncurses-devel db4-devel expat-devel
    ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared --enable-ipv6
    make -j2
    make install DESTDIR=/tmp/installdir
    echo '/sbin/ldconfig' > /tmp/installdir/run-ldconfig.sh
    fpm -s dir -t rpm -n python27 -v 2.7.6 -C /tmp/installdir \
    fpm -s dir -t rpm -n python27 -v ${BUILD_VER} -C /tmp/installdir \
    --after-install /tmp/installdir/run-ldconfig.sh \
    -d 'openssl' \
    -d 'bzip2' \
  24. @cactus cactus created this gist Dec 2, 2013.
    22 changes: 22 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    mkdir download /tmp/installdir; cd download;
    curl -LO http://python.org/ftp/python/2.7.6/Python-2.7.6.tgz
    tar xf Python-2.7.6.tgz
    cd Python-2.7.6
    yum -y install openssl-devel readline-devel bzip2-devel sqlite-devel zlib-devel ncurses-devel db4-devel expat-devel
    ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared --enable-ipv6
    make -j2
    make install DESTDIR=/tmp/installdir
    echo '/sbin/ldconfig' > /tmp/installdir/run-ldconfig.sh
    fpm -s dir -t rpm -n python27 -v 2.7.6 -C /tmp/installdir \
    --after-install /tmp/installdir/run-ldconfig.sh \
    -d 'openssl' \
    -d 'bzip2' \
    -d 'zlib' \
    -d 'expat' \
    -d 'db4' \
    -d 'sqlite' \
    -d 'ncurses' \
    -d 'readline' \
    --directories=/usr/local/lib/python2.7/ \
    --directories=/usr/local/include/python2.7/ \
    usr/local