From 3672c6d2a850a25835ac95eeea0a44dedba4081b Mon Sep 17 00:00:00 2001 From: Donald Stufft <donald@stufft.io> Date: Sat, 5 Oct 2013 20:35:30 -0400 Subject: [PATCH] Move the cffi defintions into nacl.c._lib --- setup.py | 1 + src/nacl/c/__init__.py | 14 ++++++++++++++ src/nacl/{nacl.py => c/_lib.py} | 3 --- src/nacl/hash.py | 3 ++- src/nacl/public.py | 3 ++- src/nacl/secret.py | 3 ++- src/nacl/signing.py | 3 ++- src/nacl/utils.py | 2 +- 8 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 src/nacl/c/__init__.py rename src/nacl/{nacl.py => c/_lib.py} (99%) diff --git a/setup.py b/setup.py index 7aa269b8..d211d350 100644 --- a/setup.py +++ b/setup.py @@ -210,6 +210,7 @@ setup( package_dir={"": "src"}, packages=[ "nacl", + "nacl.c", ], ext_package="nacl", diff --git a/src/nacl/c/__init__.py b/src/nacl/c/__init__.py new file mode 100644 index 00000000..e19b2509 --- /dev/null +++ b/src/nacl/c/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2013 Donald Stufft and individual contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from __future__ import absolute_import, division, print_function diff --git a/src/nacl/nacl.py b/src/nacl/c/_lib.py similarity index 99% rename from src/nacl/nacl.py rename to src/nacl/c/_lib.py index 35ee3010..a82ed815 100644 --- a/src/nacl/nacl.py +++ b/src/nacl/c/_lib.py @@ -11,9 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -""" -CFFI interface to NaCl and libsodium library -""" from __future__ import absolute_import from __future__ import division diff --git a/src/nacl/hash.py b/src/nacl/hash.py index a6f76381..eb0fdc0d 100644 --- a/src/nacl/hash.py +++ b/src/nacl/hash.py @@ -14,7 +14,8 @@ from __future__ import absolute_import from __future__ import division -from . import nacl, encoding +from . import encoding +from .c import _lib as nacl from .exceptions import CryptoError diff --git a/src/nacl/public.py b/src/nacl/public.py index b9604b10..33d88d8e 100644 --- a/src/nacl/public.py +++ b/src/nacl/public.py @@ -14,7 +14,8 @@ from __future__ import absolute_import from __future__ import division -from . import nacl, encoding +from . import encoding +from .c import _lib as nacl from .exceptions import CryptoError from .utils import EncryptedMessage, StringFixer, random diff --git a/src/nacl/secret.py b/src/nacl/secret.py index e0b4e113..c21f082b 100644 --- a/src/nacl/secret.py +++ b/src/nacl/secret.py @@ -14,7 +14,8 @@ from __future__ import absolute_import from __future__ import division -from . import nacl, encoding +from . import encoding +from .c import _lib as nacl from .exceptions import CryptoError from .utils import EncryptedMessage, StringFixer diff --git a/src/nacl/signing.py b/src/nacl/signing.py index 8ee77416..5791fdd2 100644 --- a/src/nacl/signing.py +++ b/src/nacl/signing.py @@ -16,7 +16,8 @@ from __future__ import division import six -from . import nacl, encoding +from . import encoding +from .c import _lib as nacl from .exceptions import CryptoError from .utils import StringFixer, random diff --git a/src/nacl/utils.py b/src/nacl/utils.py index 98c41891..963b7d6c 100644 --- a/src/nacl/utils.py +++ b/src/nacl/utils.py @@ -16,7 +16,7 @@ from __future__ import division import six -from . import nacl +from .c import _lib as nacl class EncryptedMessage(six.binary_type): -- GitLab