Skip to content

Commit

Permalink
Require python 3.7+
Browse files Browse the repository at this point in the history
We've specified this requirement for a while; enforce it before the
release.
  • Loading branch information
rlbdv committed Sep 11, 2022
1 parent fa23889 commit a72b339
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
11 changes: 4 additions & 7 deletions lib/bup/cmd/save.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
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
Expand Down Expand Up @@ -463,12 +463,9 @@ def new_blob(data):


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,
Expand Down
7 changes: 1 addition & 6 deletions lib/bup/compat.py
Original file line number Diff line number Diff line change
@@ -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."""
Expand Down
8 changes: 8 additions & 0 deletions lib/cmd/bup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit a72b339

Please sign in to comment.