Skip to content

Commit 444d871

Browse files
authored
Merge pull request #8 from cconlon/pyupdate
Update wolfssl-py for use with urllib3 and websocket-client
2 parents 690b222 + 0598e2e commit 444d871

19 files changed

Lines changed: 451 additions & 115 deletions

.travis.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
sudo: required
22

3-
branches:
4-
only:
5-
- master
6-
73
matrix:
84
include:
95
- dist: trusty
@@ -13,7 +9,7 @@ matrix:
139
script:
1410
- ./make/manylinux1/build_wheels.sh
1511
- os: osx
16-
osx_image: xcode8.3
12+
osx_image: xcode9.4
1713
script:
1814
- ./make/osx/build_wheels.sh
1915

README.rst

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Welcome
88
that encapsulates `wolfSSL's SSL/TLS library
99
<https://wolfssl.com/wolfSSL/Products-wolfssl.html>`_.
1010

11-
**wolfSSL's SSL/TLS library** is a lightweight, portable, C-language-based
11+
The **wolfSSL SSL/TLS library** is a lightweight, portable, C-language-based
1212
library targeted at IoT, embedded, and RTOS environments primarily because of
1313
its size, speed, and feature set. It works seamlessly in desktop, enterprise,
1414
and cloud environments as well.
@@ -22,3 +22,42 @@ We provide Python wheels (prebuilt binaries) for OSX 64 bits and Linux 64 bits:
2222
.. code-block:: bash
2323
2424
$ pip install wolfssl
25+
26+
To build wolfssl-py from source:
27+
28+
.. code-block:: bash
29+
30+
$ cd wolfssl-py
31+
$ pip install .
32+
33+
The default pip install clones wolfSSL from GitHub. To build wolfssl-py using a
34+
local installation of the native wolfSSL C library, the USE_LOCAL_WOLFSSL
35+
environment variable should be set. USE_LOCAL_WOLFSSL can be set to "1" to use
36+
the default library installation location (/usr/local/lib, /usr/local/include),
37+
or to use a custom location it can be set to the install locaiton of your native
38+
wolfSSL library. For example:
39+
40+
.. code-block:: bash
41+
42+
# Uses default install location
43+
$ USE_LOCAL_WOLFSSL=1 pip install .
44+
45+
# Uses custom install location
46+
$ USE_LOCAL_WOLFSSL=/tmp/install pip install .
47+
48+
Tests
49+
=====
50+
51+
To run the tests that ship with wolfssl-py, after compiling the library run
52+
one of the following commands:
53+
54+
.. code-block:: bash
55+
56+
$ pytest
57+
$ py.test tests
58+
59+
Support
60+
=======
61+
62+
For support and questions, please email support@wolfssl.com.
63+

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Makefile for Sphinx documentation
22
#
3-
# Copyright (C) 2006-2018 wolfSSL Inc.
3+
# Copyright (C) 2006-2019 wolfSSL Inc.
44
#
55
# This file is part of wolfSSL. (formerly known as CyaSSL)
66
#

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252

5353
# General information about the project.
5454
project = u'wolfssl Python'
55-
copyright = u'2018, wolfSSL Inc. All rights reserved'
55+
copyright = u'2019, wolfSSL Inc. All rights reserved'
5656
author = u'wolfSSL'
5757

5858
# The version info for the project you're documenting, acts as replacement for

examples/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# client.py
66
#
7-
# Copyright (C) 2006-2017 wolfSSL Inc.
7+
# Copyright (C) 2006-2019 wolfSSL Inc.
88
#
99
# This file is part of wolfSSL. (formerly known as CyaSSL)
1010
#
@@ -105,6 +105,9 @@ def main():
105105

106106
bind_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
107107

108+
# enable debug, if native wolfSSL has been compiled with '--enable-debug'
109+
wolfssl.WolfSSL.enable_debug()
110+
108111
context = wolfssl.SSLContext(get_method(args.v))
109112

110113
context.load_cert_chain(args.c, args.k)

examples/server.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# server.py
66
#
7-
# Copyright (C) 2006-2017 wolfSSL Inc.
7+
# Copyright (C) 2006-2019 wolfSSL Inc.
88
#
99
# This file is part of wolfSSL. (formerly known as CyaSSL)
1010
#
@@ -109,6 +109,9 @@ def main():
109109

110110
print("Server listening on port", bind_socket.getsockname()[1])
111111

112+
# enable debug, if native wolfSSL has been compiled with '--enable-debug'
113+
wolfssl.WolfSSL.enable_debug()
114+
112115
context = wolfssl.SSLContext(get_method(args.v), server_side=True)
113116

114117
context.load_cert_chain(args.c, args.k)

