From b4e33a63a2e655b1d1890f4e8e7ad7c83e965dd1 Mon Sep 17 00:00:00 2001 From: Finn Palmer Date: Tue, 16 Nov 2021 09:52:07 +0000 Subject: [PATCH] Python version / CI updates (#8) * Drop Python <=3.3 support (retaining 2.7 support) * Add newer Python build targets (3.7, 3.8, 3.9) * Build a wheel universal wheel output (Py2/Py3 compatible) * Gate deployment on passing of builds on all (supported) Python versions * Aesthetic updates to README (including transition to RST, preferred by PyPi) * Add README piping into setup.py package (so propagates into PyPi) * Multiple completeness updates to setup.py package info --- .travis.yml | 49 +++++++++++++++++++++++++++---------------------- README.md | 47 ----------------------------------------------- README.rst | 31 +++++++++++++++++++++++++++++++ setup.cfg | 2 ++ setup.py | 50 +++++++++++++++++++++++++++++++++++++++----------- 5 files changed, 99 insertions(+), 80 deletions(-) delete mode 100644 README.md create mode 100644 README.rst create mode 100644 setup.cfg diff --git a/.travis.yml b/.travis.yml index 0fbcc25..ff76aa0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,32 +1,37 @@ language: python python: - "2.7" - - "3.3" - "3.4" - "3.5" - "3.6" + - "3.7" + - "3.8" + - "3.9" install: - "pip install ." - "pip install nose" script: nosetests --with-doctest -deploy: - # production pypi - - provider: pypi - user: "__token__" - password: - secure: "Djo5OsdaQpx/dXxN1Mmcdx6AZJfXIB5Ji40PpSdNj8k2bNQM4YKg3/lMk3lfZnZx5ZzZfUvwi6GQ5l18B+d+O+7xmDmaO0d57pQsk1N/QXQejEM6EvRC1sN/BVla/5hQAwkoZo5EfSRY5B9O4VaX/QmBt26+dcEk5P4e8Lc27TZ9xqFPKWwQRzutwv96Goz3LP3vosdgUcGqDrc9+IIiVZV40yWG69VZ+2u9b8aCrL0Husc0ZtidPOIoGwL+zxb1i49xGwxM23DDRBDZWCbRDMecIix77rcf1GjaA4zWRGdzSJA4umew7wwzENvvWUQLmkHImhRmy1l6SsRt6TIsNtAQ+yWpmTbKdaDGJNvw25mNAqs9LhxMtW/jrokpKXH6L1bql1hRKm2It+77gpCMiGxM093GCwVJCCx6vNtFGh0bcBG2Zcf7Phda+eN0G9fKz1C3XguHRNEuPY0zI1pxirDtGyO3R/85QDatY82fPr6xDMYz1NxavDG9RpbgrHf09YIpVh2mFAdMxIUvjWe74f8/TkJ8SVS5Lhsih4C3ohh7wA/+8ifxR1ZCfV6J1AlX5OF6+UTU9Kl5CbZ5+xbz0K/F5jkSqVf7tVuZDvwUBRGkAnWksIij6U0al7FI8WTvfauJeDVwX1Y8ZofGqJh3nA1ENJ6NCAi7i6sV+9k4idI=" - distributions: sdist - on: - tags: true - condition: $TRAVIS_PYTHON_VERSION = "2.7" - # test pypi - - provider: pypi - distributions: sdist - server: https://test.pypi.org/legacy/ - user: "__token__" - password: - secure: "Djo5OsdaQpx/dXxN1Mmcdx6AZJfXIB5Ji40PpSdNj8k2bNQM4YKg3/lMk3lfZnZx5ZzZfUvwi6GQ5l18B+d+O+7xmDmaO0d57pQsk1N/QXQejEM6EvRC1sN/BVla/5hQAwkoZo5EfSRY5B9O4VaX/QmBt26+dcEk5P4e8Lc27TZ9xqFPKWwQRzutwv96Goz3LP3vosdgUcGqDrc9+IIiVZV40yWG69VZ+2u9b8aCrL0Husc0ZtidPOIoGwL+zxb1i49xGwxM23DDRBDZWCbRDMecIix77rcf1GjaA4zWRGdzSJA4umew7wwzENvvWUQLmkHImhRmy1l6SsRt6TIsNtAQ+yWpmTbKdaDGJNvw25mNAqs9LhxMtW/jrokpKXH6L1bql1hRKm2It+77gpCMiGxM093GCwVJCCx6vNtFGh0bcBG2Zcf7Phda+eN0G9fKz1C3XguHRNEuPY0zI1pxirDtGyO3R/85QDatY82fPr6xDMYz1NxavDG9RpbgrHf09YIpVh2mFAdMxIUvjWe74f8/TkJ8SVS5Lhsih4C3ohh7wA/+8ifxR1ZCfV6J1AlX5OF6+UTU9Kl5CbZ5+xbz0K/F5jkSqVf7tVuZDvwUBRGkAnWksIij6U0al7FI8WTvfauJeDVwX1Y8ZofGqJh3nA1ENJ6NCAi7i6sV+9k4idI=" - on: - branch: master - tags: false - condition: $TRAVIS_PYTHON_VERSION = "2.7" +jobs: + include: + - stage: build + python: "3.9" + deploy: + # production pypi + - provider: pypi + distributions: sdist bdist_wheel + user: "__token__" + password: + secure: "Djo5OsdaQpx/dXxN1Mmcdx6AZJfXIB5Ji40PpSdNj8k2bNQM4YKg3/lMk3lfZnZx5ZzZfUvwi6GQ5l18B+d+O+7xmDmaO0d57pQsk1N/QXQejEM6EvRC1sN/BVla/5hQAwkoZo5EfSRY5B9O4VaX/QmBt26+dcEk5P4e8Lc27TZ9xqFPKWwQRzutwv96Goz3LP3vosdgUcGqDrc9+IIiVZV40yWG69VZ+2u9b8aCrL0Husc0ZtidPOIoGwL+zxb1i49xGwxM23DDRBDZWCbRDMecIix77rcf1GjaA4zWRGdzSJA4umew7wwzENvvWUQLmkHImhRmy1l6SsRt6TIsNtAQ+yWpmTbKdaDGJNvw25mNAqs9LhxMtW/jrokpKXH6L1bql1hRKm2It+77gpCMiGxM093GCwVJCCx6vNtFGh0bcBG2Zcf7Phda+eN0G9fKz1C3XguHRNEuPY0zI1pxirDtGyO3R/85QDatY82fPr6xDMYz1NxavDG9RpbgrHf09YIpVh2mFAdMxIUvjWe74f8/TkJ8SVS5Lhsih4C3ohh7wA/+8ifxR1ZCfV6J1AlX5OF6+UTU9Kl5CbZ5+xbz0K/F5jkSqVf7tVuZDvwUBRGkAnWksIij6U0al7FI8WTvfauJeDVwX1Y8ZofGqJh3nA1ENJ6NCAi7i6sV+9k4idI=" + on: + branch: master + tags: true + # test pypi + - provider: pypi + distributions: sdist bdist_wheel + server: https://test.pypi.org/legacy/ + user: "__token__" + password: + secure: "lg8pH6BfqX/dsQynL7SEzW+zV2yABkI1B1PROEkCa+BX3P+BdKAQw1qhGhz35EB0dPgg10nqf9+wYbBPCMoTWig2KttD9FSNODQQua4/J6CtMr/I7KuuRCIb5yD1DUjMM4eYDt6l6dePxaT8JwjGfaYSweGIOhULaDzmNci95+IihA5KysE1b1RWkagrd3c1g3tztPJEmXHltI+mRdu+uaYksji6zl1z0Xpwwai8Qh40RTClQ0F3hnoUnRlzyIf5ezrVvr4t5XSK60ya6BS0+DvsWuo79d3Q/s1ARPf8EIdcYUpeCraeWRbrQtyc/Gra7pSmW16bd+wlmNdvp4V8G4QZL3jS3TXEg/RhHJ/jCbbsBi2bI+FTr9K0YOggWv+QhnSzwn8F9ZvrL+eKoB/226IWUgC2N1SCaaM6FML3MZLiAg0UixQr1EPYX5w7sl36aIAVr+gUdAoES0RTvt4X7+s2nMKFmaMcUv/r+P40qVcmV5YiNBHwYsgPnjyKQlN1rH3lsNEGG/fTqyh4hRFZNzg/UnHxAaOVhezI1/E/tP45Pj4d/w0AGDoFy9E4CjUqNYvuR6QCGMMLIXjSIrF3Fy/ZmHA1qQ1nAh7QteSxBr8vLTz2BauaPZe4h5os0j47AyX1RFAcMGkTN3thGyaSJsxUJgN668VQcHYJPb5hI7w=" + on: + branch: master + tags: false diff --git a/README.md b/README.md deleted file mode 100644 index c39534e..0000000 --- a/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# pyvmlib -A simple library for controlling VMware vCenter / ESXi servers. - -This library wraps up pyvmomi into something a little more friendly. - -To use, create a `Connection` object and call methods on it. e.g. - -``` -with Connection(HOST, USER, PASS) as conn: - for dev in conn.list_usb_devices_on_guest(VM_NAME): - print("Got dev: {}".format(dev)) -``` - -If your host has a self-signed certificate, set the `ignore_ssl_error` argument to `True`. - -``` -with Connection(INSECURE_HOST, USER, PASS, ignore_ssl_error=True) as conn: - for dev in conn.list_usb_devices_on_guest(VM_NAME): - print("Got dev: {}".format(dev)) -``` - -## Changelog - -### Pending Changes - -> Changes in master which have not been released will be documented here. - -### v2.2.0 - -* Add the 'interactive' optional argument to `list_processes_in_vm`. This is - required to get information about expired processes that were started with - the `interactive` flag. - -### v2.1.0 - -* Raise Exceptions for failed file uploads. We noted that if a file upload - failed (perhaps if an intermediate HTTP proxy rejected the size of the - upload file), there was no error raise. We now check that the HTTP server - gives a success result code and raise an Exception if it doesn't. - -### v2.0.0 - -* Improvements to the Exceptions generated by the connect() method. If you - were handling the underlying pyvmomi Exceptions before, you'll need to - switch to handling VmNotFoundException, InvalidCredentialsException, and - HostConnectException. - diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..7b17f67 --- /dev/null +++ b/README.rst @@ -0,0 +1,31 @@ +.. image:: https://app.travis-ci.com/cambridgeconsultants/pyvmlib.svg?branch=master + :target: https://app.travis-ci.com/cambridgeconsultants/pyvmlib + :alt: Build Status + +.. image:: https://img.shields.io/pypi/dm/pyvmlib.svg + :target: https://pypi.python.org/pypi/pyvmlib/ + :alt: Downloads + +pyvmlib +======= + +A simple library for controlling VMware vCenter / ESXi servers. + +This library wraps up pyvmomi into something a little more friendly. + +To use, create a ``Connection`` object and call methods on it. e.g. + +.. code-block:: python + + with Connection(HOST, USER, PASS) as conn: + for dev in conn.list_usb_devices_on_guest(VM_NAME): + print("Got dev: {}".format(dev)) + +If your host has a self-signed certificate, set the ``ignore_ssl_error`` argument to ``True`` + +.. code-block:: python + + with Connection(INSECURE_HOST, USER, PASS, ignore_ssl_error=True) as conn: + for dev in conn.list_usb_devices_on_guest(VM_NAME): + print("Got dev: {}".format(dev)) + diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..0a8df87 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[wheel] +universal = 1 \ No newline at end of file diff --git a/setup.py b/setup.py index 16a01a6..0bdb997 100644 --- a/setup.py +++ b/setup.py @@ -1,18 +1,46 @@ """Setup config for pyvmlib.""" +import os from setuptools import setup -setup(name='pyvmlib', - version='2.4.0', - description='A simple library for controlling VMware vSphere servers.', - url='http://github.com/cambridgeconsultants/pyvmlib', - author='Cambridge Consultants', - author_email='vicky.larmour@cambridgeconsultants.com', - license='Apache-2.0', - install_requires=[ + +def read(fname): + with open(os.path.join(os.path.dirname(__file__), fname)) as fn: + return fn.read() + + +setup( + name='pyvmlib', + version='2.4.1', + description='A simple library for controlling VMware vSphere servers.', + # NOTE: pypi prefers the use of RST to render docs + long_description=read('README.rst'), + url='http://github.com/cambridgeconsultants/pyvmlib', + author='Cambridge Consultants', + author_email='vicky.larmour@cambridgeconsultants.com', + license='Apache-2.0', + install_requires=[ 'pyvmomi', 'requests', 'six', - ], - packages=['pyvmlib'], - zip_safe=False) + ], + packages=['pyvmlib'], + classifiers=[ + 'Intended Audience :: Information Technology', + 'Intended Audience :: System Administrators', + 'Intended Audience :: Developers', + 'Environment :: No Input/Output (Daemon)', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Topic :: Software Development :: Libraries :: Python Modules', + 'Topic :: System :: Distributed Computing', + ], + keywords=['pyvmlib', 'pyvmomi', 'vsphere', 'vmware', 'esxi'], + python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', + zip_safe=False +)