Changeset 2711

Show
Ignore:
Timestamp:
11/06/17 01:23:03 (3 years ago)
Author:
jwoithe
Message:

Use "print()" rather than "print ..." in scons build scripts.

As a first step towards potentially supporting scons3, convert print
statements into function calls within the scons build scripts so as to be
compatible with both scons2 (python2) and scons3 (python3). This change
should not affect functionality under scons2; please report any regressions.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/SConstruct

    r2698 r2711  
    9494 
    9595if env.has_key('COMPILE_FLAGS') and len(env['COMPILE_FLAGS']) > 0: 
    96     print "The COMPILE_FLAGS option is deprecated. Use CFLAGS and CXXFLAGS with CUSTOM_ENV=True instead" 
     96    print("The COMPILE_FLAGS option is deprecated. Use CFLAGS and CXXFLAGS with CUSTOM_ENV=True instead") 
    9797    custom_flags = True 
    9898    env.MergeFlags(env['COMPILE_FLAGS']) 
     
    116116 
    117117if custom_flags: 
    118     print ''' 
     118    print(''' 
    119119 * Usage of additional flags is not supported by the ffado-devs. 
    120120 * Use at own risk! 
     
    126126 *   CXXFLAGS = %s 
    127127 *   LDFLAGS = %s 
    128 ''' % (env['CC'], env['CXX'], env['CFLAGS'], env['CXXFLAGS'], env['LINKFLAGS']) 
     128''' % (env['CC'], env['CXX'], env['CFLAGS'], env['CXXFLAGS'], env['LINKFLAGS'])) 
    129129 
    130130Help( """ 
     
    226226 
    227227def CheckJackdVer(): 
    228     print 'Checking jackd version...', 
     228    # Suppress newline in python 2 and 3 
     229    sys.stdout.write('Checking jackd version...') 
     230    sys.stdout.flush() 
    229231    ret = Popen("which jackd >/dev/null 2>&1 && jackd --version | tail -n 1 | cut -d ' ' -f 3", shell=True, stdout=PIPE).stdout.read()[:-1] 
    230232    if (ret == ""): 
    231         print "not installed" 
     233        print("not installed") 
    232234        return -1 
    233235    else: 
    234         print ret 
     236        print(ret) 
    235237    return VersionInt(ret) 
    236238 
     
    250252    # 
    251253    if not conf.CompilerCheck(): 
    252         print "\nIt seems as if your system isn't even able to compile any C-/C++-programs. Probably you don't have gcc and g++ installed. Compiling a package from source without a working compiler is very hard to do, please install the needed packages.\nHint: on *ubuntu you need both gcc- and g++-packages installed, easiest solution is to install build-essential which depends on gcc and g++." 
     254        print("\nIt seems as if your system isn't even able to compile any C-/C++-programs. Probably you don't have gcc and g++ installed. Compiling a package from source without a working compiler is very hard to do, please install the needed packages.\nHint: on *ubuntu you need both gcc- and g++-packages installed, easiest solution is to install build-essential which depends on gcc and g++.") 
    253255        Exit( 1 ) 
    254256 
    255257    # Check for pkg-config before using pkg-config to check for other dependencies. 
    256258    if not conf.CheckForPKGConfig(): 
    257         print "\nThe program 'pkg-config' could not be found.\nEither you have to install the corresponding package first or make sure that PATH points to the right directions." 
     259        print("\nThe program 'pkg-config' could not be found.\nEither you have to install the corresponding package first or make sure that PATH points to the right directions.") 
    258260        Exit( 1 ) 
    259261 
     
    302304    if env['ENABLE_SETBUFFERSIZE_API_VER'] == 'auto': 
    303305        if not(have_jack): 
    304             print """ 
     306            print(""" 
    305307No Jack Audio Connection Kit (JACK) installed: assuming a FFADO  
    306308setbuffersize-compatible version will be used. 
    307 """ 
     309""") 
    308310        elif not(good_jack1 or good_jack2): 
    309311            FFADO_API_VERSION="8" 
    310             print """ 
     312            print(""" 
    311313Installed Jack Audio Connection Kit (JACK) jack does not support FFADO  
    312314setbuffersize API: will report earlier API version at runtime.  Consider  
    313315upgrading to jack1 >=0.122.0 or jack2 >=1.9.9 at some point, and then  
    314316recompile ffado to gain access to this added feature. 
    315 """ 
     317""") 
    316318        else: 
    317             print "Installed Jack Audio Connection Kit (JACK) supports FFADO setbuffersize API" 
     319            print("Installed Jack Audio Connection Kit (JACK) supports FFADO setbuffersize API") 
    318320    elif env['ENABLE_SETBUFFERSIZE_API_VER'] == 'true': 
    319321        if (have_jack and not(good_jack1) and not(good_jack2)): 
    320             print """ 
     322            print(""" 
    321323SetBufferSize API version is enabled but no suitable version of Jack Audio  
    322324Connection Kit (JACK) has been found.  The resulting FFADO would cause your  
     
    324326jack1 >=0.122.0 or jack2 >=1.9.9, or set ENABLE_SETBUFFERSIZE_API_VER to "auto" 
    325327or "false". 
    326 """ 
     328""") 
    327329            # Although it's not strictly an error, in almost every case that  
    328330            # this occurs the user will want to know about it and fix the 
     
    331333            Exit( 1 ) 
    332334        else: 
    333             print "Will report SetBufferSize API version at runtime" 
     335            print("Will report SetBufferSize API version at runtime") 
    334336    elif env['ENABLE_SETBUFFERSIZE_API_VER'] == 'force': 
    335         print "Will report SetBufferSize API version at runtime" 
     337        print("Will report SetBufferSize API version at runtime") 
    336338    else: 
    337339        FFADO_API_VERSION="8" 
    338         print "Will not report SetBufferSize API version at runtime" 
     340        print("Will not report SetBufferSize API version at runtime") 
    339341 
    340342    for pkg in pkgs: 
    341343        name2 = pkg.replace("+","").replace(".","").replace("-","").upper() 
    342344        env['%s_FLAGS' % name2] = conf.GetPKGFlags( pkg, pkgs[pkg] ) 
    343         #print '%s_FLAGS' % name2 
     345        #print('%s_FLAGS' % name2) 
    344346        if env['%s_FLAGS'%name2] == 0: 
    345347            allpresent &= 0 
    346348 
    347349    if not allpresent: 
    348         print """ 
     350        print(""" 
    349351(At least) One of the dependencies is missing. I can't go on without it, please 
    350352install the needed packages for each of the lines saying "no". 
     
    353355And remember to remove the cache with "rm -Rf .sconsign.dblite cache" so the 
    354356results above get rechecked. 
    355 """ 
     357""") 
    356358        Exit( 1 ) 
    357359 
     
    402404        if env['BUILD_MIXER'] == 'auto': 
    403405            env['BUILD_MIXER'] = 'false' 
    404             print """ 
     406            print(""" 
    405407The prerequisites ('pyuic4'/'pyuic5' and the python-modules 'dbus' and  
    406408'PyQt4'/'PyQt5', the packages could be named like dbus-python and PyQt) to  
    407 build the mixer were not found. Therefore the qt mixer will not be installed.""" 
     409build the mixer were not found. Therefore the qt mixer will not be installed.""") 
    408410        else: # env['BUILD_MIXER'] == 'true' 
    409             print """ 
     411            print(""" 
    410412The prerequisites ('pyuic4'/'pyuic5' and the python-modules 'dbus' and  
    411413'PyQt4'/'PyQt5', the packages could be named like dbus-python and PyQt) to  
    412 build the mixer were not found, but BUILD_MIXER was requested.""" 
     414build the mixer were not found, but BUILD_MIXER was requested.""") 
    413415            Exit( 1 ) 
    414416 
     
    418420        env['XDG_TOOLS'] = True 
    419421    else: 
    420         print """ 
     422        print(""" 
    421423I couldn't find the 'xdg-desktop-menu' and 'xdg-icon-resource' programs. These 
    422424are needed to add the fancy entry for the mixer to your menu, but you can still 
    423 start it by executing "ffado-mixer".""" 
     425start it by executing "ffado-mixer".""") 
    424426 
    425427# 
     
    438440    env['DBUS1_FLAGS'] = "" 
    439441    env['DBUSC1_FLAGS'] = "" 
    440     print """ 
     442    print(""" 
    441443One of the dbus-headers, the dbus-c++-headers and/or the application 
    442444'dbusxx-xml2cpp' where not found. The dbus-server for ffado will therefore not 
    443445be built. 
    444 """ 
     446""") 
    445447else: 
    446448    # Get the directory where dbus stores the service-files 
     
    464466 
    465467if env['DEBUG']: 
    466     print "Doing a debug build" 
     468    print("Doing a debug build") 
    467469    env.MergeFlags( "-Wall -g -DDEBUG" ) 
    468470    env['DEBUG_MESSAGES'] = True 
     
    475477 
    476478if env['PROFILE']: 
    477     print "Doing a PROFILE build" 
     479    print("Doing a PROFILE build") 
    478480    env.MergeFlags( "-Wall -g" ) 
    479481 
     
    496498env['BUILD_STATIC_LIB'] = False 
    497499if env['BUILD_STATIC_TOOLS']: 
    498     print "Building static versions of the tools..." 
     500    print("Building static versions of the tools...") 
    499501    env['BUILD_STATIC_LIB'] = True 
    500502 
     
    695697    exe = '/bin/mount' 
    696698    if os.path.isfile(exe): 
    697         #print 'Found %s' % exe 
     699        #print('Found %s' % exe) 
    698700        if os.path.islink(exe): 
    699701            real_exe = os.path.join(os.path.dirname(exe), os.readlink(exe)) 
    700             #print '%s is a symlink to %s' % (exe, real_exe
     702            #print('%s is a symlink to %s' % (exe, real_exe)
    701703        else: 
    702704            real_exe = exe 
     
    717719                break 
    718720    else: 
    719         print '!!! Not found %s' % exe 
     721        print('!!! Not found %s' % exe) 
    720722    return answer 
    721723 
     
    792794    else: 
    793795        env['DIST_TARGET'] = config[config_cpu] 
    794     print "Detected DIST_TARGET = " + env['DIST_TARGET'] 
     796    print("Detected DIST_TARGET = " + env['DIST_TARGET']) 
    795797 
    796798#=== Begin Revised CXXFLAGS ========================================= 
     
    811813if env['DETECT_USERSPACE_ENV']: 
    812814    m32 = is_userspace_32bit(cpuinfo) 
    813     print 'User space is %s' % (m32 and '32-bit' or '64-bit'
     815    print('User space is %s' % (m32 and '32-bit' or '64-bit')
    814816    if cpuinfo.is_powerpc: 
    815817        if m32: 
    816             print "Doing a 32-bit PowerPC build for %s CPU" % cpuinfo.ppc_type 
     818            print("Doing a 32-bit PowerPC build for %s CPU" % cpuinfo.ppc_type) 
    817819            machineflags = { 'CXXFLAGS' : ['-m32'] } 
    818820        else: 
    819             print "Doing a 64-bit PowerPC build for %s CPU" % cpuinfo.ppc_type 
     821            print("Doing a 64-bit PowerPC build for %s CPU" % cpuinfo.ppc_type) 
    820822            machineflags = { 'CXXFLAGS' : ['-m64'] } 
    821823        env.MergeFlags( machineflags ) 
    822824    elif cpuinfo.is_x86: 
    823825        if m32: 
    824             print "Doing a 32-bit %s build for %s" % (cpuinfo.machine, cpuinfo.model_name
     826            print("Doing a 32-bit %s build for %s" % (cpuinfo.machine, cpuinfo.model_name)
    825827            if cpuinfo.machine == 'x86_64': 
    826828                machineflags = { 'CXXFLAGS' : ['-mx32'] } 
     
    828830                machineflags = { 'CXXFLAGS' : ['-m32'] } 
    829831        else: 
    830             print "Doing a 64-bit %s build for %s" % (cpuinfo.machine, cpuinfo.model_name
     832            print("Doing a 64-bit %s build for %s" % (cpuinfo.machine, cpuinfo.model_name)
    831833            machineflags = { 'CXXFLAGS' : ['-m64'] } 
    832834            needs_fPIC = True 
     
    842844    opt_flags.extend (["-fomit-frame-pointer","-ffast-math","-funroll-loops"]) 
    843845    env.MergeFlags( opt_flags ) 
    844     print "Doing an optimized build..." 
     846    print("Doing an optimized build...") 
    845847 
    846848env['REVISION'] = os.popen('svnversion .').read()[:-1] 
     
    922924if len(env.destdir) > 0: 
    923925    if not len( ARGUMENTS.get( "WILL_DEAL_WITH_XDG_MYSELF", "" ) ) > 0: 
    924         print """ 
     926        print(""" 
    925927WARNING! 
    926928You are using the (packagers) option DESTDIR to install this package to a 
     
    930932(And you have to look into the SConstruct to learn how to disable this 
    931933message.) 
    932 """ 
     934""") 
    933935else: 
    934936 
  • trunk/libffado/support/dbus/SConscript

    r2650 r2711  
    8383servicefile = env.ScanReplace('org.ffado.Control.service.in') 
    8484if env['dbus_service_dir'] and ( env.destdir or os.access( env['dbus_service_dir'], os.W_OK ) ): 
    85     print "Will install the service-file" 
     85    print("Will install the service-file") 
    8686    targetdir = env.destdir + env['dbus_service_dir'] 
    8787    env.Alias( "install", env.Install( env.destdir + env['dbus_service_dir'], servicefile ) ) 
    8888else: 
    8989    if not env['dbus_service_dir']: 
    90         print 'Can\'t install the system-wide dbus service file as the concerned variable is not defined.' 
     90        print('Can\'t install the system-wide dbus service file as the concerned variable is not defined.') 
    9191    else: 
    9292        if not os.access( env['dbus_service_dir'], os.W_OK ): 
    93             print 'Insufficient rights to install the system-wide dbus service file.' 
    94             print 'Please run the "scons install" command with higher authority.' 
     93            print('Insufficient rights to install the system-wide dbus service file.') 
     94            print('Please run the "scons install" command with higher authority.') 
    9595 
    9696# static versions