pygobject / pgi

[Unmaintained: Use PyGObject instead] GTK+ / GObject Introspection Bindings for PyPy.
GNU Lesser General Public License v2.1
74 stars 16 forks source link

Importing PackageKitGLib fails on recent versions #31

Closed SunilMohanAdapa closed 8 years ago

SunilMohanAdapa commented 8 years ago

When using latest pgi to import PackageKitGlib i see the following stack trace when building tests on Travis. When I use version 0.0.10.1 the problem does not occur. I was further unable to reproduce the problem on Debian unstable machine with both version (0.0.10.1 and 0.0.11.1). This could be an issue with Travis' build environment but since an older version is working, I thought I would report the problem.

Failing build with 0.0.11.1: https://travis-ci.org/freedombox/Plinth/jobs/109517303 Passing build with 0.0.10.1 https://travis-ci.org/SunilMohanAdapa/Plinth/jobs/109901088

======================================================================
ERROR: plinth.modules.config.tests.test_config (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/python/3.4.2/lib/python3.4/unittest/case.py", line 58, in testPartExecutor
    yield
  File "/opt/python/3.4.2/lib/python3.4/unittest/case.py", line 577, in run
    testMethod()
  File "/opt/python/3.4.2/lib/python3.4/unittest/loader.py", line 32, in testFailure
    raise exception
ImportError: Failed to import test module: plinth.modules.config.tests.test_config
Traceback (most recent call last):
  File "/opt/python/3.4.2/lib/python3.4/unittest/loader.py", line 312, in _find_tests
    module = self._get_module_from_name(name)
  File "/opt/python/3.4.2/lib/python3.4/unittest/loader.py", line 290, in _get_module_from_name
    __import__(name)
  File "/home/travis/build/freedombox/Plinth/plinth/modules/config/__init__.py", line 22, in <module>
    from . import config
  File "/home/travis/build/freedombox/Plinth/plinth/modules/config/config.py", line 36, in <module>
    from plinth.modules.firewall import firewall
  File "/home/travis/build/freedombox/Plinth/plinth/modules/firewall/__init__.py", line 22, in <module>
    from . import firewall
  File "/home/travis/build/freedombox/Plinth/plinth/modules/firewall/firewall.py", line 28, in <module>
    from plinth import package
  File "/home/travis/build/freedombox/Plinth/plinth/package.py", line 31, in <module>
    packagekit = import_from_gi('PackageKitGlib', '1.0')
  File "/home/travis/build/freedombox/Plinth/plinth/utils.py", line 37, in import_from_gi
    return importlib.import_module(package_name + '.repository.' + library)
  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/pgi/importer.py", line 179, in load_module
    const.PREFIX[0] + '.' + dep.split("-")[0])
  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/pgi/importer.py", line 179, in load_module
    const.PREFIX[0] + '.' + dep.split("-")[0])
  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/pgi/importer.py", line 182, in load_module
    proxy = overrides.load_overrides(introspection_module)
  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/pgi/overrides/__init__.py", line 121, in load_overrides
    override_mod = importlib.import_module(override_package_name)
  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/pgi/overrides/GObject.py", line 57, in <module>
    globals()[name] = getattr(GLib, name)
  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/pgi/overrides/__init__.py", line 32, in __getattr__
    return getattr(self._introspection_module, name)
  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/pgi/module.py", line 84, in __getattr__
    (self.__class__.__name__, name))
AttributeError: 'GLib' module has not attribute 'uri_list_extract_uris'
lazka commented 8 years ago

Thanks. I guess you are using pgi just for travis and pygobject for anything else?

Have a look at how to use pygobject on travis: https://pygobject.readthedocs.org/en/latest/testing.html#example-travis-ci-configuration

For the error itself, I can't reproduce here, but will keep this open in case I see something related (or you can provide a reproducer?)

SunilMohanAdapa commented 8 years ago

I have isolated the problem with a separate repository: https://github.com/SunilMohanAdapa/pgi-test

Failing build log: https://travis-ci.org/SunilMohanAdapa/pgi-test/builds/110286469

Indeed we are using pgi just for Travis. Thanks for the tip on pygobject/Travis, I am trying it.

lazka commented 8 years ago

Thanks. Weird error, I can't reproduce on 14.04 in a python3 virtualenv..

SunilMohanAdapa commented 8 years ago

I updated the test configuration to run the test on older version too. The older version succeeds while the newer version fails: https://travis-ci.org/SunilMohanAdapa/pgi-test/builds/110383838

The trick for PyGObject/Travis succeeded and we will now use PyGObject consistently. Many thanks again.

lazka commented 8 years ago

Ah, I'm stupid..., these are running on Ubuntu 12.04 not 14.04. I've dropped 12.04 support in the last release (or I don't test it any more at least..).

Glad you got PyGObject working on travis.

thanks for the report -> closing.

SunilMohanAdapa commented 8 years ago

I confirm that the problem goes away on Trusty. Sorry about the false alarm.