| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Python 3.10, the code raised an ImportWarning:
ImportWarning: DynamicImporter.find_spec() not found; falling back to find_module()
See https://docs.python.org/3.10/whatsnew/3.10.html#deprecated
> Starting in this release, there will be a concerted effort to begin cleaning
> up old import semantics that were kept for Python 2.7 compatibility.
> Specifically, find_loader()/find_module() (superseded by find_spec()),
> load_module() (superseded by exec_module()), module_repr()
> (which the import system takes care of for you),
> the __package__ attribute (superseded by __spec__.parent),
> the __loader__ attribute (superseded by __spec__.loader),
> and the __cached__ attribute (superseded by __spec__.cached)
> will slowly be removed (as well as other classes and methods in importlib).
> ImportWarning and/or DeprecationWarning will be raised as appropriate to help
> identify code which needs updating during this transition.
Fixes https://gitlab.gnome.org/GNOME/pygobject/-/issues/473
|
| |
|
|
|
|
|
|
|
|
|
| |
find_module() should either return None or a loader, but we raised ImportError
there in case we already knew that the namespace was missing.
Move that check to load_module() instead. While there shouldn't be any functional
difference, raising in find_module() under Python 3 resulted in a chained
exception with an unrelated error message printed first.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For making warnings point to the code doing the import, the stack frames
of the import system need to be skipped. The frame count number varries
between CPython versions and in 3.5 all frames of the import system are
skipped for warnings (https://bugs.python.org/issue24305).
This hardcodes the frame counts for all supported CPython versions
which fixes the import warning output for CPython 3.3 and 3.5.
This also fixes/works around a bug in CPython 3 where if a too
large stacklevel value was passed to warn(), CPython would try to
interpret a file called "sys" in the same directory of the
executed script (https://bugs.python.org/issue25493
and https://bugzilla.gnome.org/show_bug.cgi?id=757184).
https://bugzilla.gnome.org/show_bug.cgi?id=757184
|
|
|
|
|
|
|
|
|
|
| |
In case a dependency of the imported namespace has a version
conflict with an already loaded version, import would raise
RepositoryError.
This fixes it to raise an ImportError instead.
https://bugzilla.gnome.org/show_bug.cgi?id=756033
|
|
|
|
|
|
|
|
|
|
|
|
| |
Recursively import a modules dependencies when importing from
gi.repository.
This fixes the case where a library depends on initialization
code of dependency overrides. For example libwnck expects
gdk_init to be called before using its API and gdk_init
gets called in the Gdk overrrides.
https://bugzilla.gnome.org/show_bug.cgi?id=656314
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
g_irepository_require
Instead of tracking loaded dependencies ourself to hide warnings if they
were loaded by a previous import just look if the namespace was loaded
before the import. This (a) makes the implementation much simpler and
(b) also takes into account namespaces loaded outside of Python/PyGObject
using the libgirepository C API (as is common in applications using
libpeas with Python plugins)
This also introduces a new Python wrapper for g_irepository_is_registered()
to allow checking the loading state of namespaces before imports.
This fixes unnecessary require_version warnings in gedit, gnome-builder,
totem, rhythmbox etc.
https://bugzilla.gnome.org/show_bug.cgi?id=754491
|
|
|
|
|
|
|
|
|
| |
version to import wasn't specified.
This makes the warning visible by default.
See commit ef3bff4e570363e4f383d4cdae9cecd4073b03d8 for more info on the warning.
https://bugzilla.gnome.org/show_bug.cgi?id=727379
|
|
|
|
|
|
|
|
|
| |
gi tries to import the latest version of typelibs which can cause
existing code to break when a newer typelib is released.
Emit an ImportWarning when gi.require_version() is not used to give
developers this awareness so they can future proof their code.
https://bugzilla.gnome.org/show_bug.cgi?id=727379
|
|
|
|
|
|
|
|
| |
Removes Registry and DynamicModule in favor of a simple module wrapper that
contains only overrides and falls back to the introspection module.
Moves all the overrides logic into gi.overrides; Speeds up module attribute access
https://bugzilla.gnome.org/show_bug.cgi?id=736678
|
|
|
|
|
|
|
|
|
| |
Raise an ImportError with extra information noting the typelib was not
found. This removes the need to log a similar message which adds output
noise when attempting controlled imports within try/except statements.
In Python 2, the additional information is lost but in Python 3 it shows up.
https://bugzilla.gnome.org/show_bug.cgi?id=726877
|
|
|
|
|
|
|
|
|
|
| |
Move final bits of _glib static binding imports directly into
the GLib override. Change _glib/option use the .so directly
rather than the staged variables in _glib/__init__.py.
Remove DynamicGLibModule and DynamicGObjectModule and update
unittest.
https://bugzilla.gnome.org/show_bug.cgi?id=687488
|
|
|
|
|
| |
By running the whole source tree via the indent.py script found
in the Python distribution.
|
|
|
|
|
|
| |
And add a target to make check that runs pyflakes.
https://bugzilla.gnome.org/show_bug.cgi?id=672578
|
|
|
|
|
|
| |
* derive directly from DynamicModule instead of InterfaceModule
https://bugzilla.gnome.org/show_bug.cgi?id=642048
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=642048
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=642048
|
| |
|
|
|
|
|
|
|
|
| |
This fixes Tomeu's previous commit, which removed lazy loading.
Forcing the loading of a module before it is installed in sys.modules
prevents some overrides from being registered (namely Gtk.main_quit).
https://bugzilla.gnome.org/show_bug.cgi?id=642305
|
|
|
|
|
|
| |
also adds Repository.get_loaded_namespaces()
https://bugzilla.gnome.org/show_bug.cgi?id=642305
|
| |
|
|
|
|
|
|
|
|
| |
* gi/importer.py: Defer loading the typelib until first usage.
* gi/module.py: Load the typelib in IntrospectionModule().
* gi/overrides/*.py: Adapt to API change.
* gi/pygi-repository.c: Add wrappers for g_irepository_enumerate and
g_irepository_get_version.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As of commit 5cb925b20, many type_tags for standard C types have
been removed - namely machine-dependent integer types and derived
types (size_t, time_t).
Most removals are just synonyms of other types, so their removal
should not have too much impact, with the exception of time_t,
which was translated to a native datetime object before.
Also remove time_t tests (Tomeu Vizoso).
https://bugzilla.gnome.org/show_bug.cgi?id=624065
|
|
|
|
|
|
|
|
|
|
|
|
| |
* This gives us the best of both worlds.
- We remain backwards compatable with pygobject by checking for existing
attrs in the gobject module
- If an attr does not exist we use the GI mechanism to look it up so that
things like flags look the same whether exported from GObject, Gtk
or any GI managed library
* add DynamicGObjectModule tests and make tests use the new module
- change import gobject to from gi.repository import GObject
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a ModuleProxy in front of the DynamicModule when an overrides module is
present. There is no need for an overrides module to be a class; it can just be a module.
Add an override decorator to override the wrapper of a registered type.
Adapt Gdk and Gtk accordingly.
Add tests.
https://bugzilla.gnome.org/show_bug.cgi?id=602830
|
| |
|
|
|
|
|
|
|
|
| |
This patch splits overridden module creation into two passes. The first pass
creates the auto-generated module normally before the overridden module is
attempted to be imported. The second pass imports the overridden module and
replaces the auto-generated module with the overridden. This is necessary
for the overridden modules to be able to access the auto-generated ones.
|
|
|