Fix sdist and packaging

wolfcrypt was not being packaged in the sdist and the build system did
not work if the source wasn't a git checkout. Both fixed.
pull/35/head
Andrew Hutchings 2022-01-31 12:28:00 +00:00 committed by Daniele Lacamera
parent bd4432b7be
commit c7125b04b1
2 changed files with 4 additions and 9 deletions

View File

@ -26,11 +26,6 @@ import sys
from setuptools import setup
from setuptools.command.build_ext import build_ext
# Adding src folder to the include path in order to import from wolfcrypt
package_dir = os.path.dirname(__file__)
sys.path.insert(0, package_dir)
import wolfcrypt
from wolfcrypt._build_wolfssl import build_wolfssl
@ -69,7 +64,6 @@ setup(
license=wolfcrypt.__license__,
packages=["wolfcrypt"],
package_dir={"":package_dir},
zip_safe=False,
cffi_modules=["./wolfcrypt/_build_ffi.py:ffibuilder"],

View File

@ -33,7 +33,6 @@ def local_path(path):
current = os.path.abspath(os.getcwd())
return os.path.abspath(os.path.join(current, path))
WOLFSSL_SRC_PATH = local_path("lib/wolfssl")
@ -121,8 +120,10 @@ def checkout_version(version):
def ensure_wolfssl_src(ref):
""" Ensure that wolfssl sources are presents and up-to-date
"""
if not os.path.isdir(WOLFSSL_SRC_PATH):
os.mkdir(WOLFSSL_SRC_PATH)
if not os.path.isdir("lib"):
os.mkdir("lib")
with chdir("lib"):
subprocess.run(["git", "clone", "--depth=1", "https://github.com/wolfssl/wolfssl"])
if not os.path.isdir(os.path.join(WOLFSSL_SRC_PATH, "wolfssl")):
subprocess.run(["git", "submodule", "update", "--init", "--depth=1"])