Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updateallpo.sh switch to python3 since we are in python3 branch #981

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion updateallpo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,29 @@ else
fi
fi

#
# python version check that we are with python3
#
python_exec=""
which python3 > /dev/null 2>&1
if [[ $? -eq 0 ]]; then
python_exec="python3"
else
which python > /dev/null 2>&1
if [[ $? -eq 0 ]]; then
# Check if it is version 3
python_version=$(python --version | awk -F "." '{ gsub(/Python\s+/,"",$1); print $1; }')
if [[ ${python_version} -eq 3 ]]; then
python_exec="python"
else
python_exec=""
fi
fi
fi
[[ -z ${python_exec} ]] && { echo "No python 3 found, please install it or set it first into your PATH variable"; exit 1; }

echo "Python found: [${python_exec}]"

#
# On Mac OSX find option are specific
#
Expand Down Expand Up @@ -68,7 +91,7 @@ for directory in */po/ ; do
find $findoptions .. -name "*.py" -exec xgettext --no-wrap -L Python --from-code=UTF-8 -kpgettext:1c,2 --add-comments="TRANSLATORS:" -d $plugin -s -o $plugin-py.pot {} \+
$localgsed --in-place $plugin-py.pot --expression=s/CHARSET/UTF-8/
printf "Creating temporary file $plugin-xml.pot\n"
find $findoptions .. -name "*.xml" -exec python $rootpath/xml2po.py {} \+ > $plugin-xml.pot
find $findoptions .. -name "*.xml" -exec ${python_exec} $rootpath/xml2po-python3.py {} \+ > $plugin-xml.pot
printf "Merging pot files to create: %s.pot\n" $plugin
cat $plugin-py.pot $plugin-xml.pot | msguniq --no-wrap --no-location -o $plugin.pot -
rm $plugin-py.pot $plugin-xml.pot
Expand Down
Loading