Package: python3-pygccxml Version: 1.9.1-3 Severity: important Dear Maintainer,
*** Reporter, please consider answering these questions, where appropriate *** * What led up to the situation? I try to use python3-pygccxml (for more details see this tutorial: https://github.com/EiffL/Tutorials) to automatically wrap C++ objects in python3 using pyplusplus. ---------------------------------------------------------------------- sudo apt update sudo apt install castxml python3 python3-pygccxml python3-pip sudo pip3 install pyplusplus ---------------------------------------------------------------------- When running the following script: ---------------------------------------------------------------------- #!/usr/bin/env python3 from pygccxml import parser from pyplusplus import module_builder # Configurations que vous pouvez avoir à changer sur votre système module_name = "pyboost" generator_path = "/usr/bin/castxml" generator_name = "castxml" compiler = "gnu" compiler_path = "/usr/bin/gcc" # Créé une configuration pour CastXML xml_generator_config = parser.xml_generator_configuration_t( xml_generator_path=generator_path, xml_generator=generator_name, compiler=compiler, compiler_path=compiler_path ) # Liste de tous les fichiers d'en-tête de votre bibliothèque header_collection = ["bonjour.hpp"] # Analyse les fichiers sources et créé un objet module_builder builder = module_builder.module_builder_t( header_collection, xml_generator_path=generator_path, xml_generator_config=xml_generator_config ) # Détecte automatiquement les propriétés et les accesseurs/mutateurs associés builder.classes().add_properties(exclude_accessors=True) # Définit un nom pour le module builder.build_code_creator(module_name=module_name) # Écrit le fichier d'interface C++ builder.write_module('bindings.cpp') --------------------------------------------------------------- ... in a directory containing the following "bonjour.hpp" file: --------------------------------------------------------------- #include <string> class Bonjour { std::string m_msg; public: Bonjour(const std::string & msg); void greet(); int sum(int x, int y); void set_msg(const std::string & msg); std::string get_msg() const; }; --------------------------------------------------------------- ... and I get this error: (mando@silk) (~/pyboost/src) $ ./make_bindings.py /usr/local/lib/python3.9/dist-packages/pyplusplus-1.8.4-py3.9.egg/pyplusplus/binary_parsers/parsers.py:7: DeprecationWarning: invalid escape sequence \m /usr/local/lib/python3.9/dist-packages/pyplusplus-1.8.4-py3.9.egg/pyplusplus/binary_parsers/parsers.py:7: DeprecationWarning: invalid escape sequence \m INFO Parsing source file "bonjour.hpp" ... Traceback (most recent call last): File "/home/mando/pyboost/src/./make_bindings.py", line 25, in <module> builder = module_builder.module_builder_t( File "/usr/local/lib/python3.9/dist-packages/pyplusplus-1.8.4-py3.9.egg/pyplusplus/module_builder/boost_python_builder.py", line 107, in __init__ File "/usr/local/lib/python3.9/dist-packages/pyplusplus-1.8.4-py3.9.egg/pyplusplus/module_builder/boost_python_builder.py", line 154, in __parse_declarations File "/usr/lib/python3/dist-packages/pygccxml/parser/project_reader.py", line 264, in read_files return self.__parse_file_by_file(files) File "/usr/lib/python3/dist-packages/pygccxml/parser/project_reader.py", line 292, in __parse_file_by_file decls = reader.read_file(header) File "/usr/lib/python3/dist-packages/pygccxml/parser/source_reader.py", line 356, in read_file return self.read_cpp_source_file(source_file) File "/usr/lib/python3/dist-packages/pygccxml/parser/source_reader.py", line 376, in read_cpp_source_file decls, files = self.__parse_xml_file(xml_file) File "/usr/lib/python3/dist-packages/pygccxml/parser/source_reader.py", line 474, in __parse_xml_file patcher.fix_calldef_decls( File "/usr/lib/python3/dist-packages/pygccxml/parser/patcher.py", line 261, in fix_calldef_decls default_arg_patcher(decl) File "/usr/lib/python3/dist-packages/pygccxml/parser/patcher.py", line 25, in __call__ arg.default_value = fixer(decl, arg) File "/usr/lib/python3/dist-packages/pygccxml/parser/patcher.py", line 140, in __fix_invalid_integral found = parent.variable( File "/usr/lib/python3/dist-packages/pygccxml/declarations/scopedef.py", line 612, in variable self._find_single( File "/usr/lib/python3/dist-packages/pygccxml/declarations/scopedef.py", line 478, in _find_single start_time = time.clock() AttributeError: module 'time' has no attribute 'clock' ---------------------------------------------------------------- According to this link (https://stackoverflow.com/questions/58569361/attributeerror-module-time-has-no-attribute-clock-in-python-3-8), this is because since python3.8, time.clock() no more exists and should be replaced e.g. by time.perf_counter() or time.process_time() intead. * What exactly did you do (or not do) that was effective (or ineffective)? I replaced each occurrences of time.clock() by term.perf_counter() in /usr/lib/python3/dist-packages/pygccxml and now it works: * What was the outcome of this action? ---------------------------------------------------------------- (mando@silk) (~/pyboost/src) $ ./make_bindings.py /usr/local/lib/python3.9/dist-packages/pyplusplus-1.8.4-py3.9.egg/pyplusplus/binary_parsers/parsers.py:7: DeprecationWarning: invalid escape sequence \m /usr/local/lib/python3.9/dist-packages/pyplusplus-1.8.4-py3.9.egg/pyplusplus/binary_parsers/parsers.py:7: DeprecationWarning: invalid escape sequence \m INFO Parsing source file "bonjour.hpp" ... /usr/lib/python3/dist-packages/pygccxml/declarations/scopedef.py:371: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working if isinstance(keywds['name'], collections.Callable) and \ file "named_tuple.py" - updated( 0.004337 seconds ) file "bindings_auto.cpp" - updated( 0.000108 seconds ) --------------------------------------------------------------- Could you fix the code so that pygccxml runs fine for python3 >= 3.8? Thanks Best regards -- System Information: Debian Release: 11.0 APT prefers testing-security APT policy: (500, 'testing-security'), (500, 'testing') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 5.10.0-8-amd64 (SMP w/4 CPU threads) Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages python3-pygccxml depends on: ii castxml 0.3.6-2 ii python3 3.9.2-3 python3-pygccxml recommends no packages. python3-pygccxml suggests no packages. -- no debconf information