Skip to content
Permalink
Browse files

build context help and expression help in build directory and still i…

…nclude it in translations
  • Loading branch information
jef-n committed Mar 20, 2016
1 parent 5769f3b commit b5c4d28eba70bc05bcbef64e97f3b523d45c9a59
Showing with 38 additions and 17 deletions.
  1. +0 −2 .gitignore
  2. +0 −4 debian/rules
  3. +1 −0 scripts/astyle.sh
  4. +15 −2 scripts/update_ts.sh
  5. +13 −2 scripts/update_ts_files.sh
  6. +9 −7 src/core/CMakeLists.txt
@@ -51,8 +51,6 @@ scripts/astyle.exe
scripts/Debug
scripts/qgisstyle*
scripts/RelWithDebInfo
src/core/qgscontexthelp_texts.cpp
src/core/qgsexpression_texts.cpp
tests/testdata/checker360by180.asc.aux.xml
tests/testdata/grass/wgs84/test/.gislock
tests/testdata/grass/wgs84/test6/.gislock
@@ -216,10 +216,6 @@ binary binary-arch binary-indep build build-arch build-indep clean install insta
override_dh_clean: cleantemplates
dh_clean qgis.bin.1 qbrowser.bin.1

# automatically generated files
-$(RM) $(CURDIR)/src/core/qgscontexthelp_texts.cpp
-$(RM) $(CURDIR)/src/core/qgsexpression_texts.cpp

-$(RM) -r $(CURDIR)/$(QGIS_BUILDDIR)/

override_dh_auto_configure:
@@ -89,6 +89,7 @@ for f in "$@"; do

*.py)
#cmd="autopep8 --in-place --ignore=E111,E128,E201,E202,E203,E211,E221,E222,E225,E226,E227,E231,E241,E261,E265,E272,E302,E303,E501,E701"
echo -ne "Formatting $f $elcr"
cmd="autopep8 --in-place --ignore=E261,E265,E402,E501"
;;

@@ -21,7 +21,7 @@ pull|push|update)
;;

*)
echo "usage: $(basename $0) {push|pull|update}"
echo "usage: $(basename $0) {push|pull|update} builddirectory"
exit 1
esac

@@ -87,6 +87,17 @@ elif [ $1 = pull ]; then
tx pull -a -s --minimum-perc=35
fi

builddir=$2
if [ ! -d "$builddir" ]; then
echo Build directory not found
exit 1
fi

if [ ! -f "$builddir/src/core/qgsexpression_texts.cpp" -o ! -f "$builddir/src/core/qgscontexthelp_texts.cpp" ]; then
echo Generated help files not found
exit 1
fi

echo Updating python translations
cd python
pylupdate4 user.py utils.py {console,pyplugin_installer}/*.{py,ui} -ts python-i18n.ts
@@ -108,11 +119,13 @@ echo Updating processing translations
perl scripts/processing2cpp.pl python/plugins/processing/processing-i18n.cpp

echo Creating qmake project file
$QMAKE -project -o qgis_ts.pro -nopwd src python i18n
$QMAKE -project -o qgis_ts.pro -nopwd src python i18n "$builddir/src/core/qgsexpression_texts.cpp" "$builddir/src/core/qgscontexthelp_texts.cpp"

echo Updating translations
$LUPDATE -locations absolute -verbose qgis_ts.pro

perl -i.bak -ne 'print unless /^\s+<location.*qgs(expression|contexthelp)_texts\.cpp.*$/;' i18n/qgis_*.ts

if [ $1 = push ]; then
echo Pushing translation...
tx push -s
@@ -32,7 +32,7 @@ cleanup() {
fi

echo Removing temporary files
perl -i.bak -ne 'print unless /^\s+<location.*python-i18n\.cpp.*$/;' i18n/qgis_*.ts
perl -i.bak -ne 'print unless /^\s+<location.*(python-i18n|_texts)\.cpp.*$/;' i18n/qgis_*.ts
for i in \
python/python-i18n.{ts,cpp} \
python/plugins/*/python-i18n.{ts,cpp} \
@@ -105,6 +105,17 @@ if [ "$exclude" != "--exclude i18n/qgis_en.ts" -o -n "$add" ]; then
tar $fast -cf i18n/qgis_ts.tar i18n/qgis_*.ts $exclude
fi

builddir=$1
if [ -d "$builddir" ]; then
echo Build directory not found
exit 1
fi

if [ ! -f "$builddir/src/core/qgsexpression_texts.cpp" -o ! -f "$builddir/src/core/qgscontexthelp_texts.cpp" ]; then
echo Generated help files not found
exit 1
fi

