]> arthur.barton.de Git - bup.git/commitdiff
Require python 3.7+
authorRob Browning <rlb@defaultvalue.org>
Sat, 25 Jun 2022 07:37:06 +0000 (02:37 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sun, 11 Sep 2022 20:46:28 +0000 (15:46 -0500)
We've specified this requirement for a while; enforce it before the
release.

lib/bup/cmd/save.py
lib/bup/compat.py
lib/cmd/bup.c

index 88f74d77b9216bac94acdca2bc3a4360c97b6969..78fc79d2bbc152dfd4c0a83e96533c0bb05b09bd 100644 (file)
@@ -5,7 +5,7 @@ from errno import ENOENT
 from io import BytesIO
 import math, os, stat, sys, time
 
-from bup import compat, hashsplit, git, options, index, client, metadata
+from bup import hashsplit, git, options, index, client, metadata
 from bup import hlinkdb
 from bup.compat import argv_bytes, environ, nullcontext
 from bup.hashsplit import GIT_MODE_TREE, GIT_MODE_FILE, GIT_MODE_SYMLINK
@@ -463,12 +463,9 @@ def save_tree(opt, reader, hlink_db, msr, w):
 
 
 def commit_tree(tree, parent, date, argv, writer):
-    if compat.py_maj > 2:
-        # Strip b prefix from python 3 bytes reprs to preserve previous format
-         msgcmd = b'[%s]' % b', '.join([repr(argv_bytes(x))[1:].encode('ascii')
-                                       for x in argv])
-    else:
-        msgcmd = repr(argv)
+    # Strip b prefix from python 3 bytes reprs to preserve previous format
+    msgcmd = b'[%s]' % b', '.join([repr(argv_bytes(x))[1:].encode('ascii')
+                                   for x in argv])
     msg = b'bup save\n\nGenerated by command:\n%s\n' % msgcmd
     userline = (b'%s <%s@%s>' % (userfullname(), username(), hostname()))
     return writer.new_commit(tree, parent, userline, date, None,
index 96a228b78ded01d4c40b4f1a57f2c0e3128ac46b..8dc1a51fcde08ee586533a5e158645c0801ace3a 100644 (file)
@@ -1,15 +1,10 @@
 
-import os, sys
-
-py_maj = sys.version_info.major
-assert py_maj >= 3
-
 # pylint: disable=unused-import
 from contextlib import ExitStack, nullcontext
 from os import environb as environ
 from os import fsdecode, fsencode
 from shlex import quote
-
+import os, sys
 
 def hexstr(b):
     """Return hex string (not bytes as with hexlify) representation of b."""
index 0d002a91c8bee8fea55d71179e0ff5861aa799dc..e61f10610c4bb98eb673c86cd947e01584329c10 100644 (file)
@@ -7,6 +7,14 @@
 //   http://docs.python.org/3/c-api/intro.html#include-files
 #include <Python.h>
 
+#if PY_MAJOR_VERSION < 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 7)
+#define BUP_STR(x) #x
+#define BUP_XSTR(x) BUP_STR(x)
+#pragma message "Python versions older than 3.7 are not supported; detected X.Y " \
+    BUP_XSTR(PY_MAJOR_VERSION) "." BUP_XSTR(PY_MINOR_VERSION)
+#error "Halting"
+#endif
+
 #include <libgen.h>
 #include <limits.h>
 #include <stdarg.h>