diff options
-rw-r--r-- | .SRCINFO | 22 | ||||
-rw-r--r-- | 0001-pySim-shell.py-make-it-work-with-cmd2-v2.0.0.patch | 53 | ||||
-rw-r--r-- | 0002-pySim-shell.py-make-it-work-with-cmd2-v2.4.0.patch | 78 | ||||
-rw-r--r-- | PKGBUILD | 33 |
4 files changed, 168 insertions, 18 deletions
@@ -1,25 +1,31 @@ pkgbase = python-pysim-git pkgdesc = A python tool to program SIMs / USIMs / ISIMs - pkgver = 1.0.r175.gb07a3e9 + pkgver = 1.0.r442.g4e64e727 pkgrel = 1 - url = http://osmocom.org/projects/pysim/wiki + url = https://osmocom.org/projects/pysim/wiki arch = any license = GPL2 makedepends = python-setuptools makedepends = git depends = python - depends = python-pyscard - depends = python-pyserial - depends = python-pytlv + depends = python-bidict depends = python-cmd2>=1.3.0 - depends = python-jsonpath-ng + depends = python-colorlog depends = python-construct>=2.9 - depends = python-bidict depends = python-gsm0338 + depends = python-jsonpath-ng + depends = python-pyscard + depends = python-pyserial + depends = python-pytlv + depends = python-termcolor + depends = python-yaml>=5.1 provides = python-pysim source = git+https://git.osmocom.org/pysim + source = 0001-pySim-shell.py-make-it-work-with-cmd2-v2.0.0.patch + source = 0002-pySim-shell.py-make-it-work-with-cmd2-v2.4.0.patch sha256sums = SKIP + sha256sums = 2eb84bfbd29c8cda42b53d5523e71be8beada766b1fd4970d3ce527852797716 + sha256sums = b9daf3e3ec027731afeecba8b0d501963944403e6d770a127d35f70c1bacf97c pkgname = python-pysim-git install = python-pysim-git.install - diff --git a/0001-pySim-shell.py-make-it-work-with-cmd2-v2.0.0.patch b/0001-pySim-shell.py-make-it-work-with-cmd2-v2.0.0.patch new file mode 100644 index 000000000000..f8f8d9044bc5 --- /dev/null +++ b/0001-pySim-shell.py-make-it-work-with-cmd2-v2.0.0.patch @@ -0,0 +1,53 @@ +From d5c1bec8697ee0a9fd93ba8a9c2ba1e161a1724b Mon Sep 17 00:00:00 2001 +From: Vadim Yanitskiy <vyanitskiy@sysmocom.de> +Date: Sun, 13 Feb 2022 22:25:16 +0600 +Subject: [PATCH 1/2] pySim-shell.py: make it work with cmd2 >= v2.0.0 + +* Argument 'use_ipython' was renamed to 'use_ipython'. +* Class 'Settable' requires the reference to the object that holds + the settable attribute. + +See https://github.com/python-cmd2/cmd2/releases/tag/2.0.0. + +Change-Id: Ia38f0ca5c3f41395f8fe850adae37f5af4e3fe19 +--- + pySim-shell.py | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/pySim-shell.py b/pySim-shell.py +index ef6a2b1..8759cc2 100755 +--- a/pySim-shell.py ++++ b/pySim-shell.py +@@ -134,7 +134,7 @@ class PysimApp(cmd2.Cmd): + + def __init__(self, card, rs, sl, ch, script=None): + super().__init__(persistent_history_file='~/.pysim_shell_history', allow_cli_args=False, +- use_ipython=True, auto_load_commands=False, startup_script=script) ++ auto_load_commands=False, startup_script=script) + self.intro = style('Welcome to pySim-shell!', fg=fg.red) + self.default_category = 'pySim-shell built-in commands' + self.card = None +@@ -145,16 +145,16 @@ class PysimApp(cmd2.Cmd): + self.ch = ch + + self.numeric_path = False +- self.add_settable(cmd2.Settable('numeric_path', bool, 'Print File IDs instead of names', ++ self.add_settable(cmd2.Settable('numeric_path', bool, 'Print File IDs instead of names', self, + onchange_cb=self._onchange_numeric_path)) + self.conserve_write = True +- self.add_settable(cmd2.Settable('conserve_write', bool, 'Read and compare before write', ++ self.add_settable(cmd2.Settable('conserve_write', bool, 'Read and compare before write', self, + onchange_cb=self._onchange_conserve_write)) + self.json_pretty_print = True + self.add_settable(cmd2.Settable('json_pretty_print', +- bool, 'Pretty-Print JSON output')) ++ bool, 'Pretty-Print JSON output', self)) + self.apdu_trace = False +- self.add_settable(cmd2.Settable('apdu_trace', bool, 'Trace and display APDUs exchanged with card', ++ self.add_settable(cmd2.Settable('apdu_trace', bool, 'Trace and display APDUs exchanged with card', self, + onchange_cb=self._onchange_apdu_trace)) + + self.equip(card, rs) +-- +2.37.3 + diff --git a/0002-pySim-shell.py-make-it-work-with-cmd2-v2.4.0.patch b/0002-pySim-shell.py-make-it-work-with-cmd2-v2.4.0.patch new file mode 100644 index 000000000000..535d65fcd849 --- /dev/null +++ b/0002-pySim-shell.py-make-it-work-with-cmd2-v2.4.0.patch @@ -0,0 +1,78 @@ +From 8f388006431fc1cc9cf6b6ce5c19f4ff455b754d Mon Sep 17 00:00:00 2001 +From: Vadim Yanitskiy <vyanitskiy@sysmocom.de> +Date: Thu, 14 Jul 2022 19:06:54 +0700 +Subject: [PATCH 2/2] pySim-shell.py: make it work with cmd2 >= v2.4.0 + +In v2.3.0 both cmd2.{fg,bg} have been deprecated in favour of cmd2.{Fg,Bg}. +In v2.4.0 both cmd2.{fg,bg} have been removed. + +See https://github.com/python-cmd2/cmd2/blob/master/CHANGELOG.md + +Change-Id: I7ca95e85fc45ba66fd9ba6bea1fec2bae0e892c0 +--- + pySim-shell.py | 32 ++++++++++++++++---------------- + 1 file changed, 16 insertions(+), 16 deletions(-) + +diff --git a/pySim-shell.py b/pySim-shell.py +index 8759cc2..831c775 100755 +--- a/pySim-shell.py ++++ b/pySim-shell.py +@@ -23,7 +23,7 @@ import json + import traceback + + import cmd2 +-from cmd2 import style, fg ++from cmd2 import style, Fg + from cmd2 import CommandSet, with_default_category, with_argparser + import argparse + +@@ -135,7 +135,7 @@ class PysimApp(cmd2.Cmd): + def __init__(self, card, rs, sl, ch, script=None): + super().__init__(persistent_history_file='~/.pysim_shell_history', allow_cli_args=False, + auto_load_commands=False, startup_script=script) +- self.intro = style('Welcome to pySim-shell!', fg=fg.red) ++ self.intro = style('Welcome to pySim-shell!', fg=Fg.RED) + self.default_category = 'pySim-shell built-in commands' + self.card = None + self.rs = None +@@ -287,23 +287,23 @@ class PysimApp(cmd2.Cmd): + sys.stderr = self._stderr_backup + + def _show_failure_sign(self): +- self.poutput(style(" +-------------+", fg=fg.bright_red)) +- self.poutput(style(" + ## ## +", fg=fg.bright_red)) +- self.poutput(style(" + ## ## +", fg=fg.bright_red)) +- self.poutput(style(" + ### +", fg=fg.bright_red)) +- self.poutput(style(" + ## ## +", fg=fg.bright_red)) +- self.poutput(style(" + ## ## +", fg=fg.bright_red)) +- self.poutput(style(" +-------------+", fg=fg.bright_red)) ++ self.poutput(style(" +-------------+", fg=Fg.LIGHT_RED)) ++ self.poutput(style(" + ## ## +", fg=Fg.LIGHT_RED)) ++ self.poutput(style(" + ## ## +", fg=Fg.LIGHT_RED)) ++ self.poutput(style(" + ### +", fg=Fg.LIGHT_RED)) ++ self.poutput(style(" + ## ## +", fg=Fg.LIGHT_RED)) ++ self.poutput(style(" + ## ## +", fg=Fg.LIGHT_RED)) ++ self.poutput(style(" +-------------+", fg=Fg.LIGHT_RED)) + self.poutput("") + + def _show_success_sign(self): +- self.poutput(style(" +-------------+", fg=fg.bright_green)) +- self.poutput(style(" + ## +", fg=fg.bright_green)) +- self.poutput(style(" + ## +", fg=fg.bright_green)) +- self.poutput(style(" + # ## +", fg=fg.bright_green)) +- self.poutput(style(" + ## # +", fg=fg.bright_green)) +- self.poutput(style(" + ## +", fg=fg.bright_green)) +- self.poutput(style(" +-------------+", fg=fg.bright_green)) ++ self.poutput(style(" +-------------+", fg=Fg.LIGHT_GREEN)) ++ self.poutput(style(" + ## +", fg=Fg.LIGHT_GREEN)) ++ self.poutput(style(" + ## +", fg=Fg.LIGHT_GREEN)) ++ self.poutput(style(" + # ## +", fg=Fg.LIGHT_GREEN)) ++ self.poutput(style(" + ## # +", fg=Fg.LIGHT_GREEN)) ++ self.poutput(style(" + ## +", fg=Fg.LIGHT_GREEN)) ++ self.poutput(style(" +-------------+", fg=Fg.LIGHT_GREEN)) + self.poutput("") + + def _process_card(self, first, script_path): +-- +2.37.3 + @@ -1,33 +1,46 @@ -# Maintainer: Robert Falkenberg <robert.falkenberg@tu-dortmund.de> +# Maintainer: Robert Falkenberg <falkenber9@gmail.com> pkgname=python-pysim-git _pyname=${pkgname#python-} _pyname=${_pyname%-git} -pkgver=1.0.r175.gb07a3e9 +pkgver=1.0.r442.g4e64e727 pkgrel=1 pkgdesc='A python tool to program SIMs / USIMs / ISIMs' arch=('any') -url='http://osmocom.org/projects/pysim/wiki' +url='https://osmocom.org/projects/pysim/wiki' license=('GPL2') depends=('python' + 'python-bidict' + 'python-cmd2>=1.3.0' + 'python-colorlog' + 'python-construct>=2.9' + 'python-gsm0338' + 'python-jsonpath-ng' 'python-pyscard' 'python-pyserial' 'python-pytlv' - 'python-cmd2>=1.3.0' - 'python-jsonpath-ng' - 'python-construct>=2.9' - 'python-bidict' - 'python-gsm0338') + 'python-termcolor' + 'python-yaml>=5.1') makedepends=('python-setuptools' 'git') provides=('python-pysim') -source=('git+https://git.osmocom.org/pysim') -sha256sums=('SKIP') +source=('git+https://git.osmocom.org/pysim' + '0001-pySim-shell.py-make-it-work-with-cmd2-v2.0.0.patch' + '0002-pySim-shell.py-make-it-work-with-cmd2-v2.4.0.patch') +sha256sums=('SKIP' + '2eb84bfbd29c8cda42b53d5523e71be8beada766b1fd4970d3ce527852797716' + 'b9daf3e3ec027731afeecba8b0d501963944403e6d770a127d35f70c1bacf97c') pkgver() { cd ${_pyname} git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g' | sed 's/^\(v\)\1*//' } +prepare() { + # apply patches for compatibility with newer cmd2 versions + patch --directory="${_pyname}" -p1 -i "$srcdir/0001-pySim-shell.py-make-it-work-with-cmd2-v2.0.0.patch" + patch --directory="${_pyname}" -p1 -i "$srcdir/0002-pySim-shell.py-make-it-work-with-cmd2-v2.4.0.patch" +} + package() { install=$pkgname.install cd "${srcdir}/${_pyname}" |