Skip to content

Commit 746ae50

Browse files
authored
Merge pull request #5099 from StackStorm/py2_warn_change
Improve python2 pack warning when running on Python 3 environment
2 parents 0898b49 + da6a03d commit 746ae50

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

CHANGELOG.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ Added
1717

1818
Changed
1919
~~~~~~~~~
20+
* Updated deprecation warning for python 2 pack installs, following python 2 support removal. #5099
21+
Contributed by @amanda11
22+
2023
* Improve the st2-self-check script to echo to stderr and exit if it isn't run with a
2124
ST2_AUTH_TOKEN or ST2_API_KEY environment variable. (improvement) #5068
2225

st2common/st2common/util/pack.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,14 @@
4343
]
4444

4545
# Common format for python 2.7 warning
46-
PACK_PYTHON2_WARNING = "DEPRECATION WARNING: Pack %s only supports Python 2.x. " \
47-
"Python 2 support will be dropped in future releases. " \
48-
"Please consider updating your packs to work with Python 3.x"
46+
if six.PY2:
47+
PACK_PYTHON2_WARNING = "DEPRECATION WARNING: Pack %s only supports Python 2.x. " \
48+
"Python 2 support will be dropped in future releases. " \
49+
"Please consider updating your packs to work with Python 3.x"
50+
else:
51+
PACK_PYTHON2_WARNING = "DEPRECATION WARNING: Pack %s only supports Python 2.x. " \
52+
"Python 2 support has been removed since st2 v3.4.0. " \
53+
"Please update your packs to work with Python 3.x"
4954

5055

5156
def get_pack_ref_from_metadata(metadata, pack_directory_name=None):

0 commit comments

Comments
 (0)