echo Updating python translations
cd python
pylupdate4 utils.py {console,pyplugin_installer}/*.{py,ui} -ts python-i18n.ts
@@ -128,7 +139,7 @@ for i in \
do
[ -f "$i" ] && mv "$i" "$i.save"
done
$QMAKE -project -o qgis_ts.pro -nopwd src python i18n
$QMAKE -project -o qgis_ts.pro -nopwd src python i18n "$builddir/src/core/qgsexpression_texts.cpp" "$builddir/src/core/qgscontexthelp_texts.cpp"
if [ -n "$add" ]; then
for i in $add; do
echo "Adding translation for $i"
@@ -85,7 +85,6 @@ SET(QGIS_CORE_SRCS
qgscolorschemeregistry.cpp
qgsconditionalstyle.cpp
qgscontexthelp.cpp
qgscontexthelp_texts.cpp
qgscoordinatereferencesystem.cpp
qgscoordinatetransform.cpp
qgscoordinateutils.cpp
@@ -106,7 +105,6 @@ SET(QGIS_CORE_SRCS
qgsexpression.cpp
qgsexpressioncontext.cpp
qgsexpressionfieldbuffer.cpp
qgsexpression_texts.cpp
qgsfeature.cpp
qgsfeatureiterator.cpp
qgsfeaturerequest.cpp
@@ -340,23 +338,27 @@ SET(QGIS_CORE_SRCS
geometry/qgspolygonv2.cpp
geometry/qgswkbptr.cpp
geometry/qgswkbtypes.cpp

${CMAKE_CURRENT_BINARY_DIR}/qgscontexthelp_texts.cpp
${CMAKE_CURRENT_BINARY_DIR}/qgsexpression_texts.cpp
)


FILE(GLOB JSON_HELP_FILES "${CMAKE_SOURCE_DIR}/resources/function_help/json/*")
STRING(REPLACE "$" "$$" JSON_HELP_FILES "${JSON_HELP_FILES}")
STRING(REPLACE "\(" "\\(" JSON_HELP_FILES "${JSON_HELP_FILES}")
STRING(REPLACE "\)" "\\)" JSON_HELP_FILES "${JSON_HELP_FILES}")
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/qgsexpression_texts.cpp
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/qgsexpression_texts.cpp
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripts/process_function_template.py ${CMAKE_CURRENT_BINARY_DIR}/qgsexpression_texts.cpp.temp
COMMAND ${CMAKE_COMMAND} -DSRC=${CMAKE_CURRENT_BINARY_DIR}/qgsexpression_texts.cpp.temp -DDST=${CMAKE_CURRENT_SOURCE_DIR}/qgsexpression_texts.cpp -P ${CMAKE_SOURCE_DIR}/cmake/CopyIfChanged.cmake
COMMAND ${CMAKE_COMMAND} -DSRC=${CMAKE_CURRENT_BINARY_DIR}/qgsexpression_texts.cpp.temp -DDST=${CMAKE_CURRENT_BINARY_DIR}/qgsexpression_texts.cpp -P ${CMAKE_SOURCE_DIR}/cmake/CopyIfChanged.cmake
DEPENDS ${JSON_HELP_FILES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

FILE(GLOB CONTEXT_HELP_FILES "${CMAKE_SOURCE_DIR}/resources/context_help/*")
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/qgscontexthelp_texts.cpp
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/qgscontexthelp_texts.cpp
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripts/process_contexthelp.py ${CMAKE_CURRENT_BINARY_DIR}/qgscontexthelp_texts.cpp.temp
COMMAND ${CMAKE_COMMAND} -DSRC=${CMAKE_CURRENT_BINARY_DIR}/qgscontexthelp_texts.cpp.temp -DDST=${CMAKE_CURRENT_SOURCE_DIR}/qgscontexthelp_texts.cpp -P ${CMAKE_SOURCE_DIR}/cmake/CopyIfChanged.cmake
COMMAND ${CMAKE_COMMAND} -DSRC=${CMAKE_CURRENT_BINARY_DIR}/qgscontexthelp_texts.cpp.temp -DDST=${CMAKE_CURRENT_BINARY_DIR}/qgscontexthelp_texts.cpp -P ${CMAKE_SOURCE_DIR}/cmake/CopyIfChanged.cmake
DEPENDS ${CONTEXT_HELP_FILES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
@@ -565,7 +567,7 @@ IF(MSVC)
ELSE(MSVC)
SET_SOURCE_FILES_PROPERTIES(${QGIS_CORE_MOC_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations" )
IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND (CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo))
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/qgsexpression_texts.cpp PROPERTIES COMPILE_FLAGS "-O1")
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/qgsexpression_texts.cpp PROPERTIES COMPILE_FLAGS "-O1")
ENDIF ()
ENDIF(MSVC)

0 comments on commit b5c4d28

Please sign in to comment.
You can’t perform that action at this time.