From 000d6dd9cec7b653ed058eae6441d4e42584741b Mon Sep 17 00:00:00 2001 From: Phoenix Zerin Date: Sat, 14 Oct 2017 12:19:16 +1300 Subject: [PATCH 1/4] [#16] Added command to check C ext status. --- .travis.yml | 25 ++++++++++++++++--------- pyota_ccurl/__init__.py | 33 +++++++++++++++++++++++++++++++++ setup.py | 7 +++++++ 3 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 pyota_ccurl/__init__.py diff --git a/.travis.yml b/.travis.yml index eb6a063..3e3a1bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,12 +11,19 @@ script: - tar -zxf pyota-unittests/PyOTA-*.tar.gz -C pyota-unittests --strip-components=1 - nosetests pyota-unittests/test deploy: - on: - tags: true - python: '3.6' - provider: pypi - distributions: sdist - skip_upload_docs: true - user: phx - password: - secure: uprcy4uI8nx4t6NVfyzAlr5L9JgomGg6ZJbhb0u7lRUuOHeCB9ETXrg6zSbwiBGKc3bnbnAIJvGGVJErAdsOd9x5p3oyZI8UPOj9nQCKX3FStIl0x10licad1X5lO2WlIGyJNlg+uncFr3sUCG4W4SqujmDsBQnsUBVG2ei0i9eLxxzQsp+gPPPlVw2OLlkJ40B6wO64XcIf6Zlzq4Z/7mvtH3fkczPBiS6UYEv1I1OEBUaZ/h1fsvsbnriMV3Li3hdt22kquEqSxwxBjMcJ9FRAuyhJZz/GNkeHLiLkDodR3VKHan5+jBsWH44+xriOxNVhGNdI84u0NmXz00Crs5WL7O83vjM8m1t3rK1uX+fiyG7WhClFov1Lk4/OqBBUg92rXKvj1h78tSW2ldlwN6pv2QrmpZtWLDZySSPPmkDKAEQoWBo6wuotltqO9EUwi8Y4MHaXafRJcT5OaqJLa12jJTWAyAauzrO7HbcrCLJetcb1KY+ouBw7agLw30juPgm3d35mNV2jWaU2FaYr/vTGuT/PLQMOgWWoGb0LzHcLhrrv7QIBM/LZX+an02DGNHRoV7qGF5w+OLAt8eZOMuAhesZ5HTOXWj5+IXGjAupaJ/9cOYnSM7OwUjXcOh7I/5dvx41wV6sxDuI0jiIqCN47ZpSyA33FnCpjfrs6wTM= + - on: + tags: true + python: '3.6' + provider: pypi + distributions: 'bdist_wheel sdist' + user: phx + password: + secure: uprcy4uI8nx4t6NVfyzAlr5L9JgomGg6ZJbhb0u7lRUuOHeCB9ETXrg6zSbwiBGKc3bnbnAIJvGGVJErAdsOd9x5p3oyZI8UPOj9nQCKX3FStIl0x10licad1X5lO2WlIGyJNlg+uncFr3sUCG4W4SqujmDsBQnsUBVG2ei0i9eLxxzQsp+gPPPlVw2OLlkJ40B6wO64XcIf6Zlzq4Z/7mvtH3fkczPBiS6UYEv1I1OEBUaZ/h1fsvsbnriMV3Li3hdt22kquEqSxwxBjMcJ9FRAuyhJZz/GNkeHLiLkDodR3VKHan5+jBsWH44+xriOxNVhGNdI84u0NmXz00Crs5WL7O83vjM8m1t3rK1uX+fiyG7WhClFov1Lk4/OqBBUg92rXKvj1h78tSW2ldlwN6pv2QrmpZtWLDZySSPPmkDKAEQoWBo6wuotltqO9EUwi8Y4MHaXafRJcT5OaqJLa12jJTWAyAauzrO7HbcrCLJetcb1KY+ouBw7agLw30juPgm3d35mNV2jWaU2FaYr/vTGuT/PLQMOgWWoGb0LzHcLhrrv7QIBM/LZX+an02DGNHRoV7qGF5w+OLAt8eZOMuAhesZ5HTOXWj5+IXGjAupaJ/9cOYnSM7OwUjXcOh7I/5dvx41wV6sxDuI0jiIqCN47ZpSyA33FnCpjfrs6wTM= + - on: + tags: true + python: '2.7' + provider: pypi + distributions: 'bdist_wheel' + user: phx + password: + secure: uprcy4uI8nx4t6NVfyzAlr5L9JgomGg6ZJbhb0u7lRUuOHeCB9ETXrg6zSbwiBGKc3bnbnAIJvGGVJErAdsOd9x5p3oyZI8UPOj9nQCKX3FStIl0x10licad1X5lO2WlIGyJNlg+uncFr3sUCG4W4SqujmDsBQnsUBVG2ei0i9eLxxzQsp+gPPPlVw2OLlkJ40B6wO64XcIf6Zlzq4Z/7mvtH3fkczPBiS6UYEv1I1OEBUaZ/h1fsvsbnriMV3Li3hdt22kquEqSxwxBjMcJ9FRAuyhJZz/GNkeHLiLkDodR3VKHan5+jBsWH44+xriOxNVhGNdI84u0NmXz00Crs5WL7O83vjM8m1t3rK1uX+fiyG7WhClFov1Lk4/OqBBUg92rXKvj1h78tSW2ldlwN6pv2QrmpZtWLDZySSPPmkDKAEQoWBo6wuotltqO9EUwi8Y4MHaXafRJcT5OaqJLa12jJTWAyAauzrO7HbcrCLJetcb1KY+ouBw7agLw30juPgm3d35mNV2jWaU2FaYr/vTGuT/PLQMOgWWoGb0LzHcLhrrv7QIBM/LZX+an02DGNHRoV7qGF5w+OLAt8eZOMuAhesZ5HTOXWj5+IXGjAupaJ/9cOYnSM7OwUjXcOh7I/5dvx41wV6sxDuI0jiIqCN47ZpSyA33FnCpjfrs6wTM= diff --git a/pyota_ccurl/__init__.py b/pyota_ccurl/__init__.py new file mode 100644 index 0000000..229ffc9 --- /dev/null +++ b/pyota_ccurl/__init__.py @@ -0,0 +1,33 @@ +# coding=utf-8 +from __future__ import absolute_import, division, print_function, \ + unicode_literals + + +def is_installed(): + # type: () -> bool + """ + Returns whether the C extension is installed correctly. + """ + try: + # noinspection PyUnresolvedReferences + from ccurl import Curl as CCurl + except ImportError: + return False + else: + # noinspection PyUnresolvedReferences + from iota.crypto import Curl + return issubclass(Curl, CCurl) + + +def check_installation(): + """ + Outputs a message indicating whether the C extension is installed + correctly. + """ + print( + '😸 CCurl is installed correctly!' + if is_installed() + else '😿 CCurl is NOT installed correctly!' + ) + print('For support, visit the #iota-libs-pyota channel on the IOTA Slack.') + print('https://slack.iota.org/') diff --git a/setup.py b/setup.py index e234dd8..ced1eef 100644 --- a/setup.py +++ b/setup.py @@ -21,8 +21,15 @@ long_description = long_description, + packages = ['pyota_ccurl'], ext_modules = [Extension('ccurl', ['src/ccurlmodule.c'])], + entry_points = { + 'console_scripts': [ + 'check_ccurl = pyota_ccurl:check_installation', + ], + }, + install_requires = ['pyota'], license = 'MIT', From 82acd0a1e78a3eed2a84ac9442245fb83f0202b9 Mon Sep 17 00:00:00 2001 From: Phoenix Zerin Date: Sat, 14 Oct 2017 12:20:33 +1300 Subject: [PATCH 2/4] Bumping version number. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ced1eef..1f98829 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ name = 'PyOTA-CCurl', description = 'C Curl extension for PyOTA', url = 'https://github.com/todofixthis/pyota-ccurl', - version = '1.0.5', + version = '1.0.6', long_description = long_description, From f03d4134834123df3888de17c1c746ed8ce552f5 Mon Sep 17 00:00:00 2001 From: Phoenix Zerin Date: Sat, 14 Oct 2017 12:26:04 +1300 Subject: [PATCH 3/4] Added `check_ccurl` to README. --- README.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.rst b/README.rst index 7698d07..601393b 100644 --- a/README.rst +++ b/README.rst @@ -8,6 +8,14 @@ This extension is installed as an add-on to the ``pyota`` package:: pip install pyota[ccurl] +After running the above command, you can verify that the C extension is +installed correctly by running the ``check_ccurl`` command:: + + > check_ccurl + 😸 CCurl is installed correctly! + For support, visit the #iota-libs-pyota channel on the IOTA Slack. + https://slack.iota.org/ + Compatibility ------------- This extension is compatible with Python 3.6, 3.5 and 2.7. From e6041d0889df9433650ba96f7b2f8066c3c88104 Mon Sep 17 00:00:00 2001 From: Phoenix Zerin Date: Sat, 14 Oct 2017 12:27:17 +1300 Subject: [PATCH 4/4] Made documentation a bit more specific. --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 601393b..4bf0c01 100644 --- a/README.rst +++ b/README.rst @@ -9,7 +9,7 @@ This extension is installed as an add-on to the ``pyota`` package:: pip install pyota[ccurl] After running the above command, you can verify that the C extension is -installed correctly by running the ``check_ccurl`` command:: +installed correctly by running the ``check_ccurl`` command in your shell:: > check_ccurl 😸 CCurl is installed correctly!