From 2ea8221626440b6a67a64afc6af736de9e4ecfea5cb72f8f93ba2955186b6a27 Mon Sep 17 00:00:00 2001 From: Jan Matejek Date: Fri, 16 Jan 2015 15:00:27 +0000 Subject: [PATCH] Accepting request 281463 from home:frispete:python This is the official vSphere python binding OBS-URL: https://build.opensuse.org/request/show/281463 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pyvmomi?expand=0&rev=1 --- .gitattributes | 23 +++ .gitignore | 1 + python-pyvmomi.changes | 6 + python-pyvmomi.spec | 82 +++++++++++ pyvmomi-5.5.0.2014.1.1.tar.gz | 3 + pyvmomi-git20141104-new.diff | 254 ++++++++++++++++++++++++++++++++++ 6 files changed, 369 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 python-pyvmomi.changes create mode 100644 python-pyvmomi.spec create mode 100644 pyvmomi-5.5.0.2014.1.1.tar.gz create mode 100644 pyvmomi-git20141104-new.diff diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/python-pyvmomi.changes b/python-pyvmomi.changes new file mode 100644 index 0000000..7ae5e53 --- /dev/null +++ b/python-pyvmomi.changes @@ -0,0 +1,6 @@ +------------------------------------------------------------------- +Tue Nov 4 17:28:19 UTC 2014 - hpj@urpla.net + +- version 5.5.0.2014.1.1: initial build +- apply asorted fixes from todays git tree + diff --git a/python-pyvmomi.spec b/python-pyvmomi.spec new file mode 100644 index 0000000..c85811a --- /dev/null +++ b/python-pyvmomi.spec @@ -0,0 +1,82 @@ +# +# spec file for package python-pyvmomi +# +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 LISA GmbH, Bingen, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ + + +Name: python-pyvmomi +Version: 5.5.0.2014.1.1 +Release: 0 +License: Apache-2.0 +Summary: VMware vSphere Python SDK +Url: https://github.com/vmware/pyvmomi +Group: Development/Languages/Python +Source: https://pypi.python.org/packages/source/p/pyvmomi/pyvmomi-%{version}.tar.gz +Patch: pyvmomi-git20141104-new.diff +BuildRequires: python-devel +BuildRequires: python-setuptools +BuildRequires: python-six >= 1.7.3 +BuildRequires: python-requests >= 2.3.0 +BuildRequires: python-vcrpy +BuildRequires: python-testtools >= 0.9.34 +BuildRoot: %{_tmppath}/%{name}-%{version}-build +%if 0%{?suse_version} && 0%{?suse_version} <= 1110 +%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} +%else +BuildArch: noarch +%endif + +%description +pyVmomi is the Python SDK for the VMware vSphere API that allows you to manage +ESX, ESXi, and vCenter. + +Getting Started ================ To get started, check out the samples project +at: + +* http://vmware.github.io/pyvmomi-community-samples/ + +* community discussion on IRC freenode.net channels `#pyvmomi and #pyvmomi-dev +* `_ + +* community email is on `nabble `_ + +For general language neutral documentation of vSphere Management API see: + +* `vSphere WS SDK API Docs +* `_ + +%prep +%setup -q -n pyvmomi-%{version} +%patch -p1 +# we don't want to install any of these +sed -i '/ data_files/,+1d' setup.py +# fix line breaks in text files +sed -i 's/\r//' *.txt + +%build +python setup.py build + +%install +python setup.py install --prefix=%{_prefix} --root=%{buildroot} + +%check +python setup.py test + +%files +%defattr(-,root,root,-) +%doc LICENSE.txt NOTICE.txt README.rst +%{python_sitelib}/* + +%changelog diff --git a/pyvmomi-5.5.0.2014.1.1.tar.gz b/pyvmomi-5.5.0.2014.1.1.tar.gz new file mode 100644 index 0000000..5c7b91b --- /dev/null +++ b/pyvmomi-5.5.0.2014.1.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a57bc76a20bc9135b17276ee51564246ca9bf2a3e69eb1040e93ce4719946179 +size 198314 diff --git a/pyvmomi-git20141104-new.diff b/pyvmomi-git20141104-new.diff new file mode 100644 index 0000000..1075b8e --- /dev/null +++ b/pyvmomi-git20141104-new.diff @@ -0,0 +1,254 @@ +diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/pyVmomi/DynamicTypeManagerHelper.py pyvmomi/pyVmomi/DynamicTypeManagerHelper.py +--- pyvmomi-5.5.0.2014.1.1/pyVmomi/DynamicTypeManagerHelper.py 2014-09-22 17:37:16.000000000 +0200 ++++ pyvmomi/pyVmomi/DynamicTypeManagerHelper.py 2014-11-04 18:50:31.720052092 +0100 +@@ -1,5 +1,3 @@ +-#!/usr/bin/env python +- + # VMware vSphere Python SDK + # Copyright (c) 2008-2014 VMware, Inc. All Rights Reserved. + # +diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/pyVmomi/Iso8601.py pyvmomi/pyVmomi/Iso8601.py +--- pyvmomi-5.5.0.2014.1.1/pyVmomi/Iso8601.py 2014-09-22 17:37:16.000000000 +0200 ++++ pyvmomi/pyVmomi/Iso8601.py 2014-11-04 18:50:31.720052092 +0100 +@@ -1,5 +1,3 @@ +-#!/usr/bin/env python +- + # VMware vSphere Python SDK + # Copyright (c) 2008-2014 VMware, Inc. All Rights Reserved. + # +diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/pyVmomi/ManagedMethodExecutorHelper.py pyvmomi/pyVmomi/ManagedMethodExecutorHelper.py +--- pyvmomi-5.5.0.2014.1.1/pyVmomi/ManagedMethodExecutorHelper.py 2014-09-22 17:37:16.000000000 +0200 ++++ pyvmomi/pyVmomi/ManagedMethodExecutorHelper.py 2014-11-04 18:50:31.724052132 +0100 +@@ -1,5 +1,3 @@ +-#!/usr/bin/env python +- + # VMware vSphere Python SDK + # Copyright (c) 2008-2014 VMware, Inc. All Rights Reserved. + # +diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/pyVmomi/SoapAdapter.py pyvmomi/pyVmomi/SoapAdapter.py +--- pyvmomi-5.5.0.2014.1.1/pyVmomi/SoapAdapter.py 2014-09-22 17:37:16.000000000 +0200 ++++ pyvmomi/pyVmomi/SoapAdapter.py 2014-11-04 18:50:31.756052461 +0100 +@@ -453,20 +453,20 @@ def ReadDocument(parser, data): + # a refactoring that rolls up some repeated code blocks into a method so + # that we can refactor XML parsing behavior in a single place. + if not isinstance(data, str): +- data = data.read() ++ data = data.read() + try: + parser.Parse(data) + except Exception: +- # wrap all parser faults with additional information for later +- # bug reporting on the XML parser code itself. +- (ec, ev, tb) = sys.exc_info() +- line = parser.CurrentLineNumber +- col = parser.CurrentColumnNumber +- pe = ParserError("xml document: " +- "{0} parse error at: " +- "line:{1}, col:{2}".format(data, line, col)) +- # use six.reraise for python 2.x and 3.x compatability +- reraise(ParserError, pe, tb) ++ # wrap all parser faults with additional information for later ++ # bug reporting on the XML parser code itself. ++ (ec, ev, tb) = sys.exc_info() ++ line = parser.CurrentLineNumber ++ col = parser.CurrentColumnNumber ++ pe = ParserError("xml document: " ++ "{0} parse error at: " ++ "line:{1}, col:{2}".format(data, line, col)) ++ # use six.reraise for python 2.x and 3.x compatability ++ reraise(ParserError, pe, tb) + + ## Deserialize an object from a file or string + # +@@ -1035,11 +1035,10 @@ class SSLTunnelConnection(object): + tunnel = http_client.HTTPConnection(path, **kwargs) + tunnel.request('CONNECT', self.proxyPath) + resp = tunnel.getresponse() +- tunnelSocket = resp.fp + if resp.status != 200: +- raise httplib.HTTPException("{0} {1}".format(resp.status, resp.reason)) ++ raise http_client.HTTPException("{0} {1}".format(resp.status, resp.reason)) + retval = http_client.HTTPSConnection(path) +- retval.sock = _SocketWrapper(tunnelSocket, ++ retval.sock = _SocketWrapper(tunnel.sock, + keyfile=key_file, certfile=cert_file) + return retval + +diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/README.rst pyvmomi/README.rst +--- pyvmomi-5.5.0.2014.1.1/README.rst 2014-09-22 17:39:34.000000000 +0200 ++++ pyvmomi/README.rst 2014-11-04 18:50:25.899992512 +0100 +@@ -24,7 +24,7 @@ Installing + The master is code that is in development, official releases are tagged and + posted to `pypi `_ + +-* The official release is availabe using pip, just run ++* The official release is available using pip, just run + ``pip install --upgrade pyvmomi``. + * To install the version in `github `_ use + ``python setup.py develop`` for development install or +@@ -32,7 +32,7 @@ posted to `pypi `_ command. You may have to + configure multiple python interpreters so that you can test in all the + environments listed in ``tox.ini`` or you will have to run ``tox`` with the + ``-e`` flag to run only in your version of python. For example, if you only +@@ -52,17 +52,17 @@ For general language neutral documentati + + Python Support + ============== +-* pyVmomi 5.5.0.2014.1 and later support Python 2.6, 2.7, 3.3 and 3.4 ++* pyVmomi 5.5.0-2014.1 and later support Python 2.6, 2.7, 3.3 and 3.4 + * pyVmomi 5.5.0 and below support Python 2.6 and 2.7 + + Compatibility Policy + ==================== +-pyVmomi versions are marked vSphere_version.release . Pyvmomi maintains minimum ++pyVmomi versions are marked vSphere_version-release . Pyvmomi maintains minimum + backward compatibility with the previous _four_ releases of *vSphere* and it's + own previous four releases. Compatibility with much older versions may continue + to work but will not be actively supported. + +-For example, version v5.5.0.2014.1 is most compatible with vSphere 5.5, 5.1, ++For example, version v5.5.0-2014.1 is most compatible with vSphere 5.5, 5.1, + 5.0, and 4.1 and was the first release in 2014. Initial releases compatible with + a version of vSphere will bare a naked version number of v5.5.0 indicating that + version of pyVmomi was released simultaneously with the *GA* version of vSphere +@@ -70,10 +70,10 @@ with the same version number. + + Releases + ======== +-* `5.5.0.2014.1.1 `_ +- release notes https://github.com/vmware/pyvmomi/releases/tag/v5.5.0.2014.1.1 +-* `5.5.0.2014.1 `_ +- release notes https://github.com/vmware/pyvmomi/releases/tag/v5.5.0.2014.1 ++* `5.5.0-2014.1.1 `_ ++ release notes https://github.com/vmware/pyvmomi/releases/tag/v5.5.0-2014.1.1 ++* `5.5.0-2014.1 `_ ++ release notes https://github.com/vmware/pyvmomi/releases/tag/v5.5.0-2014.1 + * `5.5.0 `_ + * `5.1.0 `_ + release notes https://github.com/vmware/pyvmomi/releases/tag/v5.1.0 +diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/sample/getallvms.py pyvmomi/sample/getallvms.py +--- pyvmomi-5.5.0.2014.1.1/sample/getallvms.py 2014-09-22 17:37:16.000000000 +0200 ++++ pyvmomi/sample/getallvms.py 2014-11-04 18:50:31.772052624 +0100 +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/env python + # VMware vSphere Python SDK + # Copyright (c) 2008-2013 VMware, Inc. All Rights Reserved. + # +diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/sample/poweronvm.py pyvmomi/sample/poweronvm.py +--- pyvmomi-5.5.0.2014.1.1/sample/poweronvm.py 2014-09-22 17:37:16.000000000 +0200 ++++ pyvmomi/sample/poweronvm.py 2014-11-04 18:50:31.776052665 +0100 +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/env python + # + # VMware vSphere Python SDK + # Copyright (c) 2008-2014 VMware, Inc. All Rights Reserved. +diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/tests/fixtures/ssl_tunnel_http_failure.yaml pyvmomi/tests/fixtures/ssl_tunnel_http_failure.yaml +--- pyvmomi-5.5.0.2014.1.1/tests/fixtures/ssl_tunnel_http_failure.yaml 1970-01-01 01:00:00.000000000 +0100 ++++ pyvmomi/tests/fixtures/ssl_tunnel_http_failure.yaml 2014-11-04 18:50:31.804052951 +0100 +@@ -0,0 +1,15 @@ ++interactions: ++- request: ++ body: null ++ headers: {} ++ method: CONNECT ++ uri: http://vcsavcsa:80 ++ response: ++ body: {string: !!python/unicode '

