Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5f77bf1

Browse files
webknjazasvetlov
authored andcommitted
Optimize docker running script
* Introduce package_name script param * Reduce nesting * Reduce code duplication
1 parent 263c43a commit 5f77bf1

2 files changed

Lines changed: 28 additions & 20 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ script:
6868

6969
after_success:
7070
- codecov
71-
- ./tools/run_docker.sh
71+
- ./tools/run_docker.sh "aiohttp"

tools/run_docker.sh

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
1-
if [ ! -z $TRAVIS_TAG ] && [ -z $PYTHONASYNCIODEBUG ] && [ -z $AIOHTTP_NO_EXTENSIONS] ;then
2-
echo "x86_64"
3-
docker pull quay.io/pypa/manylinux1_x86_64
4-
docker run --rm -v `pwd`:/io quay.io/pypa/manylinux1_x86_64 /io/tools/build-wheels.sh
5-
echo "Dist folder content is:"
6-
for f in dist/aiohttp*manylinux1_x86_64.whl
7-
do
8-
echo "Upload $f"
9-
python -m twine upload $f --username andrew.svetlov --password $PYPI_PASSWD
10-
done
11-
echo "Cleanup"
12-
docker run --rm -v `pwd`:/io quay.io/pypa/manylinux1_x86_64 rm -rf /io/dist
1+
#!/bin/bash
2+
if [ -z $TRAVIS_TAG ] || [ ! -z $PYTHONASYNCIODEBUG ] || [ ! -z $AIOHTTP_NO_EXTENSIONS ]
3+
then
4+
exit 1
5+
fi
6+
7+
package_name="$1"
8+
if [ -z "$package_name" ]
9+
then
10+
&>2 echo "Please pass package name as a first argument of this script ($0)"
11+
exit 1
12+
fi
13+
14+
dock_ext_args=""
15+
16+
for arch in x86_64 i686
17+
do
18+
[ $arch == "i686" ] && dock_ext_args="linux32"
19+
20+
echo "${arch}"
21+
docker pull "quay.io/pypa/manylinux1_${arch}"
22+
docker run --rm -v `pwd`:/io "quay.io/pypa/manylinux1_${arch}" $dock_ext_args /io/tools/build-wheels.sh "$package_name"
1323

14-
echo "i686"
15-
docker pull quay.io/pypa/manylinux1_i686
16-
docker run --rm -v `pwd`:/io quay.io/pypa/manylinux1_i686 linux32 /io/tools/build-wheels.sh
1724
echo "Dist folder content is:"
18-
for f in dist/aiohttp*manylinux1_i686.whl
25+
for f in dist/aiohttp*manylinux1_${arch}.whl
1926
do
2027
echo "Upload $f"
21-
python -m twine upload $f --username andrew.svetlov --password $PYPI_PASSWD
28+
python -m twine upload "$f" --username andrew.svetlov --password "$PYPI_PASSWD"
2229
done
30+
2331
echo "Cleanup"
24-
docker run --rm -v `pwd`:/io quay.io/pypa/manylinux1_i686 rm -rf /io/dist
25-
fi
32+
docker run --rm -v `pwd`:/io "quay.io/pypa/manylinux1_${arch}" rm -rf /io/dist
33+
done

0 commit comments

Comments
 (0)