Skip to content
Snippets Groups Projects
Commit 3ef023bb authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

fix example-robot-data wheel

parent cd34d867
No related branches found
No related tags found
No related merge requests found
from skbuild import setup
from setuptools import setup
import os
try:
with open("README.md", "r") as f:
long_description = f.read()
except FileNotFoundError:
long_description = ""
def read_text(path):
with open(path) as f:
return f.read().decode('utf-8').strip()
def data_files(*paths):
return [(root, [os.path.join(root, f) for f in files]) for path in paths for root, _, files in os.walk(path)]
setup(
name="example-robot-data",
version="VERSION",
packages=['example_robot_data'],
description="Set of robot URDFs for benchmarking and developed examples.",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/gepetto/example-robot-data",
install_requires=['pinocchio'],
cmake_minimum_required_version='3.1',
data_files=data_files("include", "lib", "share"),
version=read_text('.version'),
long_description=read_text("README.md"),
long_description_content_type="text/markdown",
classifiers=[
"Programming Language :: Python :: 2", "Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD License", "Operating System :: POSIX :: Linux"
......
......@@ -5,14 +5,13 @@ PYVER=${2:-3.9}
export CMAKE_PREFIX_PATH="~/.local:/opt/openrobots"
PACKAGE="${TARGET//-/_}"
VERSION="$(grep version setup.py | head -1 | cut -d'"' -f2)"
VERSION="$(cat .version)"
TARVER="$TARGET-$VERSION"
WHEEL_DIR="$PACKAGE-$VERSION"
PYBIN="$(find /opt/python -name "cp${PYVER/.}*")/bin"
INSTALLED_PREFIX="$PWD/_skbuild/linux-x86_64-$PYVER/cmake-install"
SITE_PACKAGES="lib/python$PYVER/site-packages"
USER_PACKAGES="$HOME/.local/$SITE_PACKAGES"
WHEEL_NAME="$WHEEL_DIR-cp${PYVER/.}-"
USER_SITE="$("$PYBIN/python" -c 'import site; print(site.USER_SITE)')"
SITE_PACKAGES="$("$PYBIN/python" -c "import site; print(site.USER_SITE.replace(site.USER_BASE + '/', ''))")"
LIB_DIR="$PACKAGE.libs"
[ "$PACKAGE" = "hpp_fcl" ] && PACKAGE=hppfcl
PACKAGE_DIR="$WHEEL_DIR/$WHEEL_DIR.data/data/$SITE_PACKAGES/$PACKAGE"
......@@ -21,34 +20,38 @@ PACKAGE_DIR="$WHEEL_DIR/$WHEEL_DIR.data/data/$SITE_PACKAGES/$PACKAGE"
"$PYBIN/pip" install --user --find-links=/io/dist/ \
$(grep install_requires setup.py | sed "s/.*\['//;s/'\].*//;s/,//")
# Build wheels
"$PYBIN/python" setup.py bdist_wheel -j"$(nproc)" -DBUILD_TESTING=OFF -DINSTALL_DOCUMENTATION=OFF \
-DCMAKE_INSTALL_LIBDIR=lib -DPYTHON_STANDARD_LAYOUT=ON -DENFORCE_MINIMAL_CXX_STANDARD=ON
BINARY_EXTENSIONS="$(find "$INSTALLED_PREFIX/$SITE_PACKAGES/$PACKAGE" -name '*.so*')" || true
if [ -n "$BINARY_EXTENSIONS" ]
if grep -q skbuild setup.py
then
# Build binary wheel
"$PYBIN/python" setup.py bdist_wheel -j"$(nproc)" -DBUILD_TESTING=OFF -DINSTALL_DOCUMENTATION=OFF \
-DCMAKE_INSTALL_LIBDIR=lib -DPYTHON_STANDARD_LAYOUT=ON -DENFORCE_MINIMAL_CXX_STANDARD=ON
# Bundle external shared libraries into the wheels
OTHER_LIB_DIRS=$(find "$USER_PACKAGES" -name '*.libs' | tr '\n' ':')
OTHER_LIB_DIRS=$(find "$USER_SITE" -name '*.libs' | tr '\n' ':')
# don't bundle ones already in another wheel
# that's against pypa recomendations, but should work
WHITELISTED="$(/scripts/patch_whitelist.py "$USER_PACKAGES")"
WHITELISTED="$(/scripts/patch_whitelist.py "$USER_SITE")"
# Repair it
LD_LIBRARY_PATH="$INSTALLED_PREFIX/lib:$OTHER_LIB_DIRS/opt/openrobots/lib:$LD_LIBRARY_PATH" \
auditwheel repair "dist/$WHEEL_NAME"* --plat "$PLAT" -w /io/wheelhouse/
auditwheel repair dist/*.whl --plat "$PLAT" -w /io/wheelhouse/
else
mv dist/"$WHEEL_NAME"*-linux*.whl /io/wheelhouse
# Build pure wheel
cmake -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_PREFIX=. .
make install
python setup.py bdist_wheel --universal
mkdir -p /io/wheelhouse
mv dist/*.whl /io/wheelhouse
fi
# Clean build
rm -rf _skbuild dist
rm -rf _skbuild dist inst
# Extract it
wheel unpack /io/wheelhouse/"$WHEEL_NAME"*linux*.whl
wheel unpack /io/wheelhouse/*.whl
if [ -n "$BINARY_EXTENSIONS" ]
if grep -q skbuild setup.py
then
# set the RPATH right for the installed wheel
# ref https://github.com/pypa/auditwheel/issues/257
......@@ -89,4 +92,4 @@ rm -rf "${WHEEL_DIR:?}"/ "$TARGET".egg-info
(cd "$HOME"; "$PYBIN/python" "/io/config/$TARGET/test.py")
mkdir -p /io/dist
mv /io/wheelhouse/"$WHEEL_NAME"*linux*.whl /io/dist
mv /io/wheelhouse/*.whl /io/dist
from skbuild import setup
try:
with open("README.md", "r") as f:
long_description = f.read()
except FileNotFoundError:
long_description = ""
setup(
name="TARGET",
version="VERSION",
description="DESCRIPTION",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/ORG/TARGET",
install_requires=INSTALL_REQUIRES,
classifiers=[
"Programming Language :: Python :: 2", "Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD License", "Operating System :: POSIX :: Linux"
],
python_requires='>=2.7',
)
......@@ -15,8 +15,6 @@ curl -sSL "$URL/releases/download/v$VERSION/$TARGET-$VERSION.tar.gz" \
cp "/io/config/$TARGET/setup.py" .
cp /scripts/pyproject.toml .
sed -i "s/VERSION/$VERSION/" setup.py
# Fix CMake for scikit-build
find . -name CMakeLists.txt | xargs sed -i 's/PYTHON_INCLUDE_DIRS/PYTHON_INCLUDE_DIR/'
sed -i 's/REQUIRED COMPONENTS Interpreter Development/REQUIRED COMPONENTS Interpreter/' cmake/python.cmake
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment