[libvirt] [PATCH python] Add travis build config

Martin Kletzander mkletzan at redhat.com
Tue Sep 19 13:06:58 UTC 2017


On Tue, Sep 19, 2017 at 12:56:55PM +0100, Daniel P. Berrange wrote:
>Enable builds on several python versions, and against several versions
>of libvirt. Ideally we would build all the way back to 0.9.11, since
>that is the min supported libvirt for python binding. It is not possible
>to build this old libvirt version on modern distros though, so using
>1.2.0 as the oldest for now.
>
>Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
>---
> .travis.yml | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> setup.py    | 13 +++++++------
> 2 files changed, 62 insertions(+), 6 deletions(-)
> create mode 100644 .travis.yml
>
>diff --git a/.travis.yml b/.travis.yml
>new file mode 100644
>index 0000000..203d91d
>--- /dev/null
>+++ b/.travis.yml
>@@ -0,0 +1,55 @@
>+language: python
>+os: linux
>+
>+python:
>+  - 2.6
>+  - 2.7
>+  - 3.2
>+  - 3.6
>+
>+env:
>+  - LIBVIRT=1.2.0 EXT=gz
>+  - LIBVIRT=2.0.0  EXT=xz
>+  - LIBVIRT=3.6.0  EXT=xz

Spacing should be same on all lines.

>+
>+install:
>+  - sudo apt-get -qqy build-dep libvirt libxml2-dev
>+  - sudo apt-get -qqy install curl
>+  - pip install lxml nose

It'd be nice to have pip install -r requirements.txt here (and that file
added, of course).

>+  - curl -O -s https://libvirt.org/sources/libvirt-${LIBVIRT}.tar.${EXT}
>+  - tar -xf libvirt-${LIBVIRT}.tar.${EXT}
>+  - pushd libvirt-${LIBVIRT}
>+  - |
>+        ./configure --prefix=`pwd`/../libvirt-vroot \
>+                    --without-libvirtd \
>+                    --without-esx \
>+                    --without-vbox \
>+                    --without-libxl \
>+                    --without-xen \
>+                    --without-qemu \

Will this prevent building the qemu-specific APIs?  I'm too lazy to
check it out and I think there is no harm in seeing that after this is
pushed, though =)

>+                    --without-lxc \
>+                    --without-hyperv \
>+                    --without-macvtap \
>+                    --disable-werror
>+  - make
>+  - make install
>+  - popd
>+
>+script:
>+  - LD_LIBRARY_PATH=`pwd`/libvirt-vroot/lib PKG_CONFIG_PATH=`pwd`/libvirt-vroot/lib/pkgconfig python setup.py build sdist test
>+
>+notifications:
>+  irc:
>+    # The channel name "irc.oftc.net#virt" is encrypted against libvirt/libvirt

s_libvirt/libvirt_libvirt/libvirt-python_

>+    # to prevent IRC notifications from github forks. This was created using:
>+    # $ travis encrypt -r "libvirt/libvirt" "irc.oftc.net#virt"

same here

>+    channels:
>+      - secure: "K4JrbRpz4CHtZ1vjthVwseT8K6INJgjtZethP4DN1jOpm1uC5esbe1Q1qJOfB92JbMcdM6DNjrVg5eyTJj35aD9UoGpTUcPMsYrhlTPHZtfAuLv/at2eB2XRmETlhiXHgI6LizX6gTiwGW5ZHYwGChzumWxu141d/L9harNh9R6z8XH9uJpkNdOAIsJcwS56XGZ74CKsrqF5dK6ZYPIyP+i7gPO67gEWo0oD6TiJKR908fw03ZiXarIFmLRlk4MbHywLRF0byfD0gg2Ht/tDX73+59QXjLKo/GvQecwoU8UuuFRJlyhUfvm1JYYydnS+O7fPJvI0FWlYFY7i76aeVqkARHRpHknFueT6kZADOmiyMLuvdr+gWVuyIdX33vVJtDm4T1OtNMG/wy9EUZUU1vEu+gHhaRkf/O0GkMj0Hac4I14BGyd/Wdhto6zWojFiMEG/HRHey6l15MBQu49QyW/YMyWi/LeBWXuCUgwQ/ij5EPgsn36OxCafV9zMz0oXZskwX6rJGQRZsdgdwYvt2hP3muLaJbwVyT0bGlOJDJieOa/LVKOXPcQm26aGfyMuLgm0//E9v++6W1IDKh6+BNsfTKAwTxlAvJyz6Bns3XuUJUxUz2+uQVSS6S3EwEZUJ+yHDd2F4sX5OP1L7TWIOWFbI4vQK90ZZ7/jgiYQbwo="
>+    on_success: change
>+    on_failure: always
>+  email:
>+    # The list name 'libvirt-ci at redhat.com" is encrypted against libvirt/libvirt

and here

>+    # to prevent IRC notifications from github forks. This was created using:
>+    # $ travis encrypt -r "libvirt/libvirt" "libvirt-ci at redhat.com"

well, you know the drill...

>+    recipients:
>+      - secure: "l6TTLcEcXdDEldHE2NgSIdt6a0k99ug3hp2W4IlnqJWJfIk/87nysJtLNrA0va20pPApCa3iJfMq4PUmBGiIIimTN0/KgC7tONDraogXhCbgfZp9Ejy/57TXxygSp4oum2kDw/c5uLnfrFV/xcn1fk6hvH6CD3bVcJPOQ/mc5FSKLqN5UzwqNnMpMTtG9qxCwfXJ/Bdm9fbURfezC7djcYRwRfPUe3TSD0L76G2HnQnSy4RqR3KFSjQHFPnSGM5IbsokbOaFKCyp/pHOt7QomQaY7YAPX/K9O+eP+hkkp6DGADkkumHctcgnMoyxpahf7pNKw9S8JYabH2NwREIq8whbp9Mo+R4rYO2ozroLWHaboYs/pBLrs606ivTwOmWGRCpJdCmmKTiZNyo6MRrwiOM6x+2YHUTMOa2kVheRNzaaxMFzHPW2kZ20bujPhfViJsRYj9flo5GJXJLyjluGZK5RjrguNJeIh8VJNBiSHW37uj7drmNBsqMad+65mf/4xtGITBqhz5Spx5R9UMZbuiJvcm8GasJMMdQ+bCfuWYjF2nZvSvFEr54Ii1YrDp6FKQ8YG1aD1/D8Z0/b3pLd/8Pn+M9yIWyO/Sto5TbSUjxBTmTStuDmtYE5uu1miYebvgJH5MovWPBegYgrfI417kPJgCG3q/R0YcZFMKFfQyo="

Both this and the one above should be regenerated, of course.  Unless
they were, I don't know how to check those.

>diff --git a/setup.py b/setup.py
>index f33ff1a..cc3a09a 100755
>--- a/setup.py
>+++ b/setup.py
>@@ -290,15 +290,16 @@ class my_test(Command):
>                                               'lib' + plat_specifier)
>
>     def find_nosetests_path(self):
>-        paths = [
>-            "/usr/bin/nosetests-%d.%d" % (sys.version_info[0],
>+        binaries = [
>+            "nosetests-%d.%d" % (sys.version_info[0],
>                                           sys.version_info[1]),

indentation

>-            "/usr/bin/nosetests-%d" % (sys.version_info[0]),
>-            "/usr/bin/nosetests",
>+            "nosetests-%d" % (sys.version_info[0]),
>+            "nosetests",
>         ]
>
>-        for path in paths:
>-            if os.path.exists(path):
>+        for binary in binaries:
>+            path = distutils.spawn.find_executable(binary)
>+            if path != None:

Either `if path` or `if path is not None`, you should not compare to
None with `!=` IIRC.

With above comments addressed:

Reviewed-by: Martin Kletzander <mkletzan at redhat.com>

>                 return path
>
>         raise Exception("Cannot find any nosetests binary")
>--
>2.13.5
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170919/143d494f/attachment-0001.sig>


More information about the libvir-list mailing list