<commit_before>#!/bin/bash

# this means the script will run successfully only if executed at pppack/lib
dir=../../src/
hme=$(pwd)
if [[ ! $hme == *"pppack/lib"* ]]; then
    echo "ERROR, this script must be used from .../pppack/lib"
    exit 1
fi

# concatenate all fortran sources and wrap the whole into a py module
if [ -z "$1" ]; then
    echo "ERROR, missing input libname"
    exit 1
fi
lib=$dir$1
if [ ! -d $lib ]; then
    echo "ERROR, invalid libname $lib"
    exit 1
fi

libopt=''
# apply special options according to input lib
if [[ $1 == *"chebyshev"* ]]; then
  libopt="only: chebyshev_coef_1d chebyshev_interp_1d chebyshev_value_1d :  $dir/qr_solve/f90/qr_solve.f90 only: qr_solve :  $dir/r8lib/f90/r8lib.f90"
fi

# local compilation may be necessary before wrapping
echo "compile the lib $1 on the local machine"
cd $lib/f90
./$1.sh
cd $hme

# add directives before calling f2py
echo "produce the signature file"
f2py $lib/f90/$1.f90 -m $1 -h $lib/$1.pyf --overwrite-signature $libopt
#
echo "produce the so lib"
f2py -c --fcompiler=gnu95 -DF2PY_REPORT_ON_ARRAY_COPY --build-dir $lib/cc_$1/ $lib/$1.pyf $lib/f90/$1.f90 $libopt<commit_msg>call f2py directly from numpy of py3 in wrap.sh<commit_after>#!/bin/bash

# this means the script will run successfully only if executed at pppack/lib
dir=../../src/
hme=$(pwd)
if [[ ! $hme == *"pppack/lib"* ]]; then
    echo "ERROR, this script must be used from .../pppack/lib"
    exit 1
fi

# concatenate all fortran sources and wrap the whole into a py module
if [ -z "$1" ]; then
    echo "ERROR, missing input libname"
    exit 1
fi
lib=$dir$1
if [ ! -d $lib ]; then
    echo "ERROR, invalid libname $lib"
    exit 1
fi

libopt=''
# apply special options according to input lib
if [[ $1 == *"chebyshev"* ]]; then
  libopt="only: chebyshev_coef_1d chebyshev_interp_1d chebyshev_value_1d :  $dir/qr_solve/f90/qr_solve.f90 only: qr_solve :  $dir/r8lib/f90/r8lib.f90"
fi

# local compilation may be necessary before wrapping
echo "compile the lib $1 on the local machine"
cd $lib/f90
./$1.sh
cd $hme

# add directives before calling f2py
echo "produce the signature file"
fpy="python -m numpy.f2py"
$fpy $lib/f90/$1.f90 -m $1 -h $lib/$1.pyf --overwrite-signature $libopt
#
echo "produce the so lib"
$fpy -c --fcompiler=gnu95 -DF2PY_REPORT_ON_ARRAY_COPY --build-dir $lib/cc_$1/ $lib/$1.pyf $lib/f90/$1.f90 $libopt
{'fraction_non_alphanumeric': 0.134233853946813, 'fraction_numerical': 0.036724356268467706, 'mean_word_length': 3.6379647749510764, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1395173', 'n_tokens_mistral': 967, 'n_tokens_neox': 908, 'n_words': 294}