Skip to content

Commit 8b9424e

Browse files
Merge pull request #136 from sergey-dryabzhinsky/master
Update branch from master
2 parents 74897ea + 4075043 commit 8b9424e

File tree

2 files changed

+238
-0
lines changed

2 files changed

+238
-0
lines changed

Build_wheels_for_cpython39_x86.yml

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
name: Build wheels for CPython3.9 x86
2+
3+
on: [push, pull_request]
4+
5+
concurrency:
6+
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.sha || '' }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
build_wheels:
11+
name: Build wheel - ${{ matrix.os.name }}
12+
runs-on: ${{ matrix.os.runs-on }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os:
17+
- name: Ubuntu 24+16 i386 CPython 3.9
18+
runs-on: ubuntu-latest
19+
matrix: linux
20+
arch: i386
21+
tag_arch: i686
22+
release: xenial
23+
mirror: http://azure.archive.ubuntu.com/ubuntu
24+
version: 1.5.6.3
25+
pyver: "3.9"
26+
getpipurl: https://bootstrap.pypa.io/pip/get-pip.py
27+
pypkg: python3.9
28+
pypkgadd: python3.9-distutils
29+
pyengine_tag: cp39-cp39
30+
libc_tag: manylinux_2_17
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
with:
35+
submodules: 'recursive'
36+
37+
- name: Update and upgrade Ubuntu 24
38+
if: matrix.os.matrix == 'linux'
39+
run: |
40+
sudo which apt
41+
sudo apt update;
42+
sudo apt purge -y firefox lxd snapd;
43+
sudo apt install -y zram-config;
44+
sudo apt list --upgradable;
45+
sudo apt upgrade -y;
46+
sudo apt install -f
47+
48+
- name: Build source distribution with Ubuntu
49+
if: matrix.os.matrix == 'linux'
50+
run: |
51+
sudo apt install -y devscripts debootstrap qemu-user;
52+
pip install build;
53+
python -m build --sdist --outdir dist .
54+
55+
- name: Debootstrap Ubuntu ${{matrix.os.release}} ${{matrix.os.arch}}
56+
if: matrix.os.matrix == 'linux'
57+
run: |
58+
sudo debootstrap --no-merged-usr --verbose --include=sudo,wget,curl,ca-certificates --arch=${{matrix.os.arch}} ${{matrix.os.release}} ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} ${{matrix.os.mirror}} || tail ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/debootstrap/debootstrap.log
59+
60+
- name: Update and Upgrade Ubuntu ${{matrix.os.release}}
61+
if: matrix.os.matrix == 'linux'
62+
run: |
63+
sudo mkdir -p ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/build_wheel
64+
sudo mount none ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/proc -t proc
65+
sudo mount none ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/dev/pts -t devpts
66+
sudo mount none ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/sys -t sysfs
67+
echo " deb [trusted=yes] http://packages.rusoft.ru/ppa/rusoft/python ubuntu-${{matrix.os.release}} main" > rusoft-python.list
68+
echo " deb [trusted=yes] http://packages.rusoft.ru/ppa/rusoft/backports ubuntu-${{matrix.os.release}} main" > rusoft-backports.list
69+
echo " deb [trusted=yes] http://packages.rusoft.ru/ppa/rusoft/packages ubuntu-${{matrix.os.release}} main" > rusoft-packages.list
70+
echo " deb [trusted=yes] http://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu ${{matrix.os.release}} main" > deadsnakes.list
71+
sudo find ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} -iname apt
72+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt update
73+
sudo cp -v ./*.list ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/etc/apt/sources.list.d
74+
false && sudo rm -fv ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/etc/apt/trusted.gpg.d/* && sudo rm -fv ./ubuntu-xenial-x86/etc/apt/trusted.gpg
75+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /bin/bash -c 'cd /etc/apt/trusted.gpg.d && wget http://packages.rusoft.ru/apt/public.gpg -Orusoft.gpg'
76+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /bin/bash -c 'cd /etc/apt/trusted.gpg.d && wget http://packages.rusoft.ru/apt/public-old.gpg -Orusoft-old.gpg'
77+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /bin/bash -c 'apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys A2CE4BCCC50209DD || true'
78+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt update
79+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt upgrade -y
80+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt -fy install
81+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt upgrade -y
82+
83+
84+
- name: Pepare dev files
85+
if: matrix.os.matrix == 'linux'
86+
run: |
87+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt install -y libzstd-dev
88+
89+
- name: Pepare for ${{matrix.os.pypkg}} ${{matrix.os.arch}}
90+
if: matrix.os.matrix == 'linux'
91+
run: |
92+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt install -y ${{matrix.os.pypkg}}-dev gcc pkg-config ${{matrix.os.pypkgadd}}
93+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /bin/bash -c "wget ${{matrix.os.getpipurl}} -O get-pip.py && ${{matrix.os.pypkg}} get-pip.py || true"
94+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /bin/bash -c "${{matrix.os.pypkg}} -m pip install -U 'setuptools<72.0'"
95+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /bin/bash -c "${{matrix.os.pypkg}} -m pip install -U pkginfo"
96+
97+
98+
- name: Pepare source and build wheel for ${{matrix.os.pypkg}} ${{matrix.os.arch}}
99+
if: matrix.os.matrix == 'linux'
100+
run: |
101+
sudo mkdir -p ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/build_wheel/
102+
sudo tar -xvf dist/zstd-${{matrix.os.version}}.tar.gz -C ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/build_wheel/
103+
false && sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} env
104+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} pkg-config libzstd --modversion
105+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /bin/bash -c "cd /build_wheel/zstd-${{matrix.os.version}} && ZSTD_ASM=1 _ZSTD_ASM_BMI2=1 ZSTD_THREADS=1 _ZSTD_EXTERNAL=0 python${{matrix.os.pyver}} setup.py bdist_wheel clean"
106+
107+
- name: Test wheel for ${{matrix.os.pypkg}} ${{matrix.os.arch}}
108+
if: matrix.os.matrix == 'linux'
109+
run: |
110+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /bin/bash -c "cd /build_wheel/zstd-${{matrix.os.version}} && python${{matrix.os.pyver}} setup.py test"
111+
112+
- name: Pepare wheel for upload
113+
if: matrix.os.matrix == 'linux'
114+
run: |
115+
sudo cp -v ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/build_wheel/zstd-${{matrix.os.version}}/dist/* ./dist
116+
sudo ls -lh ./dist/*
117+
sudo mv -v ./dist/"zstd-${{matrix.os.version}}-${{matrix.os.pyengine_tag}}-linux_${{matrix.os.tag_arch}}.whl" ./dist/"zstd-${{matrix.os.version}}-${{matrix.os.pyengine_tag}}-${{matrix.os.libc_tag}}_${{matrix.os.tag_arch}}.whl"
118+
sudo rm -vf ./dist/*.tar.gz
119+
120+
121+
# - name: Upload artifacts
122+
# uses: actions/upload-artifact@v4
123+
# with:
124+
# name: wheels
125+
#. path: ./dist
126+
# compression-level: 0
127+
128+
- name: Test for secrets access
129+
id: check_secrets
130+
# If a third party makes a pull request
131+
# this allows automated steps below to be skipped
132+
# and leave a clean PR CI run
133+
shell: bash
134+
run: |
135+
unset HAS_SECRET
136+
unset HAS_SECRET_TEST
137+
if [ -n "$SECRET" ]; then HAS_SECRET='true' ; fi
138+
if [ -n "$SECRET_TEST" ]; then HAS_SECRET_TEST='true' ; fi
139+
echo ::set-output name=HAS_SECRET::${HAS_SECRET}
140+
echo ::set-output name=HAS_SECRET_TEST::${HAS_SECRET_TEST}
141+
env:
142+
SECRET: "${{ secrets.pypi_password }}"
143+
SECRET_TEST: "${{ secrets.test_pypi_password }}"
144+
145+
- name: Install twine
146+
run: pip install 'twine<=6.0.1'
147+
148+
- name: Publish distribution to PyPI
149+
if: >
150+
startsWith(github.event.ref, 'refs/tags') &&
151+
steps.check_secrets.outputs.HAS_SECRET
152+
env:
153+
# If the PR/Push has secret access
154+
# and PYPI_PASSWORD is in GH Secrets for this repo
155+
# and this is a tag, publish to PyPI
156+
TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/
157+
TWINE_USERNAME: "${{ secrets.pypi_username }}"
158+
TWINE_NON_INTERACTIVE: 1
159+
TWINE_PASSWORD: "${{ secrets.pypi_password }}"
160+
run: twine upload --non-interactive --skip-existing --verbose 'dist/*'
161+
162+
- name: Publish distribution to Test PyPI
163+
if: steps.check_secrets.outputs.HAS_SECRET
164+
env:
165+
# If the PR/Push has secret access
166+
# and TEST_PYPI_PASSWORD is in GH Secrets for this repo
167+
# then publish each build to test PyPI
168+
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
169+
TWINE_USERNAME: "${{ secrets.test_pypi_username }}"
170+
TWINE_NON_INTERACTIVE: 1
171+
TWINE_PASSWORD: "${{ secrets.test_pypi_password }}"
172+
run: twine upload --non-interactive --skip-existing --verbose 'dist/*'
173+

glibc-check.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
3+
# This scripts lets you check which minimum GLIBC version an executable requires.
4+
# Simply run './glibc-check.sh path/to/your/binary'
5+
#
6+
# You can set `MAX_VER` however low you want, although I (fasterthanlime)
7+
# feel like `2.13` is a good target (For reference, Ubuntu 12.04 has GLIBC 2.15)
8+
MAX_VER=2.13
9+
10+
SCRIPTPATH=$( cd $(dirname $0) ; pwd -P )
11+
BINARY=$1
12+
13+
# Version comparison function in bash
14+
vercomp () {
15+
if [[ $1 == $2 ]]
16+
then
17+
return 0
18+
fi
19+
local IFS=.
20+
local i ver1=($1) ver2=($2)
21+
# fill empty fields in ver1 with zeros
22+
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
23+
do
24+
ver1[i]=0
25+
done
26+
for ((i=0; i<${#ver1[@]}; i++))
27+
do
28+
if [[ -z ${ver2[i]} ]]
29+
then
30+
# fill empty fields in ver2 with zeros
31+
ver2[i]=0
32+
fi
33+
if ((10#${ver1[i]} > 10#${ver2[i]}))
34+
then
35+
return 1
36+
fi
37+
if ((10#${ver1[i]} < 10#${ver2[i]}))
38+
then
39+
return 2
40+
fi
41+
done
42+
return 0
43+
}
44+
45+
IFS="
46+
"
47+
VERS=$(objdump -T $BINARY | grep GLIBC | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -u)
48+
49+
for VER in $VERS; do
50+
vercomp $VER $MAX_VER
51+
COMP=$?
52+
if [[ $COMP -eq 1 ]]; then
53+
echo "Error! ${BINARY} requests GLIBC ${VER}, which is higher than target ${MAX_VER}"
54+
echo "Affected symbols:"
55+
objdump -T $BINARY | grep GLIBC_${VER}
56+
echo "Looking for symbols in libraries..."
57+
for LIBRARY in $(ldd $BINARY | cut -d ' ' -f 3); do
58+
echo $LIBRARY
59+
objdump -T $LIBRARY | fgrep GLIBC_${VER}
60+
done
61+
exit 27
62+
else
63+
echo "Found version ${VER}"
64+
fi
65+
done

0 commit comments

Comments
 (0)