[Cryptech-Commits] [releng/alpha] 03/03: First cut at a setup.py for our Python code.
git at cryptech.is
git at cryptech.is
Fri Apr 14 21:40:47 UTC 2017
This is an automated email from the git hooks/post-receive script.
sra at hactrn.net pushed a commit to branch ksng
in repository releng/alpha.
commit 10eba36ef58559cf7964aa5c4888cee117122b31
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Fri Apr 14 17:40:25 2017 -0400
First cut at a setup.py for our Python code.
---
scripts/build-debian-control-files.py | 4 ++++
source/Makefile | 10 +++------
source/setup.py | 38 +++++++++++++++++++++++++++++++++++
3 files changed, 45 insertions(+), 7 deletions(-)
diff --git a/scripts/build-debian-control-files.py b/scripts/build-debian-control-files.py
index 5d6aff2..dbfcb38 100755
--- a/scripts/build-debian-control-files.py
+++ b/scripts/build-debian-control-files.py
@@ -56,3 +56,7 @@ subprocess.check_call(("dch", "--create", "--package", args.package, "--newversi
with open("debian/control", "w") as f:
f.write(control_template.format(args = args, conflicts = conflicts))
+
+with open("cryptech_version.py", "w") as f:
+ f.write(args.newversion)
+ f.write("\n")
diff --git a/source/Makefile b/source/Makefile
index af018b1..5095766 100644
--- a/source/Makefile
+++ b/source/Makefile
@@ -6,6 +6,8 @@
# the primary packaging system is Debian-based, so this is written
# to work in that environment.
#
+# See setup.py for installation of the Python-related bits.
+#
# We also support Homebrew for MacOSX, using the source tarball
# generated by the Debian packaging process, but the Homebrew formula
# handles the build and installation for that environment.
@@ -20,10 +22,4 @@ install: all
install -D -m 644 cryptech-alpha-firmware.tar.gz ${DESTDIR}/usr/share/cryptech-alpha-firmware.tar.gz
install -D -m 644 sw/pkcs11/libcryptech-pkcs11.so ${DESTDIR}/usr/lib/libcryptech-pkcs11.so
ln -s libcryptech-pkcs11.so ${DESTDIR}/usr/lib/libcryptech-pkcs11.so.0
-# install -D sw/pkcs11/p11util ${DESTDIR}/usr/bin/p11util
-# install -D sw/pkcs11/libhal/cryptech_rpcd ${DESTDIR}/usr/bin/cryptech_rpcd
- install -D sw/stm32/projects/hsm/cryptech_upload ${DESTDIR}/usr/bin/cryptech_upload
- install -D sw/stm32/projects/hsm/cryptech_probe ${DESTDIR}/usr/bin/cryptech_probe
- install -D sw/stm32/projects/hsm/cryptech_miniterm ${DESTDIR}/usr/bin/cryptech_miniterm
-
-# Still need scripts to do something useful with the firmware tarball
+ python setup.py install --install-layout=deb --root=${DESTDIR}
diff --git a/source/setup.py b/source/setup.py
new file mode 100644
index 0000000..97b405d
--- /dev/null
+++ b/source/setup.py
@@ -0,0 +1,38 @@
+# Minimal distutils-based setup for Cryptech Alpha board software.
+#
+# Yes I know that the cool kids use setuptools these days, but that
+# drags in a lot of complex stuff which I don't think we really need
+# or even want here. Revisit if I turn out to be wrong about this.
+
+from distutils.core import setup
+
+try:
+ from cryptech_version import VERSION
+except ImportError:
+ VERSION = "0.0.0"
+
+setup(
+ name = "Cryptech Alpha",
+ version = VERSION,
+ description = "Software for Cryptech Alpha prototype HSM",
+ license = "BSD",
+ url = "https://cryptech.is/",
+
+ py_modules = [ "cryptech.libhal",
+ ],
+
+ packages = [ "cryptech.py11",
+ ],
+
+ package_dir = { "cryptech" : "sw/libhal/cryptech",
+ "cryptech.py11" : "sw/pkcs11/cryptech/py11",
+ },
+
+ scripts = [ "sw/libhal/cryptech_backup",
+ "sw/libhal/cryptech_console",
+ "sw/libhal/cryptech_muxd",
+ "sw/stm32/projects/hsm/cryptech_miniterm",
+ "sw/stm32/projects/hsm/cryptech_probe",
+ "sw/stm32/projects/hsm/cryptech_upload",
+ ],
+)
More information about the Commits
mailing list