[Cryptech-Commits] [releng/alpha] 01/01: Preliminary support for Python 3
git at cryptech.is
git at cryptech.is
Sun Jun 21 19:38:09 UTC 2020
This is an automated email from the git hooks/post-receive script.
sra at hactrn.net pushed a commit to branch python3
in repository releng/alpha.
commit 23eac4f149edc62bb7ccc36db623f9301e2d2fda
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Sun Jun 21 15:27:45 2020 -0400
Preliminary support for Python 3
This is a first step towards moving all of the Cryptech code from
Python 2 to Python 3. At this stage, the goal is to make the same
source code work in both language dialects, and to build packages
which install both versions of the library code.
This is a necessary step along the way, but since Python 2 is already
past EOL as of this writing and since some distributions have started
dropping all support for Python 2, we will almost certainly want to
drop all Python 2 support in the relatively near future, if only
because it's not really to do all the packaging right for both
versions at once without much more trouble than a dead language
dialect is probably worth. All platforms we care about should support
Python 3 already, any that don't probably have much worse problems.
So the primary purpose of pushing this particular commit is to archive
what will probably be the last version supporting Python 2, while
giving folks a chance to test the incoming Python 3 support a bit.
Once we've cut loose from Python 2 for good, there's some cleanup we
can and should do (eg, all the gymnastics to work around Python 2's
handling of bytes as a form of text rather than a sequence of small
integers), but for the moment we want to keep that compatability,
albeit briefly.
---
.gitmodules | 3 +++
scripts/build-debian-control-files.py | 7 ++++++-
source/Makefile | 4 +++-
source/debian/rules | 2 +-
4 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/.gitmodules b/.gitmodules
index cce38ea..ed365da 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -43,12 +43,15 @@
[submodule "source/sw/libhal"]
path = source/sw/libhal
url = https://git.cryptech.is/sw/libhal.git
+ branch = python3
[submodule "source/sw/pkcs11"]
path = source/sw/pkcs11
url = https://git.cryptech.is/sw/pkcs11.git
+ branch = python3
[submodule "source/sw/stm32"]
path = source/sw/stm32
url = https://git.cryptech.is/sw/stm32.git
+ branch = python3
[submodule "source/sw/thirdparty/libtfm"]
path = source/sw/thirdparty/libtfm
url = https://git.cryptech.is/sw/thirdparty/libtfm.git
diff --git a/scripts/build-debian-control-files.py b/scripts/build-debian-control-files.py
index 9817248..c06055d 100755
--- a/scripts/build-debian-control-files.py
+++ b/scripts/build-debian-control-files.py
@@ -26,7 +26,8 @@ Standards-Version: 3.9.6
Build-Depends: debhelper (>= 9),
dh-python,
python (>= 2.7),
- python-yaml
+ python-yaml,
+ python3
Homepage: http://trac.cryptech.is/wiki
Package: {args.package}
@@ -35,6 +36,10 @@ Depends: python,
python-serial (>= 3.0),
python-tornado (>= 4.0),
python-crypto,
+ python3,
+ python3-serial (>= 3.0),
+ python3-tornado (>= 4.0),
+ python3-crypto,
${{misc:Depends}},
${{python:Depends}},
${{shlibs:Depends}}
diff --git a/source/Makefile b/source/Makefile
index 5095766..5913f47 100644
--- a/source/Makefile
+++ b/source/Makefile
@@ -22,4 +22,6 @@ 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
- python setup.py install --install-layout=deb --root=${DESTDIR}
+ python2 setup.py install --install-layout=deb --root=${DESTDIR}
+ python3 setup.py install --install-layout=deb --root=${DESTDIR}
+ find ${DESTDIR} -type d -name __pycache__ -exec rm -rf {} +
diff --git a/source/debian/rules b/source/debian/rules
index a0c3a65..0a37e86 100755
--- a/source/debian/rules
+++ b/source/debian/rules
@@ -19,7 +19,7 @@ include /usr/share/dpkg/default.mk
include /usr/share/dpkg/pkg-info.mk
%:
- dh $@ --with python2
+ dh $@ --with python2,python3
# Distinct binary package versions for a single source package built
# on multiple releases, to keep reprepro happy. See:
More information about the Commits
mailing list