Commit d58177e0 authored by Holger Jaekel's avatar Holger Jaekel Committed by Leo

testing/libkml: new aport

parent a8e64e72
From 77cf351a61f3683b74e07857ca77b5580d1cedf0 Mon Sep 17 00:00:00 2001
From: Sandro Mani <manisandro@gmail.com>
Date: Fri, 8 Apr 2016 23:21:26 +0200
Subject: [PATCH 2/4] Fix mistaken use of std::cerr instead of std::endl
Source: https://src.fedoraproject.org/rpms/libkml/tree/master
---
examples/engine/inlinestyles.cc | 8 ++++----
examples/engine/splitstyles.cc | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/examples/engine/inlinestyles.cc b/examples/engine/inlinestyles.cc
index 1cb4755..8ad1f57 100644
--- a/examples/engine/inlinestyles.cc
+++ b/examples/engine/inlinestyles.cc
@@ -35,20 +35,20 @@
bool InlineStyles(const char* input_filename, const char* output_filename) {
std::string kml_input;
if (!kmlbase::File::ReadFileToString(input_filename, &kml_input)) {
- std::cerr << "read failed: " << input_filename << std::cerr;
+ std::cerr << "read failed: " << input_filename << std::endl;
return false;
}
std::string errors;
kmldom::ElementPtr root = kmlengine::InlineStyles(kml_input, &errors);
if (!root) {
- std::cerr << "parse failed: " << input_filename << std::cerr;
- std::cerr << "parse failed: " << errors << std::cerr;
+ std::cerr << "parse failed: " << input_filename << std::endl;
+ std::cerr << "parse failed: " << errors << std::endl;
return false;
}
std::string kml_output = kmldom::SerializePretty(root);
if (!kmlbase::File::WriteStringToFile(kml_output, output_filename)) {
- std::cerr << "write failed: " << output_filename << std::cerr;
+ std::cerr << "write failed: " << output_filename << std::endl;
return false;
}
return true;
diff --git a/examples/engine/splitstyles.cc b/examples/engine/splitstyles.cc
index a3b190a..56203c9 100644
--- a/examples/engine/splitstyles.cc
+++ b/examples/engine/splitstyles.cc
@@ -35,20 +35,20 @@
bool SplitStyles(const char* input_filename, const char* output_filename) {
std::string kml_input;
if (!kmlbase::File::ReadFileToString(input_filename, &kml_input)) {
- std::cerr << "read failed: " << input_filename << std::cerr;
+ std::cerr << "read failed: " << input_filename << std::endl;
return false;
}
std::string errors;
kmldom::ElementPtr root = kmlengine::SplitStyles(kml_input, &errors);
if (!root) {
- std::cerr << "parse failed: " << input_filename << std::cerr;
- std::cerr << "parse failed: " << errors << std::cerr;
+ std::cerr << "parse failed: " << input_filename << std::endl;
+ std::cerr << "parse failed: " << errors << std::endl;
return false;
}
std::string kml_output = kmldom::SerializePretty(root);
if (!kmlbase::File::WriteStringToFile(kml_output, output_filename)) {
- std::cerr << "write failed: " << output_filename << std::cerr;
+ std::cerr << "write failed: " << output_filename << std::endl;
return false;
}
return true;
--
2.8.1
Author: Holger Jaekel <holger.jaekel@gmx.de>
Summary: Fix Python 2 syntax
----
--- a/src/swig/CMakeLists.txt
+++ b/src/swig/CMakeLists.txt
@@ -10,7 +10,7 @@ if(WITH_PYTHON)
if(NOT DEFINED PYTHON_INSTALL_DIR)
execute_process(COMMAND
- ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True)"
+ ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True))"
OUTPUT_VARIABLE PYTHON_INSTALL_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE )
endif(NOT DEFINED PYTHON_INSTALL_DIR)
From b728c0815edc06c826fb5be8cd25cbb7f3b816b3 Mon Sep 17 00:00:00 2001
From: Sandro Mani <manisandro@gmail.com>
Date: Fri, 8 Apr 2016 23:22:12 +0200
Subject: [PATCH 3/4] Fix python tests
Source: https://src.fedoraproject.org/rpms/libkml/tree/master
---
tests/swig/CMakeLists.txt | 6 ++++++
tests/swig/kmldom_test.py | 2 +-
tests/swig/kmlengine_test.py | 3 ++-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/tests/swig/CMakeLists.txt b/tests/swig/CMakeLists.txt
index 52e398e..5ba1cd1 100644
--- a/tests/swig/CMakeLists.txt
+++ b/tests/swig/CMakeLists.txt
@@ -1,12 +1,18 @@
if(WITH_PYTHON)
add_test(NAME test_python_kmlbase
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kmlbase_test.py)
+set_tests_properties(test_python_kmlbase
+ PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/swig:${CMAKE_BINARY_DIR}/lib")
add_test(NAME test_python_kmldom
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kmldom_test.py)
+set_tests_properties(test_python_kmldom
+ PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/swig:${CMAKE_BINARY_DIR}/lib")
add_test(NAME test_python_kmlengine
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kmlengine_test.py)
+set_tests_properties(test_python_kmlengine
+ PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/swig:${CMAKE_BINARY_DIR}/lib")
endif()
if(WITH_JAVA)
diff --git a/tests/swig/kmldom_test.py b/tests/swig/kmldom_test.py
index e18c5a7..4762d6e 100644
--- a/tests/swig/kmldom_test.py
+++ b/tests/swig/kmldom_test.py
@@ -753,7 +753,7 @@ def TestColorStyle(colorstyle):
color = kmlbase.Color32(0xf0f0c80f)
colorstyle.set_color(color)
assert colorstyle.has_color()
- assert color == colorstyle.get_color()
+ assert color.to_string_argb() == colorstyle.get_color().to_string_argb()
# Clear <color> and verify has_
colorstyle.clear_color()
assert not colorstyle.has_color()
diff --git a/tests/swig/kmlengine_test.py b/tests/swig/kmlengine_test.py
index 8850221..7eb3c09 100644
--- a/tests/swig/kmlengine_test.py
+++ b/tests/swig/kmlengine_test.py
@@ -32,6 +32,7 @@ This file contains unit tests for the KML Engine Python SWIG bindings.
import unittest
import kmldom
import kmlengine
+import os
# These VerySimple tests really only verify that the function/class exists.
@@ -239,7 +240,7 @@ class BasicKmlFileSerializeToStringTestCase(unittest.TestCase):
class BasicKmzFileTestCase(unittest.TestCase):
def runTest(self):
- kmz_filepath = '../../testdata/kmz/model-macky.kmz'
+ kmz_filepath = os.path.join(os.path.dirname(__file__), '../../testdata/kmz/model-macky.kmz')
kmzfile = kmlengine.KmzFile.OpenFromFile(kmz_filepath)
assert kmzfile
(ok, kml) = kmzfile.ReadKml()
--
2.8.1
Author: Holger Jaekel <holger.jaekel@gmx.de>
Summary: Don't install bytecompiled python files
----
--- a/src/swig/CMakeLists.txt
+++ b/src/swig/CMakeLists.txt
@@ -36,7 +36,6 @@ if(WITH_PYTHON)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}.py
- ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}.pyc
DESTINATION ${PYTHON_INSTALL_DIR})
endforeach()
endif(WITH_PYTHON)
# Contributor: Holger Jaekel <holger.jaekel@gmx.de>
# Maintainer: Holger Jaekel <holger.jaekel@gmx.de>
pkgname=libkml
pkgver=1.3.0
pkgrel=0
_jdkver=11
pkgdesc="Reference implementation of OGC KML 2.2"
url="https://github.com/libkml/libkml"
arch="all !x86 !armhf !armv7" # openjdk is not yet available on 32 bit arches
license="BSD-3-Clause"
makedepends="
boost-dev
cmake
curl-dev
expat-dev
gtest-dev
minizip-dev
openjdk$_jdkver-jdk
python3-dev
swig
uriparser-dev
zlib-dev
"
subpackages="
$pkgname-dev
py3-$pkgname:py
java-$pkgname:java
"
source="
$pkgname-$pkgver.tar.gz::https://github.com/libkml/libkml/archive/$pkgver.tar.gz
10-fix-mistaken-use-of-std-cerr-instead-of-std-endl.patch
20-fix-python3.patch
30-fix-python-tests.patch
40-dont-bytecompile.patch
"
build() {
cmake . \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_SWIG=ON \
-DWITH_PYTHON=ON \
-DWITH_JAVA=ON \
-DJava_JAR_EXECUTABLE=/usr/lib/jvm/java-$_jdkver-openjdk/bin/jar \
-DJava_JAVAC_EXECUTABLE=/usr/lib/jvm/java-$_jdkver-openjdk/bin/javac \
-DJava_JAVADOC_EXECUTABLE=/usr/lib/jvm/java-$_jdkver-openjdk/bin/javadoc \
-DJAVA_JVM_LIBRARY=/usr/lib/jvm/java-$_jdkver-openjdk/lib/server/libjvm.so \
-DBUILD_TESTING=ON \
-DBUILD_EXAMPLES=OFF
make
}
py() {
pkgdesc="Python 3 bindings for $pkgname"
mkdir -p $subpkgdir/usr/lib/
mv $pkgdir/usr/lib/python3.? $subpkgdir/usr/lib/
}
java() {
pkgdesc="Java $_jdkver bindings for $pkgname"
mkdir -p $subpkgdir/usr/lib/
mkdir -p $subpkddir/usr/share/
mv $pkgdir/usr/lib/jni $subpkgdir/usr/lib/jni
mv $pkgdir/usr/share $subpkgdir/usr/share
}
package() {
make DESTDIR="$pkgdir" install
}
check() {
ctest -E test_java_kmlbase
}
sha512sums="aa48158103d3af764bf98c1fb4cf3e1356b9cc6c8e79d80b96850916f0a8ccb1dac3a46427735dd0bf20647daa047d10e722ac3da2a214d4c1559bf6d5d7c853 libkml-1.3.0.tar.gz
8fe7bd1aeee0663ade115cbb7f63b528d4a919db6e04095c0222b1a9e32a9b2b04deacd15f3224d2146b0943086af205c179bf5638c9f5562b0977aad3ba65fe 10-fix-mistaken-use-of-std-cerr-instead-of-std-endl.patch
a588a5f86d31f3eeb47d6d2c2281a7f518730e4247847e9dae093ca7f3006e27a4b4ca4e2e003ce31ef72f83096f5cfee3b3f2fb536934f64987cecb791ce12b 20-fix-python3.patch
c29d1e9e00fe5000a9b0e7e13bf4c196c61c47459724d5c20a22714504c1497175bca6723759d02be24ac314f6381f4ff2f1245bd2e2c2b2b344f959b50a7978 30-fix-python-tests.patch
a81cd6b09041060aff7d999280e0d7ea4bb6c819b510afd210ad097e480f444f0f2c779fe1cb2f5ecf0976f27daf66df62a88825e893bb6126909acfd0d74f65 40-dont-bytecompile.patch"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment