diff --git a/Engine/CMakeLists.txt b/Engine/CMakeLists.txt index 256dcfd1d8..8269ae11d0 100644 --- a/Engine/CMakeLists.txt +++ b/Engine/CMakeLists.txt @@ -28,8 +28,12 @@ set(PYENGINE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Qt${QT_VERSION_MAJOR}) set(PYENGINE_INCLUDE_DIRS ${PYSIDE_INCLUDE_DIRS} ${PYSIDE_INCLUDE_DIRS}/QtCore) list(APPEND PYENGINE_INCLUDE_DIRS ${QTCORE_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}) list(TRANSFORM PYENGINE_INCLUDE_DIRS PREPEND "-I" OUTPUT_VARIABLE PYENGINE_INCS) -set(PYENGINE_HEADER PySide2_Engine_Python.h) -set(POST_SHIBOKEN ../tools/utils/runPostShiboken2.sh) + +if(NATRON_QT6) + set(PYENGINE_HEADER PySide6_Engine_Python.h) +else() + set(PYENGINE_HEADER PySide2_Engine_Python.h) +endif() set(shiboken_args "-std=c++17" "--enable-parent-ctor-heuristic" "--use-isnull-as-nb_nonzero" @@ -43,9 +47,9 @@ execute_process(COMMAND ${Python3_EXECUTABLE} ../tools/utils/sourceList.py types OUTPUT_VARIABLE PyEngine_SOURCES) set_property(SOURCE ${PyEngine_SOURCES} PROPERTY SKIP_AUTOGEN ON) add_custom_command(OUTPUT ${PyEngine_SOURCES} - COMMAND Shiboken2::shiboken2 ${shiboken_args} - COMMAND bash ${POST_SHIBOKEN} ${PYENGINE_OUT}/NatronEngine natronengine - DEPENDS ${PYENGINE_HEADER} ${NatronEngine_HEADERS} ${POST_SHIBOKEN} typesystem_engine.xml + COMMAND $ ${shiboken_args} + COMMAND ${Python3_EXECUTABLE} ../tools/utils/sourceCleanup.py typesystem_engine.xml ${PYENGINE_OUT} + DEPENDS ${SHIBOKEN_EXE} ${PYENGINE_HEADER} ${NatronEngine_HEADERS} ../tools/utils/sourceCleanup.py typesystem_engine.xml WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) if(UNIX AND NOT APPLE) diff --git a/Engine/PySide6_Engine_Python.h b/Engine/PySide6_Engine_Python.h new file mode 100644 index 0000000000..279d28109d --- /dev/null +++ b/Engine/PySide6_Engine_Python.h @@ -0,0 +1,39 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * This file is part of Natron , + * (C) 2018-2024 The Natron developers + * (C) 2013-2018 INRIA and Alexandre Gauthier-Foichat + * + * Natron is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Natron is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Natron. If not, see + * ***** END LICENSE BLOCK ***** */ + + +#ifndef PYSIDE6_ENGINE_PYTHON_H +#define PYSIDE6_ENGINE_PYTHON_H + +// Defined for shiboken6-specific tweaks +#define SBK6_RUN + +#ifndef BOOST_SERIALIZATION_VERSION_HPP +#define BOOST_SERIALIZATION_VERSION_HPP +#define BOOST_CLASS_VERSION(T, N) +#endif /* BOOST_SERIALIZATION_VERSION_HPP */ + +#ifndef BOOST_SERIALIZATION_SPLIT_MEMBER_HPP +#define BOOST_SERIALIZATION_SPLIT_MEMBER_HPP +#define BOOST_SERIALIZATION_SPLIT_MEMBER() +#endif /* BOOST_SERIALIZATION_SPLIT_MEMBER_HPP */ + +#include "Pyside_Engine_Python.h" + +#endif // PYSIDE6_ENGINE_PYTHON_H diff --git a/Engine/Pyside_Engine_Python.h b/Engine/Pyside_Engine_Python.h index 333422aebd..ea70319564 100644 --- a/Engine/Pyside_Engine_Python.h +++ b/Engine/Pyside_Engine_Python.h @@ -39,7 +39,7 @@ #ifdef SBK2_RUN #include #else -#include +#include #endif #include //Global diff --git a/Engine/typesystem_engine.xml b/Engine/typesystem_engine.xml index 670e6a85bf..7aa3a1ea69 100644 --- a/Engine/typesystem_engine.xml +++ b/Engine/typesystem_engine.xml @@ -1856,6 +1856,10 @@ + + NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING + + diff --git a/Gui/CMakeLists.txt b/Gui/CMakeLists.txt index 08b3ceeb08..56ea6e6205 100644 --- a/Gui/CMakeLists.txt +++ b/Gui/CMakeLists.txt @@ -28,11 +28,12 @@ list(APPEND PYGUI_INCLUDE_DIRS ${PYSIDE_INCLUDE_DIRS} ${PYSIDE_INCLUDE_DIRS}/QtC list(APPEND PYGUI_INCLUDE_DIRS ${QTCORE_INCLUDE_DIRS} ${QTGUI_INCLUDE_DIRS} ${QTWIDGETS_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}) list(TRANSFORM PYGUI_INCLUDE_DIRS PREPEND "-I" OUTPUT_VARIABLE PYGUI_INCS) -set(PYGUI_HEADER PySide2_Gui_Python.h) -set(POST_SHIBOKEN ../tools/utils/runPostShiboken2.sh) if(NATRON_QT6) set(QT_OPENGLWIDGETS Qt::OpenGLWidgets) + set(PYGUI_HEADER PySide6_Gui_Python.h) +else() + set(PYGUI_HEADER PySide2_Gui_Python.h) endif() set(shiboken_args @@ -47,9 +48,9 @@ execute_process(COMMAND ${Python3_EXECUTABLE} ../tools/utils/sourceList.py types OUTPUT_VARIABLE PyGui_SOURCES) set_property(SOURCE ${PyGui_SOURCES} PROPERTY SKIP_AUTOGEN ON) add_custom_command(OUTPUT ${PyGui_SOURCES} - COMMAND Shiboken2::shiboken2 ${shiboken_args} - COMMAND bash ${POST_SHIBOKEN} ${PYGUI_OUT}/NatronGui natrongui - DEPENDS ${PYGUI_HEADER} ${NatronEngine_HEADERS} ${NatronGui_HEADERS} ${POST_SHIBOKEN} typesystem_natronGui.xml + COMMAND $ ${shiboken_args} + COMMAND ${Python3_EXECUTABLE} ../tools/utils/sourceCleanup.py typesystem_natronGui.xml ${PYGUI_OUT} + DEPENDS ${SHIBOKEN_EXE} ${PYGUI_HEADER} NatronEngine ${NatronGui_HEADERS} ../tools/utils/sourceCleanup.py typesystem_natronGui.xml WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) if(APPLE) diff --git a/Gui/PySide6_Gui_Python.h b/Gui/PySide6_Gui_Python.h new file mode 100644 index 0000000000..ec6965d9c2 --- /dev/null +++ b/Gui/PySide6_Gui_Python.h @@ -0,0 +1,39 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * This file is part of Natron , + * (C) 2018-2024 The Natron developers + * (C) 2013-2018 INRIA and Alexandre Gauthier-Foichat + * + * Natron is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Natron is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Natron. If not, see + * ***** END LICENSE BLOCK ***** */ + + +#ifndef PYSIDE6_GUI_PYTHON_H +#define PYSIDE6_GUI_PYTHON_H + +// Defined for shiboken6-specific tweaks +#define SBK6_RUN + +#ifndef BOOST_SERIALIZATION_VERSION_HPP +#define BOOST_SERIALIZATION_VERSION_HPP +#define BOOST_CLASS_VERSION(T, N) +#endif /* BOOST_SERIALIZATION_VERSION_HPP */ + +#ifndef BOOST_SERIALIZATION_SPLIT_MEMBER_HPP +#define BOOST_SERIALIZATION_SPLIT_MEMBER_HPP +#define BOOST_SERIALIZATION_SPLIT_MEMBER() +#endif /* BOOST_SERIALIZATION_SPLIT_MEMBER_HPP */ + +#include "Pyside_Gui_Python.h" + +#endif // PYSIDE6_GUI_PYTHON_H diff --git a/Gui/Pyside_Gui_Python.h b/Gui/Pyside_Gui_Python.h index e29904ff64..2d01249348 100644 --- a/Gui/Pyside_Gui_Python.h +++ b/Gui/Pyside_Gui_Python.h @@ -34,7 +34,7 @@ #ifdef SBK2_RUN #include #else -#include +#include #endif #include diff --git a/Gui/typesystem_natronGui.xml b/Gui/typesystem_natronGui.xml index c612ff9e8d..727c5cb480 100644 --- a/Gui/typesystem_natronGui.xml +++ b/Gui/typesystem_natronGui.xml @@ -211,4 +211,8 @@ + + + NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING + diff --git a/tools/utils/runPostShiboken.bat b/tools/utils/runPostShiboken.bat deleted file mode 100644 index 45edf4351a..0000000000 --- a/tools/utils/runPostShiboken.bat +++ /dev/null @@ -1,31 +0,0 @@ -:: ***** BEGIN LICENSE BLOCK ***** -:: This file is part of Natron , -:: Copyright (C) 2016 INRIA and Alexandre Gauthier -:: -:: Natron is free software: you can redistribute it and/or modify -:: it under the terms of the GNU General Public License as published by -:: the Free Software Foundation; either version 2 of the License, or -:: (at your option) any later version. -:: -:: Natron is distributed in the hope that it will be useful, -:: but WITHOUT ANY WARRANTY; without even the implied warranty of -:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -:: GNU General Public License for more details. -:: -:: You should have received a copy of the GNU General Public License -:: along with Natron. If not, see -:: ***** END LICENSE BLOCK ***** - -:: To be run after shiboken to fix errors - -sed "//d" -i Engine/NatronEngine/*.cpp -sed "//d" -i Gui/NatronGui/*.cpp -sed -e "/SbkPySide_QtCoreTypes;/d" -i Gui/NatronGui/natrongui_module_wrapper.cpp -sed -e "/SbkPySide_QtCoreTypeConverters;/d" -i Gui/NatronGui/natrongui_module_wrapper.cpp -sed -e "/SbkNatronEngineTypes;/d" -i Gui/NatronGui/natrongui_module_wrapper.cpp -sed -e "/SbkNatronEngineTypeConverters;/d" -i Gui/NatronGui/natrongui_module_wrapper.cpp -sed -e "s/cleanTypesAttributes/cleanGuiTypesAttributes/g" -i Gui/NatronGui/natrongui_module_wrapper.cpp - - -rm sed* -rm */sed* diff --git a/tools/utils/runPostShiboken.sh b/tools/utils/runPostShiboken.sh deleted file mode 100755 index e27d7d50f7..0000000000 --- a/tools/utils/runPostShiboken.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/bash -# ***** BEGIN LICENSE BLOCK ***** -# This file is part of Natron , -# Copyright (C) 2016 INRIA and Alexandre Gauthier -# -# Natron is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# Natron is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Natron. If not, see -# ***** END LICENSE BLOCK ***** - -# exit if a command returns an error status -set -e - -if [ "$#" -ne 2 ]; then - echo "usage: " 2>&1 - exit 1 -fi - -wrapper_dir="$1" -wrapper_name=$2 -wrapper_source=${wrapper_name}_module_wrapper.cpp -wrapper_header=${wrapper_name}_python.h - -# To be run after shiboken to fix errors - -sed -e '//d' -i'.bak' "$wrapper_dir"/*.cpp -sed -e '//d' -i'.bak' "$wrapper_dir"/*.cpp -sed -e '/Py_BEGIN_ALLOW_THREADS/d' -i'.bak' "$wrapper_dir"/*.cpp -sed -e '/Py_BEGIN_ALLOW_THREADS/d' -i'.bak' "$wrapper_dir"/*.cpp -sed -e '/Py_END_ALLOW_THREADS/d' -i'.bak' "$wrapper_dir"/*.cpp -sed -e '/Py_END_ALLOW_THREADS/d' -i'.bak' "$wrapper_dir"/*.cpp -if [ "$wrapper_name" = "natrongui" ]; then - $SED -e "/SbkPySide_QtCoreTypes;/d" -i'.bak' "$wrapper_dir/$wrapper_source" - $SED -e "/SbkPySide_QtCoreTypeConverters;/d" -i'.bak' "$wrapper_dir/$wrapper_source" - $SED -e '/SbkNatronEngineTypes;/d' -i'.bak' "$wrapper_dir/$wrapper_source" - $SED -e '/SbkNatronEngineTypeConverters;/d' -i'.bak' "$wrapper_dir/$wrapper_source" - $SED -e 's/cleanTypesAttributes/cleanGuiTypesAttributes/g' -i'.bak' "$wrapper_dir/$wrapper_source" -fi - -# fix warnings -sed -e 's@^#include $@#include "Global/Macros.h"\ -// clang-format off\ -CLANG_DIAG_OFF(mismatched-tags)\ -GCC_DIAG_OFF(unused-parameter)\ -GCC_DIAG_OFF(missing-field-initializers)\ -GCC_DIAG_OFF(missing-declarations)\ -GCC_DIAG_OFF(uninitialized)\ -GCC_DIAG_UNUSED_LOCAL_TYPEDEFS_OFF\ -// clang-format on\ -#include // produces many warnings@' -i'.bak' "$wrapper_dir"/*.cpp - -sed -e 's@// Extra includes@// Extra includes\ -NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING@' -i'.bak' "$wrapper_dir"/*.cpp - -# replace NATRON_NAMESPACE with Natron for enums with flags (e.g. StandardButtonEnum) -sed -e 's@"NatronEngine\.NATRON_NAMESPACE@"NatronEngine.Natron@g' -e 's@, NatronEngine\.NATRON_NAMESPACE@, NatronEngine.Natron@g' -e 's@"NatronGui\.NATRON_NAMESPACE@"NatronGui.Natron@g' -e 's@"NATRON_NAMESPACE@"Natron@g' -i'.bak' "$wrapper_dir"/*_wrapper.cpp - -# re-add the Natron namespace -#sed -e 's@" ::\([^s][^t][^d]\)@ NATRON_NAMESPACE::\1@g' -i'.bak' Engine/NatronEngine/*.cpp Engine/NatronEngine/*.h Gui/NatronGui/*.cpp Gui/NatronGui/*.h - -sed -e 's@SbkType< ::@SbkType$@CLANG_DIAG_OFF(header-guard)\ -#include // has wrong header guards in pyside 1.2.2@' -i'.bak' "$wrapper_dir"/*.cpp - -sed -e 's@^#include $@// clang-format off\ -CLANG_DIAG_OFF(deprecated)\ -CLANG_DIAG_OFF(uninitialized)\ -CLANG_DIAG_OFF(keyword-macro)\ -#include // produces warnings\ -CLANG_DIAG_ON(deprecated)\ -CLANG_DIAG_ON(uninitialized)\ -CLANG_DIAG_ON(keyword-macro)\ -// clang-format on@' -i'.bak' "$wrapper_dir"/*.cpp "$wrapper_dir"/*.h - -sed -e 's@^#include $@// clang-format off\ -CLANG_DIAG_OFF(deprecated)\ -CLANG_DIAG_OFF(uninitialized)\ -CLANG_DIAG_OFF(keyword-macro)\ -#include // produces warnings\ -CLANG_DIAG_ON(deprecated)\ -CLANG_DIAG_ON(uninitialized)\ -CLANG_DIAG_ON(keyword-macro)\ -// clang-format on@' -i'.bak' "$wrapper_dir"/*.cpp "$wrapper_dir"/*.h - -# clean up -rm "$wrapper_dir"/*.bak diff --git a/tools/utils/runPostShiboken2.sh b/tools/utils/runPostShiboken2.sh deleted file mode 100755 index 349970b45e..0000000000 --- a/tools/utils/runPostShiboken2.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/bash -# ***** BEGIN LICENSE BLOCK ***** -# This file is part of Natron , -# Copyright (C) 2016 INRIA and Alexandre Gauthier -# -# Natron is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# Natron is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Natron. If not, see -# ***** END LICENSE BLOCK ***** - -# exit if a command returns an error status -set -e - -if [ "$#" -ne 2 ]; then - echo "usage: " 2>&1 - exit 1 -fi - -wrapper_dir="$1" -wrapper_name="$2" -wrapper_source=${wrapper_name}_module_wrapper.cpp -wrapper_header=${wrapper_name}_python.h - -SED="sed" -if [ "$(uname)" = "Darwin" ]; then - # this script uses the sed cammand "T;", which is a GNU extension - SED=gsed - path_to_sed="$(which $SED)" - if [ ! -x "$path_to_sed" ] ; then - echo "$SED is required but not available; please install it:" - echo "- 'brew install gnu-sed' on Homebrew," - echo "- 'sudo port install gsed' on MacPorts." - exit 1 - fi -fi - -# To be run after shiboken to fix errors - -if [ "$wrapper_name" = "natrongui" ]; then - $SED -e "/SbkPySide2_QtCoreTypes;/d" -i'.bak' "$wrapper_dir/$wrapper_source" - $SED -e "/SbkPySide2_QtCoreTypeConverters;/d" -i'.bak' "$wrapper_dir/$wrapper_source" - $SED -e '/SbkNatronEngineTypes;/d' -i'.bak' "$wrapper_dir/$wrapper_source" - $SED -e '/SbkNatronEngineTypeConverters;/d' -i'.bak' "$wrapper_dir/$wrapper_source" - $SED -e 's/cleanTypesAttributes/cleanGuiTypesAttributes/g' -i'.bak' "$wrapper_dir/$wrapper_source" -fi - -# fix warnings -$SED -e 's@^#include $@#include "Global/Macros.h"\ -// clang-format off\ -CLANG_DIAG_OFF(mismatched-tags)\ -GCC_DIAG_OFF(unused-parameter)\ -GCC_DIAG_OFF(missing-field-initializers)\ -GCC_DIAG_OFF(missing-declarations)\ -GCC_DIAG_OFF(uninitialized)\ -GCC_DIAG_UNUSED_LOCAL_TYPEDEFS_OFF\ -// clang-format on\ -#include \ -#include // produces many warnings@' -i'.bak' "$wrapper_dir"/*.cpp - -$SED -e 's@// inner classes@// inner classes\ -NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING@' -i'.bak' "$wrapper_dir"/*.cpp -$SED -e 's@// Extra includes@// Extra includes\ -NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING@' -i'.bak' "$wrapper_dir/$wrapper_source" - -# replace NATRON_NAMESPACE with Natron for enums with flags (e.g. StandardButtonEnum) -$SED -e 's@"1:NatronEngine\.NATRON_NAMESPACE@"1:NatronEngine.Natron@g' -e 's@, NatronEngine\.NATRON_NAMESPACE@, NatronEngine.Natron@g' -e 's@"1:NatronGui\.NATRON_NAMESPACE@"NatronGui.Natron@g' -e 's@"NATRON_NAMESPACE@"Natron@g' -i'.bak' "$wrapper_dir"/*_wrapper.cpp - -# re-add the Natron namespace -#sed -e 's@" ::\([^s][^t][^d]\)@ NATRON_NAMESPACE::\1@g' -i'.bak' Engine/Qt5/NatronEngine/*.cpp Engine/Qt5/NatronEngine/*.h Gui/Qt5/NatronGui/*.cpp Gui/Qt5/NatronGui/*.h - -$SED -e 's@SbkType< ::@SbkType$@CLANG_DIAG_OFF(header-guard)\ -#include // has wrong header guards in pyside 1.2.2@' -i'.bak' "$wrapper_dir"/*.cpp - -$SED -e 's@^#include $@CLANG_DIAG_OFF(deprecated)\ -CLANG_DIAG_OFF(uninitialized)\ -CLANG_DIAG_OFF(keyword-macro)\ -#include // produces warnings\ -CLANG_DIAG_ON(deprecated)\ -CLANG_DIAG_ON(uninitialized)\ -CLANG_DIAG_ON(keyword-macro)@' -i'.bak' "$wrapper_dir"/*.cpp "$wrapper_dir"/*.h - -$SED -e 's@^#include $@CLANG_DIAG_OFF(deprecated)\ -CLANG_DIAG_OFF(uninitialized)\ -CLANG_DIAG_OFF(keyword-macro)\ -#include // produces warnings\ -CLANG_DIAG_ON(deprecated)\ -CLANG_DIAG_ON(uninitialized)\ -CLANG_DIAG_ON(keyword-macro)@' -i'.bak' "$wrapper_dir"/*.cpp "$wrapper_dir"/*.h - -# clean up -rm "$wrapper_dir"/*.bak diff --git a/tools/utils/sourceCleanup.py b/tools/utils/sourceCleanup.py new file mode 100644 index 0000000000..74167b5b5b --- /dev/null +++ b/tools/utils/sourceCleanup.py @@ -0,0 +1,50 @@ +from xml.etree import ElementTree +import os +import re +import sys + + +def clean_typesystem_cpp_sources(typesystem, out): + tree = ElementTree.parse(typesystem) + root = tree.getroot() + + package = root.attrib["package"] + + tags = ["namespace-type", "object-type", "value-type"] + types = [child.attrib["name"] for child in root if child.tag in tags] + + sources = [f"{package.lower()}_module_wrapper.cpp", f"{package.lower()}_python.h"] + sources.extend([f"{t.lower()}_wrapper.cpp" for t in types]) + sources.extend([f"{t.lower()}_wrapper.h" for t in types]) + + prog = re.compile("([\\s(,])::(?!Natron)(\\w+[^:])") + + for s in sources: + with open(os.path.normpath(os.path.join(out, package, s)), "r+") as f: + lines = f.readlines() + f.seek(0) + for l in lines: + f.write(prog.sub("\\1\\2", l)) + f.truncate() + + if package.lower() == "natrongui": + with open(os.path.normpath(os.path.join(out, package, sources[0])), "r+") as f: + lines = f.readlines() + f.seek(0) + for l in lines: + if (l.endswith("QtCoreTypes;\n") or + l.endswith("QtCoreTypeStructs;\n") or + l.endswith("QtCoreTypeConverters;\n") or + l.endswith("SbkNatronEngineTypes;\n") or + l.endswith("SbkNatronEngineTypeStructs;\n") or + l.endswith("SbkNatronEngineTypeConverters;\n")): + continue + f.write(l.replace("cleanTypesAttributes", "cleanGuiTypesAttributes")) + f.truncate() + + +if __name__ == "__main__": + if len(sys.argv) != 3: + print("usage: sourceCleanup.py ", file=sys.stderr) + exit(1) + clean_typesystem_cpp_sources(sys.argv[1], sys.argv[2])