Skip to content

update sqlite3 in python #18

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

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
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
68 changes: 57 additions & 11 deletions dockerfiles/deps/python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,64 @@ dnf -y install bzip2-devel libffi-devel make git sqlite-devel openssl-devel
dnf -y install python-pip
pip3.9 install --upgrade setuptools pip
dnf -y groupinstall "Development Tools"
curl -O https://www.python.org/ftp/python/3.10.13/Python-3.10.13.tgz
tar -xzf Python-3.10.13.tgz
cd Python-3.10.13/ || exit 1
./configure --enable-optimizations
make altinstall
cd ..
rm -rf Python-3.10.13*
pip3.10 install --upgrade setuptools pip

# Download SQLite source code
cd /tmp
curl -O https://www.sqlite.org/2024/sqlite-autoconf-3450300.tar.gz \
&& tar xvf sqlite-autoconf-3450300.tar.gz \
&& rm sqlite-autoconf-3450300.tar.gz

# Compile and install SQLite
cd /tmp/sqlite-autoconf-3450300
./configure \
&& make \
&& make install \
&& rm -rf /tmp/sqlite-autoconf-3450300

cd ~ # Move to home directory to install Python
ORIGINAL_LD_PATH=$LD_LIBRARY_PATH
export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"

export PYTHON_VERSION=3.10.13
curl -o /tmp/python.tar.xz https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz \
&& tar -xf /tmp/python.tar.xz -C /tmp \
&& rm /tmp/python.tar.xz

# Compile Python with custom SQLite
cd /tmp/Python-$PYTHON_VERSION \
&& ./configure --enable-optimizations \
&& make -j$(nproc) \
&& make altinstall \
&& rm -rf /tmp/Python-$PYTHON_VERSION

cd ~

# Upgrade pip
#python3.10 -m pip install --upgrade pip

# curl -O https://www.python.org/ftp/python/3.10.13/Python-3.10.13.tgz
# tar -xzf Python-3.10.13.tgz
# cd Python-3.10.13/ || exit 1
# ./configure --enable-optimizations
# make altinstall
# cd ..
# rm -rf Python-3.10.13*
# pip3.10 install --upgrade setuptools pip
ln -s /usr/local/bin/python3.10 /usr/local/bin/python3
# (Trevor) Setuptools for 3.9 has vulns, so we need to remove it
rpm --nodeps -e python3-setuptools-53.0.0-12.el9.noarch
rm -rf /usr/local/lib/python3.9/site-packages/setuptools
# # (Trevor) Setuptools for 3.9 has vulns, so we need to remove it
# rpm --nodeps -e python3-setuptools-53.0.0-12.el9.noarch
# rm -rf /usr/local/lib/python3.9/site-packages/setuptools

# Restore LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$ORIGINAL_LD_PATH

dnf -y groupremove "Development Tools"
rm -rf /var/cache/yum/*
dnf clean all

echo "*******************************************"
python3.10 --version
python3.10 -c "import sqlite3; print(sqlite3.sqlite_version)"
python3 --version
python3 -c "import sqlite3; print(sqlite3.sqlite_version)"

Loading