Vadim Yanitskiy has uploaded this change for review. ( 
https://gerrit.osmocom.org/12193


Change subject: trx_toolkit: merge copyright.py into app_common.py
......................................................................

trx_toolkit: merge copyright.py into app_common.py

Change-Id: I8b70ec2dd08cb2ffed733d2c4e1215b094f8d3d5
---
M src/target/trx_toolkit/app_common.py
M src/target/trx_toolkit/burst_gen.py
M src/target/trx_toolkit/burst_send.py
M src/target/trx_toolkit/clck_gen.py
D src/target/trx_toolkit/copyright.py
M src/target/trx_toolkit/ctrl_cmd.py
M src/target/trx_toolkit/fake_trx.py
M src/target/trx_toolkit/trx_sniff.py
8 files changed, 25 insertions(+), 32 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/93/12193/1

diff --git a/src/target/trx_toolkit/app_common.py 
b/src/target/trx_toolkit/app_common.py
index ed6878f..146956b 100644
--- a/src/target/trx_toolkit/app_common.py
+++ b/src/target/trx_toolkit/app_common.py
@@ -29,6 +29,17 @@
        # Example: [DEBUG] ctrl_if_bts.py:71 Recv POWEROFF cmd
        LOG_FMT_DEFAULT = "[%(levelname)s] %(filename)s:%(lineno)d %(message)s"

+       def app_print_copyright(self, holders = []):
+               # Print copyright holders if any
+               for date, author in holders:
+                       print("Copyright (C) %s by %s" % (date, author))
+
+               # Print the license header itself
+               print("License GPLv2+: GNU GPL version 2 or later " \
+                       "<http://gnu.org/licenses/gpl.html>\n" \
+                       "This is free software: you are free to change and 
redistribute it.\n" \
+                       "There is NO WARRANTY, to the extent permitted by 
law.\n")
+
        def app_init_logging(self, argv):
                # Default logging handler (stderr)
                sh = log.StreamHandler()
diff --git a/src/target/trx_toolkit/burst_gen.py 
b/src/target/trx_toolkit/burst_gen.py
index 1c18b3c..b62f48c 100755
--- a/src/target/trx_toolkit/burst_gen.py
+++ b/src/target/trx_toolkit/burst_gen.py
@@ -23,8 +23,7 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

-from copyright import print_copyright
-CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <[email protected]>")]
+APP_CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <[email protected]>")]

 import logging as log
 import signal
@@ -40,7 +39,7 @@

 class Application(ApplicationBase):
        def __init__(self):
-               print_copyright(CR_HOLDERS)
+               self.app_print_copyright(APP_CR_HOLDERS)
                self.argv = self.parse_argv()

                # Set up signal handlers
diff --git a/src/target/trx_toolkit/burst_send.py 
b/src/target/trx_toolkit/burst_send.py
index 16db222..3745b39 100755
--- a/src/target/trx_toolkit/burst_send.py
+++ b/src/target/trx_toolkit/burst_send.py
@@ -22,8 +22,7 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

-from copyright import print_copyright
-CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <[email protected]>")]
+APP_CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <[email protected]>")]

 import logging as log
 import signal
@@ -38,7 +37,7 @@

 class Application(ApplicationBase):
        def __init__(self):
-               print_copyright(CR_HOLDERS)
+               self.app_print_copyright(APP_CR_HOLDERS)
                self.argv = self.parse_argv()

                # Set up signal handlers
diff --git a/src/target/trx_toolkit/clck_gen.py 
b/src/target/trx_toolkit/clck_gen.py
index 56207f4..40964dd 100755
--- a/src/target/trx_toolkit/clck_gen.py
+++ b/src/target/trx_toolkit/clck_gen.py
@@ -22,14 +22,14 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

-from copyright import print_copyright
-CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <[email protected]>")]
+APP_CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <[email protected]>")]

 import logging as log
 import signal
 import time
 import sys

+from app_common import ApplicationBase
 from threading import Timer
 from udp_link import UDPLink
 from gsm_shared import *
@@ -94,10 +94,10 @@
                self.timer.start()

 # Just a wrapper for independent usage
-class Application:
+class Application(ApplicationBase):
        def __init__(self):
                # Print copyright
-               print_copyright(CR_HOLDERS)
+               self.app_print_copyright(APP_CR_HOLDERS)

                # Set up signal handlers
                signal.signal(signal.SIGINT, self.sig_handler)
diff --git a/src/target/trx_toolkit/copyright.py 
b/src/target/trx_toolkit/copyright.py
deleted file mode 100644
index 3d3597f..0000000
--- a/src/target/trx_toolkit/copyright.py
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env python2
-# -*- coding: utf-8 -*-
-
-def print_copyright(holders = []):
-       # Print copyright holders if any
-       for date, author in holders:
-               print("Copyright (C) %s by %s" % (date, author))
-
-       # Print the license header itself
-       print("License GPLv2+: GNU GPL version 2 or later " \
-               "<http://gnu.org/licenses/gpl.html>\n" \
-               "This is free software: you are free to change and redistribute 
it.\n" \
-               "There is NO WARRANTY, to the extent permitted by law.\n")
diff --git a/src/target/trx_toolkit/ctrl_cmd.py 
b/src/target/trx_toolkit/ctrl_cmd.py
index ffc3e46..28815c2 100755
--- a/src/target/trx_toolkit/ctrl_cmd.py
+++ b/src/target/trx_toolkit/ctrl_cmd.py
@@ -23,8 +23,7 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

-from copyright import print_copyright
-CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <[email protected]>")]
+APP_CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <[email protected]>")]

 import logging as log
 import signal
@@ -37,7 +36,7 @@

 class Application(ApplicationBase):
        def __init__(self):
-               print_copyright(CR_HOLDERS)
+               self.app_print_copyright(APP_CR_HOLDERS)
                self.argv = self.parse_argv()

                # Set up signal handlers
diff --git a/src/target/trx_toolkit/fake_trx.py 
b/src/target/trx_toolkit/fake_trx.py
index a45ce20..d73b566 100755
--- a/src/target/trx_toolkit/fake_trx.py
+++ b/src/target/trx_toolkit/fake_trx.py
@@ -22,8 +22,7 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

-from copyright import print_copyright
-CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <[email protected]>")]
+APP_CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <[email protected]>")]

 import logging as log
 import signal
@@ -42,7 +41,7 @@

 class Application(ApplicationBase):
        def __init__(self):
-               print_copyright(CR_HOLDERS)
+               self.app_print_copyright(APP_CR_HOLDERS)
                self.argv = self.parse_argv()

                # Set up signal handlers
diff --git a/src/target/trx_toolkit/trx_sniff.py 
b/src/target/trx_toolkit/trx_sniff.py
index 7a87351..e169c72 100755
--- a/src/target/trx_toolkit/trx_sniff.py
+++ b/src/target/trx_toolkit/trx_sniff.py
@@ -22,8 +22,7 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

-from copyright import print_copyright
-CR_HOLDERS = [("2018", "Vadim Yanitskiy <[email protected]>")]
+APP_CR_HOLDERS = [("2018", "Vadim Yanitskiy <[email protected]>")]

 import logging as log
 import signal
@@ -48,7 +47,7 @@
        lo_trigger = False

        def __init__(self):
-               print_copyright(CR_HOLDERS)
+               self.app_print_copyright(APP_CR_HOLDERS)
                self.argv = self.parse_argv()

                # Configure logging

--
To view, visit https://gerrit.osmocom.org/12193
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8b70ec2dd08cb2ffed733d2c4e1215b094f8d3d5
Gerrit-Change-Number: 12193
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <[email protected]>

Reply via email to