Merge lp:~pete-woods/cmake-extras/add-intltool-filter-option into lp:cmake-extras

Proposed by Pete Woods
Status: Merged
Approved by: Pete Woods
Approved revision: 64
Merged at revision: 60
Proposed branch: lp:~pete-woods/cmake-extras/add-intltool-filter-option
Merge into: lp:cmake-extras
Prerequisite: lp:~pete-woods/cmake-extras/add-include-checker-macros
Diff against target: 108 lines (+35/-5)
5 files modified
debian/changelog (+1/-0)
debian/tests/intltool (+5/-3)
examples/intltool-demo/po/CMakeLists.txt (+1/-0)
examples/intltool-demo/test/test.cpp (+1/-0)
src/Intltool/IntltoolConfig.cmake (+27/-2)
To merge this branch: bzr merge lp:~pete-woods/cmake-extras/add-intltool-filter-option
Reviewer Review Type Date Requested Status
dobey (community) Approve
Review via email: mp+316732@code.launchpad.net

Commit message

Add FILTER argument to intltool macros.

Description of the change

Add FILTER argument to intltool macros.

To post a comment you must log in.
Revision history for this message
dobey (dobey) wrote :

Nice.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2017-02-09 12:39:48 +0000
+++ debian/changelog 2017-02-09 12:39:48 +0000
@@ -1,6 +1,7 @@
1cmake-extras (1.1-0ubuntu1) UNRELEASED; urgency=medium1cmake-extras (1.1-0ubuntu1) UNRELEASED; urgency=medium
22
3 * Add IncludeChecker macro.3 * Add IncludeChecker macro.
4 * Add FILTER argument to intltool macros.
45
5 -- Pete <pete.woods@canonical.com> Wed, 08 Feb 2017 15:02:38 +00006 -- Pete <pete.woods@canonical.com> Wed, 08 Feb 2017 15:02:38 +0000
67
78
=== modified file 'debian/tests/intltool'
--- debian/tests/intltool 2017-01-09 10:35:11 +0000
+++ debian/tests/intltool 2017-02-09 12:39:48 +0000
@@ -38,18 +38,20 @@
38 retval=$?38 retval=$?
39 set -e39 set -e
4040
41 if [ ${retval} -eq 0 ]; then41 expected=${2:-0}
42
43 if [ ${retval} -eq ${expected} ]; then
42 echo "OK"44 echo "OK"
43 else45 else
44 echo "FAILED"46 echo "FAILED"
47 return 1
45 fi48 fi
46
47 return ${retval}
48}49}
4950
50check_potfile 'msgid "FooApp"'51check_potfile 'msgid "FooApp"'
51check_potfile 'msgid "FooApp is really great"'52check_potfile 'msgid "FooApp is really great"'
52check_potfile 'msgid "Hello FooApp!"'53check_potfile 'msgid "Hello FooApp!"'
54check_potfile 'msgid "this translation should be ignored"' 1
5355
54# This binary is a test suite that will exit this outer BASH script if it fails56# This binary is a test suite that will exit this outer BASH script if it fails
55G_MESSAGES_DEBUG=all "${installdir}/usr/bin/fooapp"57G_MESSAGES_DEBUG=all "${installdir}/usr/bin/fooapp"
5658
=== modified file 'examples/intltool-demo/po/CMakeLists.txt'
--- examples/intltool-demo/po/CMakeLists.txt 2017-01-09 10:35:11 +0000
+++ examples/intltool-demo/po/CMakeLists.txt 2017-02-09 12:39:48 +0000
@@ -6,6 +6,7 @@
6 POTFILES_TEMPLATE "POTFILES.in.in"6 POTFILES_TEMPLATE "POTFILES.in.in"
7 GETTEXT_PACKAGE ${GETTEXT_PACKAGE}7 GETTEXT_PACKAGE ${GETTEXT_PACKAGE}
8 COPYRIGHT_HOLDER "Foocorp Ltd."8 COPYRIGHT_HOLDER "Foocorp Ltd."
9 FILTER ".*test.*"
9)10)
1011
11intltool_install_translations(12intltool_install_translations(
1213
=== added directory 'examples/intltool-demo/test'
=== added file 'examples/intltool-demo/test/test.cpp'
--- examples/intltool-demo/test/test.cpp 1970-01-01 00:00:00 +0000
+++ examples/intltool-demo/test/test.cpp 2017-02-09 12:39:48 +0000
@@ -0,0 +1,1 @@
1_("this translation should be ignored")
02
=== modified file 'src/Intltool/IntltoolConfig.cmake'
--- src/Intltool/IntltoolConfig.cmake 2016-12-02 05:58:34 +0000
+++ src/Intltool/IntltoolConfig.cmake 2017-02-09 12:39:48 +0000
@@ -155,10 +155,32 @@
155 set(${OUTPUT} "${_TMP}" PARENT_SCOPE)155 set(${OUTPUT} "${_TMP}" PARENT_SCOPE)
156endfunction()156endfunction()
157157
158function(_INTLTOOL_LIST_FILTER INPUT OUTPUT)
159 set(_multiValueArgs EXPRESSIONS)
160 cmake_parse_arguments(_ARG "" "" "${_multiValueArgs}" ${ARGN})
161
162 if(_ARG_EXPRESSIONS)
163 set(_TMP "")
164 foreach(_ITEM ${${INPUT}})
165 foreach(_REGEX ${_ARG_EXPRESSIONS})
166 if("${_ITEM}" MATCHES "${_REGEX}")
167 else()
168 list(APPEND _TMP "${_ITEM}")
169 endif()
170 endforeach()
171 endforeach()
172 set(${OUTPUT} "${_TMP}" PARENT_SCOPE)
173 unset(_TMP)
174 else()
175 set(${OUTPUT} "${${INPUT}}" PARENT_SCOPE)
176 endif()
177endfunction()
178
179
158function(INTLTOOL_UPDATE_POTFILE)180function(INTLTOOL_UPDATE_POTFILE)
159 set(_options ALL UBUNTU_SDK_DEFAULTS)181 set(_options ALL UBUNTU_SDK_DEFAULTS)
160 set(_oneValueArgs COPYRIGHT_HOLDER GETTEXT_PACKAGE OUTPUT_FILE PO_DIRECTORY POTFILES_TEMPLATE)182 set(_oneValueArgs COPYRIGHT_HOLDER GETTEXT_PACKAGE OUTPUT_FILE PO_DIRECTORY POTFILES_TEMPLATE)
161 set(_multiValueArgs KEYWORDS FILE_GLOBS)183 set(_multiValueArgs KEYWORDS FILE_GLOBS FILTER)
162184
163 cmake_parse_arguments(_ARG "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})185 cmake_parse_arguments(_ARG "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
164 186
@@ -213,7 +235,10 @@
213 )235 )
214236
215 # We don't want to include paths from the binary directory237 # We don't want to include paths from the binary directory
216 _intltool_exclude_path(_SOURCE_FILES ${CMAKE_BINARY_DIR} _FILTERED_SOURCE_FILES)238 _intltool_exclude_path(_SOURCE_FILES ${CMAKE_BINARY_DIR} _FILTERED_SOURCE_FILES_TMP)
239
240 # Remove any paths from the filter expressions
241 _intltool_list_filter(_FILTERED_SOURCE_FILES_TMP _FILTERED_SOURCE_FILES EXPRESSIONS ${_ARG_FILTER})
217242
218 # Build the text to substitute into the POTFILES.in243 # Build the text to substitute into the POTFILES.in
219 _intltool_join_list(_FILTERED_SOURCE_FILES "\n" GENERATED_POTFILES)244 _intltool_join_list(_FILTERED_SOURCE_FILES "\n" GENERATED_POTFILES)

Subscribers

People subscribed via source and target branches

to all changes: