summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-11-11 10:37:07 +0100
committerThomas Haller <thaller@redhat.com>2015-11-11 10:56:05 +0100
commit8d1233e67e0db2c53717d9bd1bf9935958ffd79a (patch)
tree3a70833fe267d67e5c06bc3575fd10a99d570cce /examples
parent0dc48370b48c08300713df611b7c9d3937306be3 (diff)
downloadNetworkManager-8d1233e67e0db2c53717d9bd1bf9935958ffd79a.tar.gz
python: use gi.require_version() in generate-setting-docs.py and examples
gi now emits a warning when not loading a specific library version [1]: ./generate-setting-docs.py:21: PyGIWarning: NM was imported without specifying a version first. Use gi.require_version(NM, 1.0) before import to ensure that the right version gets loaded. from gi.repository import NM, GObject Seems require_version() is reasonably old to just always use it without breaking on older versions [2]. [1] Related: https://bugzilla.gnome.org/show_bug.cgi?id=727379 [2] https://git.gnome.org/browse/pygobject/commit/?id=76758efb6579752237a0dc4d56cf9518de6c6e55
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/python/gi/add_connection.py2
-rwxr-xr-xexamples/python/gi/deactivate-all.py2
-rwxr-xr-xexamples/python/gi/device-state-ip4config.py2
-rwxr-xr-xexamples/python/gi/firewall-zone.py2
-rwxr-xr-xexamples/python/gi/get-active-connections.py2
-rwxr-xr-xexamples/python/gi/get-lldp-neighbors.py2
-rwxr-xr-xexamples/python/gi/get_ips.py2
-rwxr-xr-xexamples/python/gi/list-connections.py2
-rwxr-xr-xexamples/python/gi/show-wifi-networks.py2
-rwxr-xr-xexamples/python/gi/update-ip4-method.py2
10 files changed, 20 insertions, 0 deletions
diff --git a/examples/python/gi/add_connection.py b/examples/python/gi/add_connection.py
index 666509906d..cfb40a9aee 100755
--- a/examples/python/gi/add_connection.py
+++ b/examples/python/gi/add_connection.py
@@ -29,6 +29,8 @@
# https://developer.gnome.org/NetworkManager/1.0/ref-settings.html
#
+import gi
+gi.require_version('NM', '1.0')
from gi.repository import GLib, NM
import sys, uuid
diff --git a/examples/python/gi/deactivate-all.py b/examples/python/gi/deactivate-all.py
index 571f3fe407..59842ac2bd 100755
--- a/examples/python/gi/deactivate-all.py
+++ b/examples/python/gi/deactivate-all.py
@@ -31,6 +31,8 @@
#
import sys
+import gi
+gi.require_version('NM', '1.0')
from gi.repository import NM
# suported connection types
diff --git a/examples/python/gi/device-state-ip4config.py b/examples/python/gi/device-state-ip4config.py
index 1a6f7dece9..2a4a6221c1 100755
--- a/examples/python/gi/device-state-ip4config.py
+++ b/examples/python/gi/device-state-ip4config.py
@@ -21,6 +21,8 @@
#
import sys
+import gi
+gi.require_version('NM', '1.0')
from gi.repository import GLib, NM
#
diff --git a/examples/python/gi/firewall-zone.py b/examples/python/gi/firewall-zone.py
index 10add3e631..979f2acf91 100755
--- a/examples/python/gi/firewall-zone.py
+++ b/examples/python/gi/firewall-zone.py
@@ -20,6 +20,8 @@
#
import sys
+import gi
+gi.require_version('NM', '1.0')
from gi.repository import GLib, NM
#
diff --git a/examples/python/gi/get-active-connections.py b/examples/python/gi/get-active-connections.py
index 55ba2d81cd..22c9eb4ab6 100755
--- a/examples/python/gi/get-active-connections.py
+++ b/examples/python/gi/get-active-connections.py
@@ -21,6 +21,8 @@
# This example lists currently active connections
+import gi
+gi.require_version('NM', '1.0')
from gi.repository import GLib, NM
if __name__ == "__main__":
diff --git a/examples/python/gi/get-lldp-neighbors.py b/examples/python/gi/get-lldp-neighbors.py
index 03690d5a78..c70470129e 100755
--- a/examples/python/gi/get-lldp-neighbors.py
+++ b/examples/python/gi/get-lldp-neighbors.py
@@ -21,6 +21,8 @@
#
import sys
+import gi
+gi.require_version('NM', '1.0')
from gi.repository import GLib, NM
# This example shows how to get a list of LLDP neighbors for a given interface.
diff --git a/examples/python/gi/get_ips.py b/examples/python/gi/get_ips.py
index 690bd6ef89..77e1d17161 100755
--- a/examples/python/gi/get_ips.py
+++ b/examples/python/gi/get_ips.py
@@ -21,6 +21,8 @@
#
import sys, socket
+import gi
+gi.require_version('NM', '1.0')
from gi.repository import GLib, NM
#
diff --git a/examples/python/gi/list-connections.py b/examples/python/gi/list-connections.py
index 34b559fc66..32ea70f510 100755
--- a/examples/python/gi/list-connections.py
+++ b/examples/python/gi/list-connections.py
@@ -20,6 +20,8 @@
# Copyright 2012 - 2014 Red Hat, Inc.
#
+import gi
+gi.require_version('NM', '1.0')
from gi.repository import NM
# This example asks settings service for all configured connections.
diff --git a/examples/python/gi/show-wifi-networks.py b/examples/python/gi/show-wifi-networks.py
index e35738ea5c..db49b555f5 100755
--- a/examples/python/gi/show-wifi-networks.py
+++ b/examples/python/gi/show-wifi-networks.py
@@ -21,6 +21,8 @@
#
import locale
+import gi
+gi.require_version('NM', '1.0')
from gi.repository import NM
#
diff --git a/examples/python/gi/update-ip4-method.py b/examples/python/gi/update-ip4-method.py
index 2aa4af3068..1212459946 100755
--- a/examples/python/gi/update-ip4-method.py
+++ b/examples/python/gi/update-ip4-method.py
@@ -27,6 +27,8 @@
# https://developer.gnome.org/NetworkManager/1.0/ref-settings.html
#
+import gi
+gi.require_version('NM', '1.0')
from gi.repository import GLib, NM
import sys, socket