Skip to content

Commit

Permalink
Trac #31002: Specify bdist temp folder for WSL compatibility
Browse files Browse the repository at this point in the history
On WSL, `bdist_wheel` sometimes encounters strange permission errors
(when the source folder is a Windows folder mounted in WSL), see
pypa/packaging-problems#258. In the linked
issue, a solution is described by changing the permissions for
authenticated users, but it didn't work for me. Thus I've implemented
the workaround mentioned in https://github.com/pypa/packaging-
problems/issues/258#issuecomment-548148041 and specified an explicit
bdist directory in the Linux system.

URL: https://trac.sagemath.org/31002
Reported by: gh-tobiasdiez
Ticket author(s): Tobias Diez, Matthias Koeppe
Reviewer(s): Matthias Koeppe, Tobias Diez
  • Loading branch information
Release Manager committed Dec 13, 2020
2 parents fc7304a + fb10429 commit 3dff3f4
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
8 changes: 8 additions & 0 deletions build/bin/sage-dist-helpers
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ sdh_make_install() {
sdh_die "Error installing $PKG_NAME"
}

sdh_setup_bdist_wheel() {
mkdir -p dist
rm -f dist/*.whl
BDIST_DIR="$(mktemp -d)"
sage-python23 setup.py --no-user-cfg \
bdist_wheel --bdist-dir "$BDIST_DIR" \
"$@" || sdh_die "Error building a wheel for $PKG_NAME"
}

sdh_pip_install() {
echo "Installing $PKG_NAME"
Expand Down
6 changes: 1 addition & 5 deletions build/pkgs/gambit/spkg-install.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,5 @@ cd src/python
rm gambit/lib/libgambit.cpp

# pip doesn't work (https://github.com/gambitproject/gambit/issues/207)
sage-python23 setup.py --no-user-cfg bdist_wheel
if [ $? -ne 0 ]; then
echo "Error installing Python API"
exit 1
fi
sdh_setup_bdist_wheel
sdh_store_and_pip_install_wheel .
5 changes: 1 addition & 4 deletions build/pkgs/numpy/spkg-install.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ export NUMPY_FCONFIG="config_fc --noopt --noarch"

################################################

sage-python23 setup.py \
--no-user-cfg \
bdist_wheel \
${NUMPY_FCONFIG} || sdh_die "Error building wheel for numpy"
sdh_setup_bdist_wheel ${NUMPY_FCONFIG}

sdh_store_and_pip_install_wheel .
6 changes: 2 additions & 4 deletions build/pkgs/pillow/spkg-install.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ if [ "$CONDA_PREFIX" != "" ]; then
fi

# Note: Avoid shared libraries inside egg files, Trac #19467
sage-python23 setup.py \
--no-user-cfg \
bdist_wheel \
sdh_setup_bdist_wheel \
build_ext \
--debug \
--disable-jpeg \
$extra_build_ext || sdh_die "Error building/installing Pillow"
$extra_build_ext

sdh_store_and_pip_install_wheel .
3 changes: 1 addition & 2 deletions build/pkgs/python_igraph/spkg-install.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
cd src

sage-python23 setup.py bdist_wheel \
--use-pkg-config || sdh_die "Error building wheel for python_igraph"
sdh_setup_bdist_wheel --use-pkg-config

sdh_store_and_pip_install_wheel .
4 changes: 4 additions & 0 deletions src/doc/en/developer/packaging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ begin with ``sdh_``, which stands for "Sage-distribution helper".
arguments. If ``$SAGE_DESTDIR`` is not set then the command is run
with ``$SAGE_SUDO``, if set.
- ``sdh_setup_bdist_wheel [...]``: Runs ``setup.py bdist_wheel`` with
the given arguments, as well as additional default arguments used for
installing packages into Sage.
- ``sdh_pip_install [...]``: The equivalent of running ``pip install``
with the given arguments, as well as additional default arguments used for
installing packages into Sage with pip. The last argument must be
Expand Down

0 comments on commit 3dff3f4

Please sign in to comment.