fake_trx: unify the GPL license header

There is no need to manually put the license header as a variable
in each application in order to print it. Let's use a common one.

Change-Id: I1a6e8716a9069e7ade3ae15f2c04fd45d18e223c
This commit is contained in:
Vadim Yanitskiy 2018-03-12 20:48:24 +07:00
parent 4ccb2261b1
commit c08ddc7383
7 changed files with 41 additions and 61 deletions

View File

@ -22,6 +22,9 @@
# 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@gmail.com>")]
import signal
import getopt
import sys
@ -32,13 +35,6 @@ from data_if import DATAInterface
from gsm_shared import *
from data_msg import *
COPYRIGHT = \
"Copyright (C) 2017 by Vadim Yanitskiy <axilirator@gmail.com>\n" \
"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"
class Application:
# Application variables
remote_addr = "127.0.0.1"
@ -59,7 +55,7 @@ class Application:
pwr = None
def __init__(self):
self.print_copyright()
print_copyright(CR_HOLDERS)
self.parse_argv()
self.check_argv()
@ -143,9 +139,6 @@ class Application:
if self.output_file is not None:
self.ddf.append_msg(msg)
def print_copyright(self):
print(COPYRIGHT)
def print_help(self, msg = None):
s = " Usage: " + sys.argv[0] + " [options]\n\n" \
" Some help...\n" \

View File

@ -21,6 +21,9 @@
# 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@gmail.com>")]
import signal
import getopt
import sys
@ -30,13 +33,6 @@ from data_if import DATAInterface
from gsm_shared import *
from data_msg import *
COPYRIGHT = \
"Copyright (C) 2017-2018 by Vadim Yanitskiy <axilirator@gmail.com>\n" \
"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"
class Application:
# Application variables
remote_addr = "127.0.0.1"
@ -56,7 +52,7 @@ class Application:
pf_tn = None
def __init__(self):
self.print_copyright()
print_copyright(CR_HOLDERS)
self.parse_argv()
# Set up signal handlers
@ -119,9 +115,6 @@ class Application:
# Burst passed ;)
return True
def print_copyright(self):
print(COPYRIGHT)
def print_help(self, msg = None):
s = " Usage: " + sys.argv[0] + " [options]\n\n" \
" Some help...\n" \

View File

@ -4,7 +4,7 @@
# Virtual Um-interface (fake transceiver)
# Simple TDMA frame clock generator
#
# (C) 2017 by Vadim Yanitskiy <axilirator@gmail.com>
# (C) 2017-2018 by Vadim Yanitskiy <axilirator@gmail.com>
#
# All Rights Reserved
#
@ -22,6 +22,9 @@
# 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@gmail.com>")]
import signal
import time
import sys
@ -30,13 +33,6 @@ from threading import Timer
from udp_link import UDPLink
from gsm_shared import *
COPYRIGHT = \
"Copyright (C) 2017 by Vadim Yanitskiy <axilirator@gmail.com>\n" \
"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"
class CLCKGen:
# GSM TDMA definitions
SEC_DELAY_US = 1000 * 1000
@ -99,12 +95,12 @@ class CLCKGen:
# Just a wrapper for independent usage
class Application:
def __init__(self):
# Print copyright
print_copyright(CR_HOLDERS)
# Set up signal handlers
signal.signal(signal.SIGINT, self.sig_handler)
# Print copyright
print(COPYRIGHT)
def run(self):
self.link = UDPLink("127.0.0.1", 5800, 5700)
self.clck = CLCKGen([self.link], ind_period = 51)

View File

@ -0,0 +1,13 @@
#!/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")

View File

@ -22,6 +22,9 @@
# 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@gmail.com>")]
import signal
import getopt
import select
@ -29,13 +32,6 @@ import sys
from udp_link import UDPLink
COPYRIGHT = \
"Copyright (C) 2017-2018 by Vadim Yanitskiy <axilirator@gmail.com>\n" \
"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"
class Application:
# Application variables
remote_addr = "127.0.0.1"
@ -44,7 +40,7 @@ class Application:
fuzzing = False
def __init__(self):
print(COPYRIGHT)
print_copyright(CR_HOLDERS)
self.parse_argv()
# Set up signal handlers

View File

@ -4,7 +4,7 @@
# Virtual Um-interface (fake transceiver)
# OsmocomBB <-> OsmoBTS bridge
#
# (C) 2017 by Vadim Yanitskiy <axilirator@gmail.com>
# (C) 2017-2018 by Vadim Yanitskiy <axilirator@gmail.com>
#
# All Rights Reserved
#
@ -22,6 +22,9 @@
# 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@gmail.com>")]
import signal
import getopt
import select
@ -35,13 +38,6 @@ from fake_pm import FakePM
from udp_link import UDPLink
from clck_gen import CLCKGen
COPYRIGHT = \
"Copyright (C) 2017 by Vadim Yanitskiy <axilirator@gmail.com>\n" \
"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"
class Application:
# Application variables
bts_addr = "127.0.0.1"
@ -56,7 +52,7 @@ class Application:
randomize_ul_rssi = False
def __init__(self):
self.print_copyright()
print_copyright(CR_HOLDERS)
self.parse_argv()
# Set up signal handlers
@ -137,9 +133,6 @@ class Application:
# Stop clock generator
self.clck_gen.stop()
def print_copyright(self):
print(COPYRIGHT)
def print_help(self, msg = None):
s = " Usage: " + sys.argv[0] + " [options]\n\n" \
" Some help...\n" \

View File

@ -21,6 +21,9 @@
# 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@gmail.com>")]
import signal
import getopt
import sys
@ -30,13 +33,6 @@ import scapy.all
from data_dump import DATADumpFile
from data_msg import *
COPYRIGHT = \
"Copyright (C) 2018 by Vadim Yanitskiy <axilirator@gmail.com>\n" \
"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"
class Application:
# Application variables
sniff_interface = "lo"
@ -67,7 +63,7 @@ class Application:
lo_trigger = False
def __init__(self):
print(COPYRIGHT)
print_copyright(CR_HOLDERS)
self.parse_argv()
# Open requested capture file