Skip to content

Commit

Permalink
do not test class_map files + auto sipify_all on branches
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Jul 12, 2024
1 parent f1c09ad commit 3767c99
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
name: Run sipify on PR
name: Run sipify

on:
issue_comment:
types: [created]
push:
branches:
- master
- release-*

jobs:
sipify:
if: contains(github.event.comment.html_url, '/pull/') && contains(github.event.comment.body, '/sipify')
if: github.event_name == 'push' || (contains(github.event.comment.html_url, '/pull/') && contains(github.event.comment.body, '/sipify'))
runs-on: [ubuntu-latest]
steps:

- name: Get PR branch
uses: alessbell/[email protected]
if: ${{ github.event_name == 'issue_comment' }}
id: comment-branch

- uses: actions/checkout@v4
with:
ref: ${{ steps.comment-branch.outputs.head_ref }}
repository: ${{ steps.comment-branch.outputs.head_owner }}/${{ steps.comment-branch.outputs.head_repo }}
ref: ${{ steps.comment-branch.outputs.head_ref || github.ref_name }}
repository: ${{ steps.comment-branch.outputs.head_owner || 'qgis' }}/${{ steps.comment-branch.outputs.head_repo || 'QGIS' }}
token: ${{ secrets.GH_TOKEN_BOT }}

- name: Install Requirements
Expand All @@ -39,7 +44,7 @@ jobs:
libtry-tiny-perl
- name: run sipify
run: ./scripts/sipify_all.sh
run: ./scripts/sipify_all.sh -m

- name: commit
run: |
Expand Down
6 changes: 3 additions & 3 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -442,13 +442,13 @@ foreach(module ${PY_MODULES})
endforeach(pyfile)
PY_COMPILE(py${module} "${QGIS_PYTHON_OUTPUT_DIRECTORY}/${module}")

# install class map file
install(FILES ${BINDING_FILES_ROOT_DIR}/class_map.yaml DESTINATION "${QGIS_PYTHON_DIR}/${module}")

# install source sip files
if(SIP_GLOBAL_INSTALL)
file(GLOB sip_files ${CMAKE_CURRENT_BINARY_DIR}/${module}/*.sip)
install(FILES ${sip_files} DESTINATION ${SIP_DEFAULT_SIP_DIR}/qgis/${module})
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${module}/auto_generated DESTINATION ${SIP_DEFAULT_SIP_DIR}/qgis/${module})
endif()
endforeach(module)

# install sipify config
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/sipify.yaml DESTINATION "${QGIS_PYTHON_DIR}")
38 changes: 22 additions & 16 deletions scripts/sipify_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
###########################################################################
set -e

# TEMPLATE_DOC=""
# while :; do
# case $1 in
# -t|--template-doc) TEMPLATE_DOC="-template-doc"
# ;;
# *) break
# esac
# shift
# done
CLASS_MAP=0
while getopts "m" opt; do
case $opt in
m)
CLASS_MAP=1
;;
esac
done
shift $(expr $OPTIND - 1)

DIR=$(git rev-parse --show-toplevel)

Expand Down Expand Up @@ -73,21 +73,27 @@ It is not aimed to be manually edited
else
path=$(${GP}sed -r 's@/[^/]+$@@' <<< $sipfile)
mkdir -p python/$path
./scripts/sipify.pl $IS_QT6 -s ${root_dir}/$sipfile.in -p ${module_dir}/auto_additions/${pyfile} -c ${module_dir}/class_map.yaml $header &
CLASS_MAP_CALL=
if [[ ${CLASS_MAP} -eq 1 ]]; then
CLASS_MAP_CALL="-c ${module_dir}/class_map.yaml"
fi
./scripts/sipify.pl $IS_QT6 -s ${root_dir}/${sipfile}.in -p ${module_dir}/auto_additions/${pyfile} ${CLASS_MAP_CALL} ${header} &
fi
count=$((count+1))
done < <( ${GP}sed -n -r "s@^%Include auto_generated/(.*\.sip)@${module}/auto_generated/\1@p" python/${module}/${module}_auto.sip )
done
done
wait # wait for sipify processes to finish

for root_dir in python python/PyQt6; do
for module in "${modules[@]}"; do
module_dir=${root_dir}/${module}
echo "sorting ${module_dir}/class_map.yaml"
sort -n -o ${module_dir}/class_map.yaml ${module_dir}/class_map.yaml
if [[ ${CLASS_MAP} -eq 1 ]]; then
for root_dir in python python/PyQt6; do
for module in "${modules[@]}"; do
module_dir=${root_dir}/${module}
echo "sorting ${module_dir}/class_map.yaml"
sort -n -o ${module_dir}/class_map.yaml ${module_dir}/class_map.yaml
done
done
done
fi

echo " => $count files sipified! 🍺"

Expand Down
9 changes: 1 addition & 8 deletions tests/code_layout/sipify/test_sipfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ for root_dir in python python/PyQt6; do
if [ ! -f $header ]; then
echo "*** Missing header: $header for sipfile $sipfile"
else
outdiff=$(./scripts/sipify.pl $IS_QT6 -p $root_dir/${module}/auto_additions/${pyfile}.temp -c $root_dir/${module}/class_map.yaml.test $header | diff $root_dir/$sipfile.in -)
outdiff=$(./scripts/sipify.pl $IS_QT6 -p $root_dir/${module}/auto_additions/${pyfile}.temp $header | diff $root_dir/$sipfile.in -)
if [[ -n "$outdiff" ]]; then
echo " *** SIP file not up to date: $root_dir/$sipfile"
echo " $outdiff "
Expand All @@ -48,13 +48,6 @@ for root_dir in python python/PyQt6; do
done < <(
${GP}sed -n -r "s@^%Include auto_generated/(.*\.sip)@${module}/auto_generated/\1@p" $root_dir/${module}/${module}_auto.sip
)
sort -n -o ${module_dir}/class_map.dat.test ${module_dir}/class_map.dat.test
outdiff3=$($root_dir/${module}/class_map.yaml $root_dir/${module}/class_map.yaml.test)
if [[ -n "$outdiff3" ]]; then
echo " *** Class map not up to date: $root_dir/${module}/class_map.yaml. Run sipify_all.sh <module> to fix this."
echo " $outdiff3 "
code=1
fi
done
done

Expand Down

0 comments on commit 3767c99

Please sign in to comment.