Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 b5c4d28
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 17 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions debian/rules
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions scripts/astyle.sh
Expand Up @@ -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"
;;

Expand Down
17 changes: 15 additions & 2 deletions scripts/update_ts.sh
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
15 changes: 13 additions & 2 deletions scripts/update_ts_files.sh
Expand Up @@ -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} \
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand Down
16 changes: 9 additions & 7 deletions src/core/CMakeLists.txt
Expand Up @@ -85,7 +85,6 @@ SET(QGIS_CORE_SRCS
qgscolorschemeregistry.cpp
qgsconditionalstyle.cpp
qgscontexthelp.cpp
qgscontexthelp_texts.cpp
qgscoordinatereferencesystem.cpp
qgscoordinatetransform.cpp
qgscoordinateutils.cpp
Expand All @@ -106,7 +105,6 @@ SET(QGIS_CORE_SRCS
qgsexpression.cpp
qgsexpressioncontext.cpp
qgsexpressionfieldbuffer.cpp
qgsexpression_texts.cpp
qgsfeature.cpp
qgsfeatureiterator.cpp
qgsfeaturerequest.cpp
Expand Down Expand Up @@ -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}
)
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit b5c4d28

Please sign in to comment.