404 Not Found

'} ++ headers: ++ connection: [close] ++ content-length: ['48'] ++ content-type: [text/html] ++ date: ['Thu, 11 Sep 2014 07:57:56 GMT'] ++ status: {code: 404, message: Not Found} ++version: 1 +diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/tests/fixtures/ssl_tunnel.yaml pyvmomi/tests/fixtures/ssl_tunnel.yaml +--- pyvmomi-5.5.0.2014.1.1/tests/fixtures/ssl_tunnel.yaml 1970-01-01 01:00:00.000000000 +0100 ++++ pyvmomi/tests/fixtures/ssl_tunnel.yaml 2014-11-04 18:50:31.800052911 +0100 +@@ -0,0 +1,14 @@ ++interactions: ++- request: ++ body: null ++ headers: {} ++ method: CONNECT ++ uri: http://vcsasdkTunnel:8089 ++ response: ++ body: {string: !!python/unicode ''} ++ headers: ++ content-length: ['0'] ++ content-type: [text/html] ++ date: ['Thu, 11 Sep 2014 08:23:36 GMT'] ++ status: {code: 200, message: OK} ++version: 1 +diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/tests/__init__.py pyvmomi/tests/__init__.py +--- pyvmomi-5.5.0.2014.1.1/tests/__init__.py 2014-09-22 17:37:16.000000000 +0200 ++++ pyvmomi/tests/__init__.py 2014-11-04 18:50:31.784052747 +0100 +@@ -16,6 +16,7 @@ import logging + import os + import unittest + import vcr ++import socket + + + def tests_resource_path(local_path=''): +@@ -29,7 +30,7 @@ fixtures_path = tests_resource_path('fix + def monkey_patch_vcrpy(): + # TODO (hartsock): This should be unnecessary. Remove after vcrpy updates. + vcr.stubs.VCRHTTPSConnection.is_verified = True +- ++ vcr.stubs.VCRFakeSocket = socket.socket + + class VCRTestBase(unittest.TestCase): + +diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/tests/test_connect.py pyvmomi/tests/test_connect.py +--- pyvmomi-5.5.0.2014.1.1/tests/test_connect.py 2014-09-22 17:37:16.000000000 +0200 ++++ pyvmomi/tests/test_connect.py 2014-11-04 18:50:31.816053075 +0100 +@@ -68,5 +68,20 @@ class ConnectionTests(tests.VCRTestBase) + def test_disconnect_on_no_connection(self): + connect.Disconnect(None) + ++ @vcr.use_cassette('ssl_tunnel.yaml', ++ cassette_library_dir=tests.fixtures_path, ++ record_mode='none') ++ def test_ssl_tunnel(self): ++ connect.SoapStubAdapter('sdkTunnel', 8089, httpProxyHost='vcsa').GetConnection() ++ ++ @vcr.use_cassette('ssl_tunnel_http_failure.yaml', ++ cassette_library_dir=tests.fixtures_path, ++ record_mode='none') ++ def test_ssl_tunnel_http_failure(self): ++ from six.moves import http_client ++ def should_fail(): ++ connect.SoapStubAdapter('vcsa', 80, httpProxyHost='vcsa').GetConnection() ++ self.assertRaises(http_client.HTTPException, should_fail) ++ + if __name__ == '__main__': + unittest.main() +\ No newline at end of file +diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/.travis.yml pyvmomi/.travis.yml +--- pyvmomi-5.5.0.2014.1.1/.travis.yml 1970-01-01 01:00:00.000000000 +0100 ++++ pyvmomi/.travis.yml 2014-11-04 18:50:25.891992430 +0100 +@@ -0,0 +1,17 @@ ++language: python ++python: ++ - "2.6" ++ - "2.7" ++ - "pypy" ++ - "3.3" ++ - "3.4" ++ ++before_install: ++ - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install unittest2; fi ++ - pip install -r requirements.txt ++ - pip install -r test-requirements.txt ++ ++install: ++ - python setup.py install ++ ++script: python setup.py test