コード例 #1
0
ファイル: __init__.py プロジェクト: zenglzh/DIRAC
def siteName():
    """
  Determine and return DIRAC name for current site
  """
    global __siteName
    if not __siteName:
        __siteName = gConfig.getValue('/LocalSite/Site', _siteName)
    return __siteName


#Callbacks
ExitCallback.registerSignals()

#Set the platform
from DIRAC.Core.Utilities.Platform import getPlatformString
platform = getPlatformString()
platformTuple = tuple(platform.split('_'))


def exit(exitCode=0):
    """
  Finish execution using callbacks
  """
    ExitCallback.execute(exitCode, [])
    sys.exit(exitCode)


def abort(exitCode, *args, **kwargs):
    """
  Abort execution
  """
コード例 #2
0
ファイル: __init__.py プロジェクト: afalabel/DIRAC
def siteName():
  """
  Determine and return DIRAC name for current site
  """
  global __siteName
  if not __siteName:
    __siteName = gConfig.getValue( '/LocalSite/Site', _siteName )
  return __siteName

#Callbacks
ExitCallback.registerSignals()

#Set the platform
from DIRAC.Core.Utilities.Platform import getPlatformString
platform = getPlatformString()
platformTuple = tuple( platform.split( '_' ) )

def exit( exitCode = 0 ):
  """
  Finish execution using callbacks
  """
  ExitCallback.execute( exitCode, [] )
  sys.exit( exitCode )

def abort( exitCode, *args, **kwargs ):
  """
  Abort execution
  """
  try:
    gLogger.fatal( *args, **kwargs )
コード例 #3
0
                    if libFile.find('libc-') == 0 or libFile.find(
                            'libc.so') == 0:
                        libs.append(os.path.join(lib, libFile))
            newest_lib = [0, 0, 0]
            for lib in libs:
                lib_parts = libc_ver(lib)[1].split('.')
                for i in range(len(lib_parts)):
                    try:
                        lib_parts[i] = int(lib_parts[i])
                    except ValueError:
                        lib_parts[i] = 0
                        # print "non integer version numbers"
                if lib_parts > newest_lib:
                    newest_lib = lib_parts

            platformTuple += ('glibc-' + '.'.join(map(str, newest_lib)), )
        elif platformTuple[0] == 'Darwin':
            platformTuple += ('.'.join(platform.mac_ver()[0].split(".")[:2]), )
        elif platformTuple[0] == 'Windows':
            platformTuple += (platform.win32_ver()[0], )
        else:
            platformTuple += (platform.release())

        platformString = "%s_%s_%s" % platformTuple

        return platformString


if __name__ == "__main__":
    print getPlatformString()
コード例 #4
0
                    if libFile.find('libc-') == 0 or libFile.find(
                            'libc.so') == 0:
                        libs.append(os.path.join(lib, libFile))
            newest_lib = [0, 0, 0]
            for lib in libs:
                lib_parts = libc_ver(lib)[1].split('.')
                for i in xrange(len(lib_parts)):
                    try:
                        lib_parts[i] = int(lib_parts[i])
                    except ValueError:
                        lib_parts[i] = 0
                        # print "non integer version numbers"
                if lib_parts > newest_lib:
                    newest_lib = lib_parts

            platformTuple += ('glibc-' + '.'.join(map(str, newest_lib)), )
        elif platformTuple[0] == 'Darwin':
            platformTuple += ('.'.join(platform.mac_ver()[0].split(".")[:2]), )
        elif platformTuple[0] == 'Windows':
            platformTuple += (platform.win32_ver()[0], )
        else:
            platformTuple += (platform.release())

        platformString = "%s_%s_%s" % platformTuple

        return platformString


if __name__ == "__main__":
    print(getPlatformString())
コード例 #5
0
 def main():
     print(getPlatformString())
コード例 #6
0
ファイル: dirac-platform.py プロジェクト: sbel/bes3-jinr
          lib = '/lib'
        for libFile in os.listdir( lib ):
          if libFile.find( 'libc-' ) == 0 or libFile.find( 'libc.so' ) == 0 :
            libs.append( os.path.join( lib , libFile ) )
      newest_lib = [0, 0, 0]
      for lib in libs:
        lib_parts = libc_ver( lib )[1].split( '.' )
        for i in range( len( lib_parts ) ):
          try:
            lib_parts[i] = int( lib_parts[i] )
          except ValueError:
            lib_parts[i] = 0
            # print "non integer version numbers"
        if lib_parts > newest_lib:
          newest_lib = lib_parts

      platformTuple += ( 'glibc-' + '.'.join( map( str, newest_lib ) ) , )
    elif platformTuple[0] == 'Darwin':
      platformTuple += ( '.'.join( platform.mac_ver()[0].split( "." )[:2] ), )
    elif platformTuple[0] == 'Windows':
      platformTuple += ( platform.win32_ver()[0], )
    else:
      platformTuple += ( platform.release() )

    platformString = "%s_%s_%s" % platformTuple

    return platformString

if __name__ == "__main__":
  print getPlatformString()