-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcheck-build
More file actions
executable file
·86 lines (73 loc) · 2.49 KB
/
Copy pathcheck-build
File metadata and controls
executable file
·86 lines (73 loc) · 2.49 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
# Build packages for distribution on PyPI
# and execute some sanity checks on them
#
# note: must be executed from the root directory of the project
# first clean up the local environment
echo "..... Clean up first"
find . -type f -name '*.pyc' -delete
find . -type d -name __pycache__ -delete
find . -type d -name '*.egg-info' | xargs rm -rf
rm -rf build/ .cache/ dist/ .eggs/ .tox/ .venv/
# then build the packages
echo "..... Building PyPI packages"
set -e
$(which python) setup.py sdist >/dev/null
$(which python) setup.py bdist_wheel >/dev/null
set +e
# check rst formatting of README before building the package
echo "..... Check rst formatting for PyPI"
twine check dist/* || exit 1
# then run some sanity tests
echo "..... Searching for .pyc files inside the built packages"
matched_files=`tar -tvf dist/*.tar.gz | grep -c "\.pyc"`
if [ "$matched_files" -gt "0" ]; then
echo "ERROR: .pyc files found in .tar.gz package"
exit 1
fi
matched_files=`unzip -t dist/*.whl | grep -c "\.pyc"`
if [ "$matched_files" -gt "0" ]; then
echo "ERROR: .pyc files found in wheel package"
exit 1
fi
echo "..... Trying to verify that all source files are present"
# remove *.egg-info/ generated during build
find . -type d -name '*.egg-info' | xargs rm -rf
source_files=`find ./zealand/ -type f | sed 's|./||'`
# verify for .tar.gz package
package_files=`tar -tvf dist/*.tar.gz`
for src_file in $source_files; do
echo "$package_files" | grep $src_file >/dev/null
if [ "$?" -ne 0 ]; then
echo "ERROR: $src_file not found inside tar.gz package"
exit 1
fi
done
# verify for wheel package
package_files=`unzip -t dist/*.whl`
for src_file in $source_files; do
echo "$package_files" | grep $src_file >/dev/null
if [ "$?" -ne 0 ]; then
echo "ERROR: $src_file not found inside wheel package"
exit 1
fi
done
# exit on error from now on
set -e
echo "..... Trying to install the new tarball inside a virtualenv"
$(which python) -m venv .venv/test-tarball
source .venv/test-tarball/bin/activate
pip install --upgrade setuptools pip
pip install --no-binary :all: dist/kiwitcms*.tar.gz
pip freeze | grep kiwitcms-robotframework-plugin
deactivate
rm -rf .venv/
echo "..... Trying to install the new wheel inside a virtualenv"
$(which python) -m venv .venv/test-wheel
source .venv/test-wheel/bin/activate
pip install --upgrade setuptools pip
pip install --only-binary :all: dist/kiwitcms*.whl
pip freeze | grep kiwitcms-robotframework-plugin
deactivate
rm -rf .venv/
echo "..... PASS"