forked from open-mmlab/cocoapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bdist.sh
executable file
·65 lines (56 loc) · 1.45 KB
/
bdist.sh
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
#!/bin/bash
#
# Utilizes the manylinux docker images:
# https://github.com/pypa/manylinux
# check if docker available
if ! docker help > /dev/null
then
echo "Docker not installed, cannot proceed!"
exit 1
fi
manylinux_versions="manylinux2014_x86_64 manylinux_2_28_x86_64"
# create pip cache dir
if [ ! -d "./cache" ]
then
echo "Creating cache dir..."
mkdir ./cache
fi
# remove dist dir
if [ -d ./dist ]
then
echo "Removing dist dir..."
rm -Rf ./dist
fi
for manylinux in $manylinux_versions
do
if [ "$manylinux" == "manylinux2014_x86_64" ]
then
versions="3.7 3.8 3.9"
else
versions="3.7 3.8 3.9 3.10 3.11 3.12"
fi
for version in $versions
do
echo "Docker image: $manylinux"
echo "Building for python: $version"
venv="venv-$version-$manylinux"
# delete old venv?
if [ -d "./$venv" ]
then
echo "...deleting old venv: $venv"
rm -Rf ./$venv
fi
# create new venv
echo "...creating new venv: $venv"
docker_run="docker run -u $(id -u):$(id -g) -e USER=$USER --rm -v `pwd`:/workspace -v `pwd`/cache:/.cache -w /workspace quay.io/pypa/$manylinux"
$docker_run python$version -m venv /workspace/$venv
$docker_run /workspace/$venv/bin/pip install 'cython<3.0.0' wheel numpy setuptools
# build dist
if [ -d ./build ]
then
echo "...removing build dir"
rm -Rf ./build
fi
$docker_run /workspace/$venv/bin/python setup.py bdist_wheel --plat-name=$manylinux sdist
done
done