make/manylinux1/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ for PYBIN in /opt/python/*/bin; do
1111
done
1212

1313
# Bundle external shared libraries into the wheels
14-
for whl in dist/*.whl; do
14+
for whl in dist/wolfssl*.whl; do
1515
auditwheel repair "$whl" -w tmpdist/
1616
done
1717

make/osx/build_wheels.sh

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,30 @@ set -e
22
set +x
33

44
for PYVERSION in 2.7 3.4 3.5 3.6; do
5-
virtualenv -p /Library/Frameworks/Python.framework/Versions/${PYVERSION}/bin/python${PYVERSION} venv_${PYVERSION}
5+
PYTHONBIN=/Library/Frameworks/Python.framework/Versions/${PYVERSION}/bin
6+
PYTHONEXE=${PYTHONBIN}/python${PYVERSION}
7+
export PATH="${PYTHONBIN}":$PATH
8+
9+
# update pip for newer TLS support
10+
curl https://bootstrap.pypa.io/get-pip.py | ${PYTHONEXE}
11+
"${PYTHONBIN}/pip" install --upgrade pip
12+
13+
# update virtualenv
14+
${PYTHONEXE} -m pip install virtualenv
15+
16+
virtualenv -p ${PYTHONEXE} venv_${PYVERSION}
617
. ./venv_${PYVERSION}/bin/activate
7-
pip install -r requirements/setup.txt
8-
python setup.py bdist_wheel
9-
pip install -r requirements/test.txt
18+
19+
# install cffi module
20+
${PYTHONEXE} -m pip install cffi
21+
22+
${PYTHONEXE} setup.py bdist_wheel
23+
"${PYTHONBIN}/pip" install -r requirements/test.txt
1024
set +e
11-
pip uninstall -y wolfssl
25+
"${PYTHONBIN}/pip" uninstall -y wolfssl
1226
set -e
13-
pip install wolfssl --no-index -f dist
27+
"${PYTHONBIN}/pip" install wolfssl --no-index -f dist
1428
rm -rf tests/__pycache__
1529
py.test tests
1630
deactivate
17-
done
31+
done

setup.py

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
#
4-
# Copyright (C) 2006-2018 wolfSSL Inc.
4+
# Copyright (C) 2006-2019 wolfSSL Inc.
55
#
66
# This file is part of wolfSSL. (formerly known as CyaSSL)
77
#
@@ -44,29 +44,18 @@
4444
long_description = long_description.replace(".. include:: LICENSING.rst\n",
4545
licensing_file.read())
4646

47-
48-
# requirements
49-
def _parse_requirements(filepath):
50-
raw = pip.req.parse_requirements(
51-
filepath, session=pip.download.PipSession())
52-
53-
return [str(i.req) for i in raw]
54-
55-
56-
install_requirements = _parse_requirements("requirements/prod.txt")
57-
setup_requirements = _parse_requirements("requirements/setup.txt")
58-
test_requirements = _parse_requirements("requirements/test.txt")
59-
60-
6147
class cffiBuilder(build_ext, object):
6248

6349
def build_extension(self, ext):
6450
""" Compile manually the wolfssl-py extension, bypass setuptools
6551
"""
66-
build_wolfssl(wolfssl.__wolfssl_version__)
6752

68-
super(cffiBuilder, self).build_extension(ext)
53+
# if USE_LOCAL_WOLFSSL environment variable has been defined,
54+
# do not clone and compile wolfSSL from GitHub
55+
if os.environ.get("USE_LOCAL_WOLFSSL") is None:
56+
build_wolfssl(wolfssl.__wolfssl_version__)
6957

58+
super(cffiBuilder, self).build_extension(ext)
7059

7160
setup(
7261
name=wolfssl.__title__,
@@ -82,7 +71,6 @@ def build_extension(self, ext):
8271
package_dir={"":package_dir},
8372

8473
zip_safe=False,
85-
cffi_modules=["./src/wolfssl/_build_ffi.py:ffi"],
8674

8775
keywords="wolfssl, wolfcrypt, security, cryptography",
8876
classifiers=[
@@ -98,9 +86,10 @@ def build_extension(self, ext):
9886
u"Topic :: Software Development"
9987
],
10088

101-
setup_requires=setup_requirements,
102-
install_requires=install_requirements,
89+
setup_requires=["cffi"],
90+
cffi_modules=["./src/wolfssl/_build_ffi.py:ffi"],
91+
install_requires=["cffi"],
10392
test_suite="tests",
104-
tests_require=test_requirements,
93+
tests_require=["tox", "pytest"],
10594
cmdclass={"build_ext" : cffiBuilder}
10695
)

src/wolfssl/__about__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# __about__.py
44
#
5-
# Copyright (C) 2006-2017 wolfSSL Inc.
5+
# Copyright (C) 2006-2019 wolfSSL Inc.
66
#
77
# This file is part of wolfSSL. (formerly known as CyaSSL)
88
#
@@ -26,21 +26,21 @@
2626

2727
# When bumping the C library version, reset the POST count to 0
2828

29-
__wolfssl_version__ = "v3.14.0b"
29+
__wolfssl_version__ = "v3.15.7-stable"
3030

3131
# We're using implicit post releases [PEP 440] to bump package version
3232
# while maintaining the C library version intact for better reference.
3333
# https://www.python.org/dev/peps/pep-0440/#implicit-post-releases
3434
#
3535
# MAJOR.MINOR.BUILD-POST
3636

37-
__version__ = __wolfssl_version__[1:].replace("b", "-1")
37+
__version__ = __wolfssl_version__[1:].replace("stable", "0")
3838

3939
__author__ = "wolfSSL Inc."
4040
__email__ = "info@wolfssl.com"
4141

4242
__license__ = "GPLv2 or Commercial License"
43-
__copyright__ = "Copyright (C) 2006-2017 wolfSSL Inc"
43+
__copyright__ = "Copyright (C) 2006-2019 wolfSSL Inc"
4444

4545
__all__ = [
4646
"__title__", "__summary__", "__uri__", "__version__",

0 commit comments

Comments
 (0)