#11686: Race condition in matplotlib mkdir()
------------------------+---------------------------------------------------
Reporter: jdemeyer | Owner: tbd
Type: defect | Status: needs_review
Priority: minor | Milestone: sage-4.7.2
Component: packages | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author: John Palmieri
Merged: | Dependencies:
------------------------+---------------------------------------------------
Comment(by leif):
Replying to [comment:18 jhpalmieri]:
> Here's a version which does this. I'm not a shell script expert; is
this a good way to accomplish it?
{{{
#!sh
if [ "$UNAME" = "Darwin" ]; then
command -v pkg-config || patch -p1 < "$patch"
}}}
I see you've redirected the output of `command` to `/dev/null` in the
actual patch.
IMHO a bit more readable would be
{{{
#!sh
if [ "$UNAME" = Darwin ] && ! command -v pkg-config >/dev/null; then
patch -p1 < "$patch" # Apply only on Darwin if pkg-config isn't
installed
fi
}}}
but for simplicity (if you're not going to change the patch) I would move
the specific patch to `patches/Darwin/` and do the following:
{{{
#!sh
# Apply patches for all platforms. See SPKG.txt for why and what.
for patch in ../patches/*.patch; do
patch -p1 <"$patch"
if [ $? -ne 0 ]; then
echo >&2 "Error applying '$patch'"
exit 1
fi
done
# Apply patch(es) for Darwin.
if [ "$UNAME" = Darwin ]; then
for patch in ../patches/Darwin/*.patch; do
patch -p1 <"$patch"
if [ $? -ne 0 ]; then
echo >&2 "Error applying '$patch'"
exit 1
fi
done
fi
}}}
(The latter would have to be changed from a loop to an `if`-statement
depending on `command -v ...` if we only apply the single patch and don't
test for `pkg-config` in the patch itself, i.e., from Python.)
Having the patch in a separate directory it's also immediately clear that
it is platform-specific; unfortunately we here have another precondition.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11686#comment:19>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.