Commit 065e3eaa authored by John-Mark Gurney's avatar John-Mark Gurney

add setup.py... this builds the library and copies it over to the

build dir so it will get installed...  Also update the library finding
code to look in the modules install directory.
parent 84b7976f
#!/usr/bin/env python
'''This is a wrapper around the Goldilocks libdecaf library.
Currently only the ed448 code is wrapped. It is available in the
submodule ed448.
'''
......@@ -40,17 +40,22 @@ __status__ = 'alpha'
import array
import os
import os.path
import sys
import unittest
import warnings
import sys
from ctypes import *
try:
decaf = CDLL('../build/lib/libdecaf.so')
_dname = os.path.dirname(__file__)
if not _dname:
_dname = '.'
_path = os.path.join(_dname, 'libdecaf.so')
decaf = CDLL(_path)
except OSError as e: # pragma: no cover
import warnings
warnings.warn('goldilocks.so not installed.')
warnings.warn('libdecaf.so not installed.')
raise ImportError(str(e))
DECAF_EDDSA_448_PUBLIC_BYTES = 57
......@@ -232,6 +237,8 @@ class TestEd448(unittest.TestCase):
key3 = EDDSA448(pub=pubkey)
key3.verify(sig, message)
self.assertRaises(ValueError, key.export_key, 'PEM')
def test_keyimportexport(self):
privkey = b'1' * DECAF_EDDSA_448_PRIVATE_BYTES
key = EDDSA448(privkey)
......
#!/usr/bin/env python
from distutils.command.build import build
from distutils.core import setup
import os
class my_build(build):
def run(self):
build.run(self)
if not self.dry_run:
os.spawnlp(os.P_WAIT, 'sh', 'sh', '-c', 'cd .. && gmake lib')
self.copy_file(os.path.join('..', 'build', 'lib', 'libdecaf.so'), os.path.join(self.build_lib, 'edgold'))
cmdclass = {}
cmdclass['build'] = my_build
setup(name='edgold',
version='0.1',
description='The Ed ECC Goldilocks Python wrapper',
author='John-Mark Gurney',
author_email='jmg@funkthat.com',
#url='',
cmdclass=cmdclass,
packages=['edgold', ],
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment