Skip to content

Commit

Permalink
Fix compilation with python3 and add python3 to CI
Browse files Browse the repository at this point in the history
Fix #1213
  • Loading branch information
Pro committed Sep 16, 2017
1 parent 56bfe1c commit f94a628
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions tools/generate_datatypes.py
Expand Up @@ -448,9 +448,9 @@ def iter_types(v):
else:
l = list(v.values())
if len(selected_types) > 0:
l = filter(lambda t: t.name in selected_types, l)
l = list(filter(lambda t: t.name in selected_types, l))
if args.no_builtin:
l = filter(lambda t: type(t) != BuiltinType, l)
l = list(filter(lambda t: type(t) != BuiltinType, l))
return l

################
Expand Down
6 changes: 2 additions & 4 deletions tools/generate_statuscode_descriptions.py
Expand Up @@ -20,7 +20,7 @@
input_str = f.read()
f.close()
input_str = input_str.replace('\r','')
rows = map(lambda x:tuple(x.split(',')), input_str.split('\n'))
rows = list(map(lambda x:tuple(x.split(',')), input_str.split('\n')))

fc = open(args.outfile + ".c",'w')
def printc(string):
Expand All @@ -36,9 +36,7 @@ def printc(string):
#include "ua_types.h"''')

count = 2
for row in rows:
count += 1
count = 2 + len(rows)

printc('''
Expand Down
16 changes: 13 additions & 3 deletions tools/travis/travis_linux_script.sh
Expand Up @@ -193,12 +193,22 @@ else
cd .. && rm build -rf
echo -en 'travis_fold:end:script.build.multithread\\r'

echo -e "\r\n== Debug build and unit tests (64 bit) ==" && echo -en 'travis_fold:start:script.build.unit_test_valgrind\\r'
echo -e "\r\n== Debug build and unit tests (64 bit, python 2) ==" && echo -en 'travis_fold:start:script.build.unit_test_valgrind_python2\\r'
mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DUA_BUILD_EXAMPLES=ON -DUA_ENABLE_DISCOVERY=ON -DUA_ENABLE_DISCOVERY_MULTICAST=ON -DUA_BUILD_UNIT_TESTS=ON -DUA_ENABLE_COVERAGE=ON -DUA_ENABLE_VALGRIND_UNIT_TESTS=ON ..
# Force to use python2 to test compilation with python2
cmake -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python2 -DCMAKE_BUILD_TYPE=Debug -DUA_BUILD_EXAMPLES=ON -DUA_ENABLE_DISCOVERY=ON -DUA_ENABLE_DISCOVERY_MULTICAST=ON -DUA_BUILD_UNIT_TESTS=ON -DUA_ENABLE_COVERAGE=ON -DUA_ENABLE_VALGRIND_UNIT_TESTS=ON ..
make -j && make test ARGS="-V"
if [ $? -ne 0 ] ; then exit 1 ; fi
echo -en 'travis_fold:end:script.build.unit_test_valgrind\\r'
cd .. && rm build -rf
echo -en 'travis_fold:end:script.build.unit_test_valgrind_python2\\r'

echo -e "\r\n== Debug build and unit tests (64 bit, python 3) ==" && echo -en 'travis_fold:start:script.build.unit_test_valgrind_python3\\r'
mkdir -p build && cd build
# Force to use python3 to test compilation with python3
cmake -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3 -DCMAKE_BUILD_TYPE=Debug -DUA_BUILD_EXAMPLES=ON -DUA_ENABLE_DISCOVERY=ON -DUA_ENABLE_DISCOVERY_MULTICAST=ON -DUA_BUILD_UNIT_TESTS=ON -DUA_ENABLE_COVERAGE=ON -DUA_ENABLE_VALGRIND_UNIT_TESTS=ON ..
make -j && make test ARGS="-V"
if [ $? -ne 0 ] ; then exit 1 ; fi
echo -en 'travis_fold:end:script.build.unit_test_valgrind_python3\\r'

# only run coveralls on main repo, otherwise it fails uploading the files
echo -e "\r\n== -> Current repo: ${TRAVIS_REPO_SLUG} =="
Expand Down

0 comments on commit f94a628

Please sign in to comment.