Skip to content

Commit

Permalink
Use Python 3 print function in build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
azuresol committed Jun 5, 2017
1 parent 1054755 commit e168097
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion bessctl/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def print_banner(self):

def process_one_line(self):
if self.interactive:
try: # Hack for Python 2/3 compatibi
try: # Hack for Python 2/3 compatibility
input = raw_input
except NameError:
pass
Expand Down
11 changes: 6 additions & 5 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,23 @@ def check_c_lib(lib):

def required(header_file, lib_name, compiler):
if not check_header(header_file, compiler):
print >> sys.stderr, 'Error - #include <%s> failed. ' \
'Did you install "%s" package?' % (header_file, lib_name)
print('Error - #include <%s> failed. '
'Did you install "%s" package?'
% (header_file, lib_name), file=sys.stderr)
sys.exit(1)


def check_essential():
if not cmd_success('gcc -v'):
print >> sys.stderr, 'Error - "gcc" is not available'
print('Error - "gcc" is not available', file=sys.stderr)
sys.exit(1)

if not cmd_success('g++ -v'):
print >> sys.stderr, 'Error - "g++" is not available'
print('Error - "g++" is not available', file=sys.stderr)
sys.exit(1)

if not cmd_success('make -v'):
print >> sys.stderr, 'Error - "make" is not available'
print('Error - "make" is not available', file=sys.stderr)
sys.exit(1)

required('pcap/pcap.h', 'libpcap-dev', 'gcc')
Expand Down
15 changes: 8 additions & 7 deletions container_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def run_cmd(cmd):
proc.communicate()

if proc.returncode:
print >> sys.stderr, 'Error has occured running host command: %s' % cmd
print('Error has occured running host command: %s' % cmd,
file=sys.stderr)
sys.exit(proc.returncode)


Expand Down Expand Up @@ -48,7 +49,7 @@ def build_kmod():
try:
run_docker_cmd('%s kmod' % BUILD_SCRIPT)
except:
print >> sys.stderr, '*** module build has failed.'
print('*** module build has failed.', file=sys.stderr)


def build_kmod_buildtest():
Expand All @@ -73,10 +74,9 @@ def do_dist_clean():


def print_usage():
print >> sys.stderr, \
'Usage: %s ' \
'[all|bess|kmod|kmod_buildtest|clean|dist_clean|shell||help]' % \
sys.argv[0]
print('Usage: %s '
'[all|bess|kmod|kmod_buildtest|clean|dist_clean|shell||help]'
% sys.argv[0], file=sys.stderr)


def main():
Expand Down Expand Up @@ -104,7 +104,8 @@ def main():
print_usage()
sys.exit(0)
else:
print >> sys.stderr, 'Error - unknown command "%s".' % sys.argv[1]
print('Error - unknown command "%s".' % sys.argv[1],
file=sys.stderr)
print_usage()
sys.exit(2)
else:
Expand Down

0 comments on commit e168097

Please sign in to comment.