Skip to content

Commit

Permalink
Turn it into a precommand
Browse files Browse the repository at this point in the history
  • Loading branch information
coldfix committed Oct 15, 2020
1 parent df908d7 commit 34c2f37
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions .github/build/macos/cpymad.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ build()
{
py_ver=$1

conda_ create -qyf -n py$py_ver python=$py_ver wheel cython -c anaconda
conda_ activate py$py_ver
_ conda create -qyf -n py$py_ver python=$py_ver wheel cython -c anaconda
_ conda activate py$py_ver
pip install -U setuptools
rm -f src/cpymad/libmadx.c
python setup.py sdist bdist_wheel
conda_ deactivate
_ conda deactivate
}

conda_() {
# Conda with disabled trace (really noisy otherwise):
_() {
# run command with disabled trace to decrease noise
{ set +x; } 2>/dev/null
conda "$@"; exitcode=$?
"$@"; exitcode=$?
{ set -x; return $exitcode; } 2>/dev/null
}

Expand Down
24 changes: 12 additions & 12 deletions .github/build/msys2/cpymad.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ main()
MADXDIR=${2:-$MADXDIR}

# Create python environments:
conda_ create -qyf -n py27 python=2.7 wheel cython -c anaconda
conda_ create -qyf -n py35 python=3.5 wheel cython -c anaconda
conda_ create -qyf -n py36 python=3.6 wheel cython -c anaconda
conda_ create -qyf -n py37 python=3.7 wheel cython -c anaconda
conda_ create -qyf -n py38 python=3.8 wheel cython -c anaconda
_ conda create -qyf -n py27 python=2.7 wheel cython -c anaconda
_ conda create -qyf -n py35 python=3.5 wheel cython -c anaconda
_ conda create -qyf -n py36 python=3.6 wheel cython -c anaconda
_ conda create -qyf -n py37 python=3.7 wheel cython -c anaconda
_ conda create -qyf -n py38 python=3.8 wheel cython -c anaconda

# Build cpymad wheels:
if [[ $ARCH == i686 ]]; then
Expand Down Expand Up @@ -57,7 +57,7 @@ build()
# `.pyd` in $libdir) to prevent the final `python setup.py bdist_wheel`
# command from trying trying to perform either of these steps with MSVC.

conda_ activate $py_env
_ conda activate $py_env
tempdir=build/temp.$dir_tag/Release/src/cpymad
libdir=build/lib.$dir_tag/cpymad
mkdir -p $tempdir
Expand All @@ -73,7 +73,7 @@ build()
# the path to the runtime DLLs required for running gcc. Without this
# the command errors with a windows error that is visible only via the
# remote desktop but doesn't get logged as console output.
conda_ deactivate
_ conda deactivate

gcc -mdll -O -Wall -flto $CFLAGS \
-I$MADXDIR/include \
Expand All @@ -97,15 +97,15 @@ build()
-o $libdir/libmadx$file_tag.pyd

# Turn target python environment back on, see above:
conda_ activate $py_env
_ conda activate $py_env
python setup.py bdist_wheel
conda_ deactivate
_ conda deactivate
}

conda_() {
# Conda with disabled trace (really noisy otherwise):
_() {
# run command with disabled trace to decrease noise
{ set +x; } 2>/dev/null
conda "$@"; exitcode=$?
"$@"; exitcode=$?
{ set -x; return $exitcode; } 2>/dev/null
}

Expand Down

0 comments on commit 34c2f37

Please sign in to comment.