This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
fixeria gerrit-no-reply at lists.osmocom.orgfixeria has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/15504 ) Change subject: Python 2 is deprecated, remove backwards compatibility chunks ...................................................................... Python 2 is deprecated, remove backwards compatibility chunks pySim has already been migrated to Python 3 in another change [1], and the build verification has been migrated to Debian 10 with Python 3.7. However, there is still some backwards compatibility code left. Let's get rid of it. [1] Ic78da9c03e99f59d142c93394051bbc2751f0205 Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org> Tweaked-by: Vadim Yanitskiy <vyanitskiy at sysmocom.de> Change-Id: I430d173535e0cd5bb895b9dfc9070cbc40cfc8ff --- M pySim-prog.py M pySim/utils.py M tests/pysim-test.sh 3 files changed, 6 insertions(+), 17 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved diff --git a/pySim-prog.py b/pySim-prog.py index 4f54963..662824c 100755 --- a/pySim-prog.py +++ b/pySim-prog.py @@ -31,12 +31,7 @@ import re import sys import traceback - -try: - import json -except ImportError: - # Python < 2.5 - import simplejson as json +import json from pySim.commands import SimCardCommands from pySim.cards import _cards_classes, card_detect diff --git a/pySim/utils.py b/pySim/utils.py index f7190d4..6dbd980 100644 --- a/pySim/utils.py +++ b/pySim/utils.py @@ -720,20 +720,13 @@ if not len(addr): return None - import sys - # Handle python3 and python2 - unicode - if sys.version_info[0] < 3: - addr_str = unicode(addr) - else: - addr_str = addr - addr_list = addr.split('.') # Check for IPv4/IPv6 try: import ipaddress # Throws ValueError if addr is not correct - ipa = ipaddress.ip_address(addr_str) + ipa = ipaddress.ip_address(addr) if ipa.version == 4: return 0x01 diff --git a/tests/pysim-test.sh b/tests/pysim-test.sh index 7ee9834..4004c18 100755 --- a/tests/pysim-test.sh +++ b/tests/pysim-test.sh @@ -23,6 +23,7 @@ PYSIM_PROG=../pySim-prog.py PYSIM_READ=../pySim-read.py TEMPFILE=temp.tmp +PYTHON=python3 set -e @@ -76,7 +77,7 @@ CARD_NAME=$2 echo "Verifying card ..." stat ./$CARD_NAME.ok > /dev/null - python $PYSIM_READ -p $TERMINAL > $TEMPFILE + $PYTHON $PYSIM_READ -p $TERMINAL > $TEMPFILE set +e CARD_DIFF=$(diff $TEMPFILE ./$CARD_NAME.ok) set -e @@ -106,7 +107,7 @@ function gen_ok_file { TERMINAL=$1 CARD_NAME=$2 - python $PYSIM_READ -p $TERMINAL > "$CARD_NAME.ok" + $PYTHON $PYSIM_READ -p $TERMINAL > "$CARD_NAME.ok" echo "Generated file: $CARD_NAME.ok" echo "------------8<------------" cat "$CARD_NAME.ok" @@ -166,7 +167,7 @@ ADM_OPT="-A" ADM=$ADM_HEX fi - python $PYSIM_PROG -p $I -t $CARD_NAME -o $OPC -k $KI -x $MCC -y $MNC -i $IMSI -s $ICCID --msisdn $MSISDN $ADM_OPT $ADM + $PYTHON $PYSIM_PROG -p $I -t $CARD_NAME -o $OPC -k $KI -x $MCC -y $MNC -i $IMSI -s $ICCID --msisdn $MSISDN $ADM_OPT $ADM check_card $I $CARD_NAME echo "" done -- To view, visit https://gerrit.osmocom.org/c/pysim/+/15504 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I430d173535e0cd5bb895b9dfc9070cbc40cfc8ff Gerrit-Change-Number: 15504 Gerrit-PatchSet: 22 Gerrit-Owner: gnutoo <GNUtoo at cyberdimension.org> Gerrit-Reviewer: Hoernchen <ewild at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de> Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210307/40ff512b/attachment.htm>