Skip to content

Commit 15e7f87

Browse files
Use old version if that's all we have
1 parent 3b2cc49 commit 15e7f87

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

tools/python/memap/memap.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
from typing import Optional, TextIO
5252
from abc import abstractmethod, ABC
5353
from sys import stdout, exit, argv, path
54+
import sys
5455
from os import sep
5556
from os.path import (basename, dirname, join, relpath, abspath, commonprefix,
5657
splitext)
@@ -61,6 +62,14 @@
6162
from copy import deepcopy
6263
from collections import defaultdict
6364
from prettytable import PrettyTable, HRuleStyle
65+
66+
# prettytable moved this constant into an enum in the Python 3.9 release.
67+
if sys.version_info >= (3, 9):
68+
from prettytable import HRuleStyle
69+
HEADER = HRuleStyle.HEADER
70+
else:
71+
from prettytable import HEADER
72+
6473
from jinja2 import FileSystemLoader, StrictUndefined
6574
from jinja2.environment import Environment
6675

tools/requirements.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
prettytable>=3.12.0 # 3.12.0 both added HRuleStyle and deprecated the old constants in one single release :/
1+
2+
# 3.12.0 both added HRuleStyle and deprecated the old constants in one single release :/
3+
prettytable>=2.0,<3.12.0; python_version < '3.9'
4+
prettytable>=3.12.0; python_version >= '3.9'
5+
26
future>=0.18.0,<1.0
37
jinja2>=2.11.3
48
intelhex>=2.3.0,<3.0.0

0 commit comments

Comments
 (0)