forked from eltrompetero/coniii
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pypi_compile.sh
executable file
·66 lines (57 loc) · 1.61 KB
/
pypi_compile.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
66
#!/bin/bash
# Code for compiling package for upload to PyPI.
# Clean previous compilation results.
if [ ! `command -v trash` ]
then
echo "trash-cli is not installed. Cannot empty dist directory safely."
else
if [ -d build ]; then
trash build
fi
if [ -d dist ]; then
trash dist
fi
fi
find ./ -name *.pyc -exec rm {} \;
# Update cpp code (DEPRECATED)
# rsync -au ../../cpp/cppsamplers/cppsamplers/*.*pp cpp/
# Compile wheels into dist folder.
python setup.py bdist_wheel
# Make source available
python setup.py sdist
# Rename Linux wheel for upload to PyPI.
unamestr=`uname`
if [[ "$unamestr" == 'Linux' ]]; then
if [ ! `command -v rename` ]
then
echo "rename is not installed. wheel not renamed."
exit 1
fi
rename 's/linux/manylinux1/' dist/*
fi
# For pypi upload
if [ "$1" == "--all" ]
then
# Update usage guide to latest version for upload to PyPI.
cp ipynb/usage_guide.ipynb coniii/
# Compile docs
sphinx-build ./docs/ ./docs/_build/html
echo "rsync -au docs/_build/html/* ~/Dropbox/Documents/eltrompetero.github.io/coniii/"
rsync -au docs/_build/html/* ~/Dropbox/Documents/eltrompetero.github.io/coniii/
fi
# check if boost module compiled
has_dirs() {
for f do
[ -d "$f" ] && return
done
false
}
if compgen -G "./build/lib.*/coniii/samplers_ext*.so" > /dev/null; then
echo "********************************"
echo "Boost module built successfully."
echo "********************************"
else
echo "*****************************"
echo "Failed to build Boost module."
echo "*****************************"
fi