[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#995405: marked as done (python3-pygccxml: python3.9 error: module 'time' has no attribute 'clock')



Your message dated Fri, 24 Dec 2021 05:03:40 +0000
with message-id <E1n0ck0-0009my-Ed@fasolo.debian.org>
and subject line Bug#995405: fixed in pygccxml 2.2.1-1
has caused the Debian Bug report #995405,
regarding python3-pygccxml: python3.9 error: module 'time' has no attribute 'clock'
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
995405: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=995405
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
Source: pygccxml
Source-Version: 2.2.1-1
Done: A. Maitland Bottoms <bottoms@debian.org>

We believe that the bug you reported is fixed in the latest version of
pygccxml, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 995405@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
A. Maitland Bottoms <bottoms@debian.org> (supplier of updated pygccxml package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Sat, 27 Nov 2021 22:19:22 -0500
Source: pygccxml
Architecture: source
Version: 2.2.1-1
Distribution: unstable
Urgency: medium
Maintainer: A. Maitland Bottoms <bottoms@debian.org>
Changed-By: A. Maitland Bottoms <bottoms@debian.org>
Closes: 995405
Changes:
 pygccxml (2.2.1-1) unstable; urgency=medium
 .
   * QA upload
   * New upstream release
     - no longer uses deprecated time.clock (Closes: #995405)
   * Bump debhelper compat level to 13.
   * Update standards version to 4.6.0, no changes needed.
Checksums-Sha1:
 c5e2cf498f281f895a148444010276fbf4363e3f 2068 pygccxml_2.2.1-1.dsc
 098c837dc9882330bae3aef744e7ba71f618da67 3170283 pygccxml_2.2.1.orig.tar.gz
 85d8bd211662f05355014635faa89076c2a40ba2 4504 pygccxml_2.2.1-1.debian.tar.xz
 5b885c135c373397deab5d342228af84acb4cd3e 8335 pygccxml_2.2.1-1_amd64.buildinfo
Checksums-Sha256:
 1bbcc928e209acc21ceee341d6f3fb4bf70f78bee3d9cadf68ed2de89d1f4b5a 2068 pygccxml_2.2.1-1.dsc
 9815a12e3bf6b83b2e9d8c88335fb3fa0e2b4067d7fbaaed09c3bf26c6206cc7 3170283 pygccxml_2.2.1.orig.tar.gz
 adf6833ae4b5bbbe7ed8fbd95263e942d5bf9ba73274c921d3dd3f46ae6d067b 4504 pygccxml_2.2.1-1.debian.tar.xz
 d3c98b88e53f2330c8324baa6e816e15c0bc60aaa083e8d4db42a7ad6d405126 8335 pygccxml_2.2.1-1_amd64.buildinfo
Files:
 802cb69abd002df50e2f074151f0f3b4 2068 python optional pygccxml_2.2.1-1.dsc
 3d2f37cdc88ad7a258f0c16555dc4586 3170283 python optional pygccxml_2.2.1.orig.tar.gz
 adf19b49cbc6bf8b2c7cd347e503049b 4504 python optional pygccxml_2.2.1-1.debian.tar.xz
 86346eb20a3d36b8311177a42bb48f6f 8335 python optional pygccxml_2.2.1-1_amd64.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEB8qH3cTCsGJAtrF0UEHxiR9E4JAFAmHFTz4ACgkQUEHxiR9E
4JATKQ/9GAeVwMDe+BuyexJP9lm0lXs+5NQSBpAYfg3EiPiyzcJzm6geUVYN2Yik
M9BjUjgK00pb7bXx5mG5gUAIlVnLpsEjAGODfXYd2Z2Uyrhvwl2twG9oQ5c8AH99
Dk8ZoP/aXFhnExHXWE76vF128Q38mFjkwYb7XyyETuCH5VytBm3XkLr45+rCvl6S
67+MFerzttwc3bioUHwFDzNLN2j8i1veL8np5VY08B6Chu6pREaqsyQyBvDsKRNU
3X5RaoCTdjnu29O4C0EjGQ8MI2PIEF+FML77qLliWC0rIUodfgz2F1A/+Pwcbrgo
ldyeMz4p/hwGy8zB/3S/MMsiN3LYFMgsRciFYWK6f1a6MCGBO5vRHEEoI+6hb0JF
3XA5uAamTcI9DedIIAzEPaW5DBK7eFEVG4nMMG028I/ITekhFl537m73CsgJbssy
xYDMcD+GCB9cpWLScD4rnYdKmoCPji6kqxcBZoaHn0kDWdF5TGC/ABnTNvnbsNLF
baeCjq9cUJDkwWlJc01+IIizCh12KsecNvpEJ/XTqrCzqOmNptMV6aLwnbh86w83
ZD4ynODZxOonqfxR8hwdY/BexidezaM1NW/wBRwH/4jEcifRo/6z4OTQBEyh4R8q
F4lEXYCmtqrCO9enqRwkZpk0jTWkOAI9R025rGAfNHra8XzfFos=
=lBHI
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: