Change in osmocom-bb[master]: trx_toolkit: merge copyright.py into app_common.py

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Dec 7 20:47:46 UTC 2018


Harald Welte has submitted this change and it was merged. ( 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

Since we have introduced ApplicationBase class, that are used
by all existing applications, let's merge the copyright
printing helper into it.

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(-)

Approvals:
  Jenkins Builder: Verified
  Stefan Sperling: Looks good to me, but someone else must approve
  Pau Espin Pedrol: Looks good to me, approved



diff --git a/src/target/trx_toolkit/app_common.py b/src/target/trx_toolkit/app_common.py
index 180e97c..9bcd593 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 <axilirator at gmail.com>")]
+APP_CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <axilirator at gmail.com>")]
 
 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 <axilirator at gmail.com>")]
+APP_CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <axilirator at gmail.com>")]
 
 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 <axilirator at gmail.com>")]
+APP_CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <axilirator at gmail.com>")]
 
 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 <axilirator at gmail.com>")]
+APP_CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <axilirator at gmail.com>")]
 
 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 <axilirator at gmail.com>")]
+APP_CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <axilirator at gmail.com>")]
 
 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 <axilirator at gmail.com>")]
+APP_CR_HOLDERS = [("2018", "Vadim Yanitskiy <axilirator at gmail.com>")]
 
 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: merged
Gerrit-Change-Id: I8b70ec2dd08cb2ffed733d2c4e1215b094f8d3d5
Gerrit-Change-Number: 12193
Gerrit-PatchSet: 3
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Stefan Sperling <stsp at stsp.name>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181207/f2468ceb/attachment.htm>


More information about the gerrit-log mailing list