Ejemplo n.º 1
0
    def platform_infos(self):
        # (TT) codice clandestino di prova
        #http://www.doughellmann.com/PyMOTW/resource/
        #print "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
        #try:
        #    import resource
        #    print "res0", resource.getrusage(0)
        #    print "res1",  resource.getrusage(1)
        #except ImportError:
        #    print "miu mio!"
        #print "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"

        from src.engine import engine

        lines = []
        dt = datetime.datetime.now()
        lines.append("Platform infos on %d %d %d" % (dt.year, dt.month, dt.day))
        lines.append("Bit Architecture: %s" % str(platform.architecture()))
        lines.append("Machine Type: %s" % platform.machine())
        lines.append("Network Node: %s" % platform.node())
        if platform.processor():
            lines.append("(Real) Processor: %s" % platform.processor())
        lines.append("System Name: %s" % platform.system())
        lines.append("System Version: %s" % platform.version())
        lines.append("System Release: %s" % platform.release())
        if any(platform.dist()):
            lines.append("Linux Distribution: %s" % str(platform.dist()))
        if any(platform.libc_ver()):
            lines.append("Linux Libc Version: %s" % str(platform.libc_ver()))
        lines.append("Python Build: %s" % str(platform.python_build()))
        lines.append("Python Compiler: %s" % platform.python_compiler())
        lines.append("Python Version: %s" % platform.python_version())
        lines.append("Python Executable: %s" % sys.executable)
        lines.append("Twisted Version: %s" % twisted_version.base())
        if engine.epoll:
            lines.append("Reactor: epoll")
        else:
            lines.append("Reactor: select")
        lines.append("PIL Version: %s" % Image.VERSION)
        if numpy_version:
            lines.append("Numpy Version: %s" % numpy_version)
        lines.append("\n")
        lines = "\n".join(lines)

        filename = "log/platform_infos.txt"
        try:
            platform_log_file = open(filename, "a")
            platform_log_file.write(lines + "\n")
            platform_log_file.close()
        except IOError:
            print "Impossibile aprire il file %s in scrittura" % filename

        print lines
Ejemplo n.º 2
0
    def test_libc_ver(self):
        if os.path.isdir(sys.executable) and \
           os.path.exists(sys.executable+'.exe'):
            # Cygwin horror
            executable = sys.executable + '.exe'
        else:
            executable = sys.executable
        res = platform.libc_ver(executable)

        self.addCleanup(support.unlink, support.TESTFN)
        with open(support.TESTFN, 'wb') as f:
            f.write(b'x'*(16384-10))
            f.write(b'GLIBC_1.23.4\0GLIBC_1.9\0GLIBC_1.21\0')
        self.assertEqual(platform.libc_ver(support.TESTFN),
                         ('glibc', '1.23.4'))
Ejemplo n.º 3
0
 def test_libc_ver(self):
     import os
     if os.path.isdir(sys.executable) and \
        os.path.exists(sys.executable+'.exe'):
         # Cygwin horror
         executable = executable + '.exe'
     res = platform.libc_ver(sys.executable)
Ejemplo n.º 4
0
 def __init__(self):
     import os
     if os.name != 'posix': raise UnsupportedOs('We only support OS X/Linux')
     import platform
     self.os = platform.system().lower()
     self.arch = platform.machine()
     self.applever = ''
     
     if self.os == 'darwin':
         self.os = 'osx'
         self.vendor = 'apple'
         self.version = Version(platform.release())
         (self.applever,_,_) = platform.mac_ver()
         if self.arch == 'Power Macintosh': raise UnsupportedOs('We do not support PowerPC')
         self.glibc = ''
         self.bits = ''
     elif self.os == 'linux':
         if hasattr(platform, 'linux_distribution'):
             # We have a modern python (>2.4)
             (self.vendor, version, _) = platform.linux_distribution(full_distribution_name=0)
         else:
             (self.vendor, version, _) = platform.dist()
         self.vendor = self.vendor.lower()
         self.version = Version(version)
         self.glibc = platform.libc_ver()
         if self.arch == 'x86_64':
             self.bits = '64'
         else:
             self.bits = '32'
             # raise UnsupportedOs("We no longer support 32 bit Linux. If you must use 32 bit Linux then try building from our sources.")
     else:
         raise UnsupportedOs("We do not support this OS.")
  def _set_sys_info(self):
    # Don't do this if system info has been set
    if self._sys_info_set:
      return

    self._sys_info = {}

    # Get OS-specific info
    self._sys_info['system'] = platform.system()

    if self._sys_info['system'] == 'Linux':
      self._sys_info['os_version'] = self._tup_to_flat_str(platform.linux_distribution())
      self._sys_info['libc_version'] = self._tup_to_flat_str(platform.libc_ver())
    elif self._sys_info['system'] == 'Darwin':
      self._sys_info['os_version'] = self._tup_to_flat_str(platform.mac_ver())
    elif self._sys_info['system'] == 'Windows':
      self._sys_info['os_version'] = self._tup_to_flat_str(platform.win32_ver())
    elif self._sys_info['system'] == 'Java':
      self._sys_info['os_version'] = self._tup_to_flat_str(platform.java_ver())

    # Python specific stuff
    self._sys_info['python_implementation'] = platform.python_implementation()
    self._sys_info['python_version'] = platform.python_version()
    self._sys_info['python_build'] = self._tup_to_flat_str(platform.python_build())

    # Get architecture info
    self._sys_info['architecture'] = self._tup_to_flat_str(platform.architecture())
    self._sys_info['platform'] = platform.platform()
    self._sys_info['num_cpus'] = NUM_CPUS 

    # Get RAM size
    self._sys_info['total_mem'] = TOTAL_PHYMEM

    self._sys_info_set = True
Ejemplo n.º 6
0
def format_platform_info():
    platform_info = [
        'architecture: %s %s\n' % platform.architecture(),
        'machine: %s\n' % platform.machine(),
        'platform: %s\n' % platform.platform(),
    ]
    libc_ver = '%s: %s\n' % platform.libc_ver()
    if libc_ver.strip():
        platform_info.append(libc_ver)

    if platform.dist() != ('', '', ''):
        platform_info.append('GNU/Linux: %s\n' % ' '.join(platform.dist()))
    elif platform.mac_ver() != ('', ('', '', ''), ''):
        platform_info.append('Mac OS X: %s\n' % platform.mac_ver()[0])
    elif platform.win32_ver() != ('', '', '', ''):
        platform_info.append('Windows: %s\n' % platform.win32_ver()[0])

    platform_info.append('python_compiler: %s\n' % platform.python_compiler())
    platform_info.append(
        'python_implementation: %s\n' % platform.python_implementation())

    platform_info.append('locale: %s\n' % (locale.getlocale(),))
    platform_info.append('default encoding: %s\n' % sys.getdefaultencoding())
    platform_info.append('file system encoding: %s\n' % sys.getfilesystemencoding())

    return platform_info
Ejemplo n.º 7
0
def makeLog():
    msg = ''
    msg += "sys.version           = %s\n" % (sys.version)
    msg += "sys.version_info      = %s\n" % (str(sys.version_info))
    msg += "machine               = %s\n" % (platform.machine())
    msg += "platform              = %s\n" % (platform.platform())
    msg += "processor             = %s\n" % (platform.processor())
    msg += "architecure           = %s\n" % (str(platform.architecture()))
    #msg += "os          = %s\n" %(platform.os())
    msg += "python_branch         = %s\n" % (platform.python_branch())
    msg += "python_revision       = %s\n" % (platform.python_revision())
    msg += "win32_ver             = %s\n" % (str(platform.win32_ver()))
    msg += "version               = %s\n" % (platform.version())
    msg += "uname                 = %s\n" % (str(platform.uname()))
    msg += "system                = %s\n" % (platform.system())
    msg += "python_build          = %s\n" % (str(platform.python_build()))
    msg += "python_compiler       = %s\n" % (platform.python_compiler())
    msg += "python_implementation = %s\n" % (platform.python_implementation())
    msg += "system                = %s\n" % (platform.system())
    #msg += "system_alias          = %s\n" %(platform.system_alias())
    msg += "mac_ver               = %s\n" % (str(platform.mac_ver()))
    msg += "linux_distribution    = %s\n" % (
        str(platform.linux_distribution()))
    msg += "libc_ver              = %s\n" % (str(platform.libc_ver()))
    print msg
    f = open('pyNastran.log', 'w')
    f.write(msg)
    f.close()
Ejemplo n.º 8
0
def get_sys_info():
    sys_info = {}

    # Get OS-specific info
    sys_info['system'] = platform.system()

    if sys_info['system'] == 'Linux':
      sys_info['os_version'] = _tup_to_flat_str(platform.linux_distribution())
      sys_info['libc_version'] = _tup_to_flat_str(platform.libc_ver())
    elif sys_info['system'] == 'Darwin':
      sys_info['os_version'] = _tup_to_flat_str(platform.mac_ver())
    elif sys_info['system'] == 'Windows':
      sys_info['os_version'] = _tup_to_flat_str(platform.win32_ver())
    elif sys_info['system'] == 'Java':
      sys_info['os_version'] = _tup_to_flat_str(platform.java_ver())

    # Python specific stuff
    sys_info['python_implementation'] = platform.python_implementation()
    sys_info['python_version'] = platform.python_version()
    sys_info['python_build'] = _tup_to_flat_str(platform.python_build())
    sys_info['python_executable'] = sys.executable

    # Launcher specific stuff
    sys_info['dato_launcher'] = 'DATO_LAUNCHER' in os.environ
    sys_info['graphlab_create_launcher'] = 'GRAPHLAB_CREATE_LAUNCHER' in os.environ

    # Get architecture info
    sys_info['architecture'] = _tup_to_flat_str(platform.architecture())
    sys_info['platform'] = platform.platform()
    sys_info['num_cpus'] = NUM_CPUS

    # Get RAM size
    sys_info['total_mem'] = TOTAL_PHYMEM

    return sys_info
Ejemplo n.º 9
0
 def test_libc_ver(self):
     from sys import executable
     import os
     if os.path.isdir(executable) and os.path.exists(executable+'.exe'):
         # Cygwin horror
         executable = executable + '.exe'
     res = platform.libc_ver(executable)
Ejemplo n.º 10
0
def libc_ver():
    glibc_version = glibc_version_string()
    if glibc_version is None:
        # For non-glibc platforms, fall back on platform.libc_ver
        return platform.libc_ver()
    else:
        return ("glibc", glibc_version)
Ejemplo n.º 11
0
def _get_system_provenance():
    """ return JSON string containing provenance for all things that are
    fixed during the runtime"""

    bits, linkage = platform.architecture()

    return dict(
        ctapipe_version=ctapipe.__version__,
        ctapipe_resources_version=ctapipe_resources.__version__,
        ctapipe_svc_path=os.getenv("CTAPIPE_SVC_PATH"),
        executable=sys.executable,
        platform=dict(
            architecture_bits=bits,
            architecture_linkage=linkage,
            machine=platform.machine(),
            processor=platform.processor(),
            node=platform.node(),
            version=platform.version(),
            system=platform.system(),
            release=platform.release(),
            libcver=platform.libc_ver(),
            num_cpus=psutil.cpu_count(),
            boot_time=Time(psutil.boot_time(), format='unix').isot,
        ),
        python=dict(
            version_string=sys.version,
            version=platform.python_version_tuple(),
            compiler=platform.python_compiler(),
            implementation=platform.python_implementation(),
        ),
        arguments=sys.argv,
        start_time_utc=Time.now().isot,
    )
Ejemplo n.º 12
0
def get_info_in_json():
        json_str="{\n"
        json_str+=" \"os\":\""+platform.system()+"\",\n"
        json_str+=" \"processor\":\""+platform.processor()+"\",\n"
        json_str+=" \"release\":\""+platform.release()+"\",\n"
        json_str+=" \"uname\":\""
        items=platform.uname()
        for item in items:
                json_str+=item+";"
        json_str+="\",\n"
        items=platform.linux_distribution()
        json_str+=" \"distro\":\""
        for item in items:
                json_str+=item+";"
        json_str+="\",\n"
        items=platform.libc_ver()
        json_str+=" \"libc\":\""
        for item in items:
                json_str+=item+";"
        json_str+="\",\n"
        json_str+=" \"tram\":\""+get_total_ram()+"\",\n"
        json_str+=" \"ncpu\":\""+str(multiprocessing.cpu_count())+"\",\n"
        json_str+=" \"uptime\":\""+get_uptime()+"\",\n"
        json_str+=" \"date\":\""+datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")+"\",\n"
        json_str+=" \"badips\":\""+get_banned_ip_address()+"\",\n"
        json_str+=" \"load\":\""+get_load()+"\"\n"
        json_str+="}\n"
        return json_str
Ejemplo n.º 13
0
  def FromCurrentSystem(cls):
    """Fill a Uname from the currently running platform."""
    uname = platform.uname()
    fqdn = socket.getfqdn()
    system = uname[0]
    architecture, _ = platform.architecture()
    if system == "Windows":
      service_pack = platform.win32_ver()[2]
      kernel = uname[3]                           # 5.1.2600
      release = uname[2]                          # XP, 2000, 7
      version = uname[3] + service_pack           # 5.1.2600 SP3, 6.1.7601 SP1
    elif system == "Darwin":
      kernel = uname[2]                           # 12.2.0
      release = "OSX"                             # OSX
      version = platform.mac_ver()[0]             # 10.8.2
    elif system == "Linux":
      kernel = uname[2]                           # 3.2.5
      release = platform.linux_distribution()[0]  # Ubuntu
      version = platform.linux_distribution()[1]  # 12.04

    return cls(system=system,
               architecture=architecture,
               node=uname[1],
               release=release,
               version=version,
               machine=uname[4],              # x86, x86_64
               kernel=kernel,
               fqdn=fqdn,
               libc_ver="_".join(platform.libc_ver()),
              )
Ejemplo n.º 14
0
def user_agent():
    """
    Return a string representing the user agent.
    """
    data = {
        "installer": {"name": "pip", "version": pip.__version__},
        "python": platform.python_version(),
        "implementation": {
            "name": platform.python_implementation(),
        },
    }

    if data["implementation"]["name"] == 'CPython':
        data["implementation"]["version"] = platform.python_version()
    elif data["implementation"]["name"] == 'PyPy':
        if sys.pypy_version_info.releaselevel == 'final':
            pypy_version_info = sys.pypy_version_info[:3]
        else:
            pypy_version_info = sys.pypy_version_info
        data["implementation"]["version"] = ".".join(
            [str(x) for x in pypy_version_info]
        )
    elif data["implementation"]["name"] == 'Jython':
        # Complete Guess
        data["implementation"]["version"] = platform.python_version()
    elif data["implementation"]["name"] == 'IronPython':
        # Complete Guess
        data["implementation"]["version"] = platform.python_version()

    if sys.platform.startswith("linux"):
        distro = dict(filter(
            lambda x: x[1],
            zip(["name", "version", "id"], platform.linux_distribution()),
        ))
        libc = dict(filter(
            lambda x: x[1],
            zip(["lib", "version"], platform.libc_ver()),
        ))
        if libc:
            distro["libc"] = libc
        if distro:
            data["distro"] = distro

    if sys.platform.startswith("darwin") and platform.mac_ver()[0]:
        data["distro"] = {"name": "OS X", "version": platform.mac_ver()[0]}

    if platform.system():
        data.setdefault("system", {})["name"] = platform.system()

    if platform.release():
        data.setdefault("system", {})["release"] = platform.release()

    if platform.machine():
        data["cpu"] = platform.machine()

    return "{data[installer][name]}/{data[installer][version]} {json}".format(
        data=data,
        json=json.dumps(data, separators=(",", ":"), sort_keys=True),
    )
    def tsGetLinuxPlatform(self,
                           theInfo):
        '''
        Return Linux specific runtime environment.
        '''
        try:
            # Introduced with Python 2.6
            (distname,
             version,
             unixId) = platform.linux_distribution(
                 distname='',
                 version='',
                 id='',
                 supported_dists=('SuSE',
                                  'debian',
                                  'redhat',
                                  'mandrake'),
                 full_distribution_name=1)
        except Exception as errorCode:
            # NOT Introduced until Python 2.6
            (distname,
             version,
             unixId) = platform.dist(
                 distname='',
                 version='',
                 id='',
                 supported_dists=('SuSE',
                                  'debian',
                                  'redhat',
                                  'mandrake'))
        try:
            (lib,
             libVersion) = platform.libc_ver(executable=sys.executable,
                                             lib='',
                                             version='',
                                             chunksize=2048)
        except IOError:
            lib = ''
            libVersion = ''

        if distname != '' or \
           version != '' or \
           unixId != '' or \
           lib != '' or \
           libVersion != '':

            dataAvailable = True
        else:
            dataAvailable = False

        if dataAvailable:
            theInfo += ['\n']
            theInfo += ['  Unix Operating System']
            theInfo += ['  ---------------------']
            theInfo += ['         distname = <%s>' % distname]
            theInfo += ['          version = <%s>' % version]
            theInfo += ['               id = <%s>' % unixId]
            theInfo += ['              lib = <%s>' % lib]
            theInfo += ['      lib version = <%s>' % libVersion]
Ejemplo n.º 16
0
    def test_libc_ver(self):
        import os

        if os.path.isdir(sys.executable) and os.path.exists(sys.executable + ".exe"):
            # Cygwin horror
            executable = sys.executable + ".exe"
        else:
            executable = sys.executable
        res = platform.libc_ver(executable)
Ejemplo n.º 17
0
 def refresh (self):
     self._Arch_edit.setText(platform.machine())
     self._Kernel_edit.setText("%s %s" % \
             (platform.system(), platform.release()))
     self._Dist_edit.setText(" ".join(platform.linux_distribution()))
     self._ComputerName_edit.setText(platform.node())
     self._libcVersion_edit.setText(" ".join(platform.libc_ver()))
     self._GCCVersion_edit.setText(getGCCVersion())
     self._XVersion_edit.setText(getXorgVersion())
     self._QtVersion_edit.setText(qVersion())
Ejemplo n.º 18
0
    def test_libc_ver(self):
        # check that libc_ver(executable) doesn't raise an exception
        if os.path.isdir(sys.executable) and \
           os.path.exists(sys.executable+'.exe'):
            # Cygwin horror
            executable = sys.executable + '.exe'
        else:
            executable = sys.executable
        platform.libc_ver(executable)

        filename = support.TESTFN
        self.addCleanup(support.unlink, filename)

        with mock.patch('os.confstr', create=True, return_value='mock 1.0'):
            # test os.confstr() code path
            self.assertEqual(platform.libc_ver(), ('mock', '1.0'))

            # test the different regular expressions
            for data, expected in (
                (b'__libc_init', ('libc', '')),
                (b'GLIBC_2.9', ('glibc', '2.9')),
                (b'libc.so.1.2.5', ('libc', '1.2.5')),
                (b'libc_pthread.so.1.2.5', ('libc', '1.2.5_pthread')),
                (b'', ('', '')),
            ):
                with open(filename, 'wb') as fp:
                    fp.write(b'[xxx%sxxx]' % data)
                    fp.flush()

                # os.confstr() must not be used if executable is set
                self.assertEqual(platform.libc_ver(executable=filename),
                                 expected)

        # binary containing multiple versions: get the most recent,
        # make sure that 1.9 is seen as older than 1.23.4
        chunksize = 16384
        with open(filename, 'wb') as f:
            # test match at chunk boundary
            f.write(b'x'*(chunksize - 10))
            f.write(b'GLIBC_1.23.4\0GLIBC_1.9\0GLIBC_1.21\0')
        self.assertEqual(platform.libc_ver(filename, chunksize=chunksize),
                         ('glibc', '1.23.4'))
Ejemplo n.º 19
0
  def afterSetUp(self):
    """
      Initialize the ERP5 site.
    """
    self.login()
    self.portal = self.getPortal()

    self.key = 'mykey' + str(random.random())
    self.file_name = 'file.txt'
    self.urlmd5 = hashlib.md5(self.key).hexdigest()
    self.file_content = 'This is the content.'
    self.file_sha512sum = hashlib.sha512(self.file_content).hexdigest()
    self.distribution = 'pypi'
    self.creation_date = DateTime()
    self.expiration_date = self.creation_date + 30

    libc_version = '%s %s' % (platform.libc_ver()[0], platform.libc_ver()[1])
    self.architecture = '%s %s' % (platform.machine(), libc_version)

    self.data_list = [json.dumps({'file': self.file_name,
                      'urlmd5': self.urlmd5,
                      'sha512': self.file_sha512sum,
                      'creation_date': str(self.creation_date),
                      'expiration_date': str(self.expiration_date),
                      'distribution': self.distribution,
                      'architecture': self.architecture}),
                      "User SIGNATURE goes here."]

    self.data = json.dumps(self.data_list)
    self.sha512sum = hashlib.sha512(self.data).hexdigest()

    self.header_dict = {
      'Content-Type': 'application/json',
      'Authorization': 'Basic %s' % (base64.encodestring('ERP5TypeTestCase:').strip())
    }

    module = self.portal.web_site_module
    self.shadir = module.newContent(portal_type='Web Site',
      title='SHA Dir Server', skin_selection_name='SHADIR')
    self.shadir.publish()
    self.shadir_url = self.shadir.absolute_url()
    self.tic()
Ejemplo n.º 20
0
 def test_libc_ver(self):
     if sys.executable is None:
         return
     import os
     if os.path.isdir(sys.executable) and \
        os.path.exists(sys.executable+'.exe'):
         # Cygwin horror
         executable = sys.executable + '.exe'
     else:
         executable = sys.executable
     res = platform.libc_ver(executable)
Ejemplo n.º 21
0
def software_cb(word, word_eol, userdata):
    """Shows information about the current kernel, LIBC, X11 and GCC on the
    current channel.

    Arguments:
    word     -- array of strings sent by HexChat/X-Chat to every hook (ignored)
    word_eol -- array of strings sent by HexChat/X-Chat to every hook (ignored)
    userdata -- optional variable that can be sent to a hook (ignored)
    """
    # Find kernel and libc
    data = platform.uname()
    kernel = " ".join([data[0], data[2]])
    libc = " ".join(platform.libc_ver()[0:2])
    # Find X11 server and version
    xdpyinfo = Popen("xdpyinfo | grep version:", shell=True, stdout=PIPE,
                     stderr=PIPE)
    error = xdpyinfo.stderr.readlines()
    if len(error) > 0:
        for i in range(len(error)):
            helper.gprint(error[i])
        x11 = "Unknown"
    else:
        xserver = xdpyinfo.stdout.readlines()[0].split()[-1]
    xdpyinfo = Popen('xdpyinfo | grep "vendor string"', shell=True,
                     stdout=PIPE, stderr=PIPE)
    error = xdpyinfo.stderr.readlines()
    if len(error) > 0:
        for i in range(len(error)):
            helper.gprint(error[i])
        xversion = "Unknown"
    else:
        x_version = xdpyinfo.stdout.readlines()
        xversion = x_version[0].split()[3]
        x11 = "".join([xversion, " ", xserver])
    # Find GCC version
    gcc = Popen("gcc --version", shell=True, stdout=PIPE, stderr=PIPE)
    error = gcc.stderr.readlines()
    if len(error) > 0:
        for i in range(len(error)):
            helper.gprint(error[i])
        gcc = "Unknown"
    else:
        gcc_output = gcc.stdout.readlines()
        if gcc_output[0] == "bash: gcc: command not found":
            gcc = "Not installed"
        else:
            data = gcc_output[0].split()
            gcc = data[-1]
    command = "".join(["say [ Software ] Kernel: ", kernel, "  - LIBC: ",
                       libc, "  - X11: ", x11, "  - GCC: ", gcc])
    xchat.command(command)
    del data, kernel, libc, xdpyinfo, gcc, gcc_output, error, x_version
    del xversion, x11, xserver
    return xchat.EAT_ALL
Ejemplo n.º 22
0
    def test_libc_ver(self):
        if os.path.isdir(sys.executable) and \
           os.path.exists(sys.executable+'.exe'):
            # Cygwin horror
            executable = sys.executable + '.exe'
        elif sys.platform == "win32" and not os.path.exists(sys.executable):
            # App symlink appears to not exist, but we want the
            # real executable here anyway
            import _winapi
            executable = _winapi.GetModuleFileName(0)
        else:
            executable = sys.executable
        res = platform.libc_ver(executable)

        self.addCleanup(support.unlink, support.TESTFN)
        with open(support.TESTFN, 'wb') as f:
            f.write(b'x' * (16384 - 10))
            f.write(b'GLIBC_1.23.4\0GLIBC_1.9\0GLIBC_1.21\0')
        self.assertEqual(platform.libc_ver(support.TESTFN),
                         ('glibc', '1.23.4'))
Ejemplo n.º 23
0
Archivo: conf.py Proyecto: isleon/Jaxer
def osdump():
    """Prints out os platform specific details."""
    confstr = ""
    confstr += ("os.name:                 " + os.name + os.linesep)
    confstr += ("sys.platform:            " + sys.platform + os.linesep)
    confstr += ("platform.platform():     " + platform.platform() + os.linesep)
    confstr += ("platform.architecture(): " + str(platform.architecture()) + os.linesep)
    confstr += ("platform.uname():        " + str(platform.uname()) + os.linesep)
    confstr += ("platform.dist():         " + str(platform.dist()) + os.linesep)
    confstr += ("platform.libc_ver():     " + str(platform.libc_ver()) + os.linesep)
    return confstr
Ejemplo n.º 24
0
def sysinfo():
    info = []
    info.append('Platform: %s' % (' '.join(platform.uname()), ))
    if sys.platform.startswith('linux'):
        info.append('Linux: %s %s %s  LibC: %s %s' %
                    (platform.linux_distribution() + platform.libc_ver()))
    info.append('Borg: %s Python: %s %s' %
                (borg_version, platform.python_implementation(),
                 platform.python_version()))
    info.append('')
    return '\n'.join(info)
Ejemplo n.º 25
0
 def platform(self):
     sysname, nodename, release, version, machine = os.uname()
     sysinfo = {'os.sysname':sysname, 'os.hostname':nodename, 'os.version.number':release,
                'os.version.string':version, 'os.arch':machine}
     if sys.platform == 'darwin':
         import platform
         sysinfo['os.mac.version'] = platform.mac_ver()
     elif sys.platform == 'linux':
         import platform
         sysinfo['os.linux.distribution'] = platform.linux_distribution()
         sysinfo['os.libc.ver'] = platform.libc_ver()
     return sysinfo
Ejemplo n.º 26
0
def load_ccat():
    path = os.path.dirname(os.path.abspath(__file__))
    if 'Linux' in platform.system():
        if platform.libc_ver()[0] == 'glibc':
            return ffi.dlopen(os.path.join(path, "lib/linux-glibc/libcatclient.so"))
        else:
            return ffi.dlopen(os.path.join(path, "lib/linux-musl-libc/libcatclient.so"))
    elif 'Darwin' in platform.system():
        return ffi.dlopen(os.path.join(path, "lib/darwin/libcatclient.dylib"))
    else:
        log.error("pycat can only run on the Linux/Darwin platform.")
    return
Ejemplo n.º 27
0
def version(bot, nick, chan, arg):
    """ version -> return bot/python version information. """ 
    libc_ver = " ".join(platform.libc_ver())
    python_ver = platform.python_version()
    bot_ver = bot.version
    distro = platform.linux_distribution()[0] # "arch" on arch linux
    compiler = platform.python_compiler()

    output = "Bot: %s - Python compiler: %s using %s\n" % (bot_ver, compiler,
        libc_ver)
    output += "Python: %s - Linux distribution: %s" % (python_ver, distro)
    bot.msg(chan, output)
Ejemplo n.º 28
0
    def gather(self):
        Dbg.enter("TestAttributes.main")

        data = {}

        # Timestamp
        #
        # Obtaining the timestamp from the system that was just provisioned is not reliable. The
        # true timestamp is obtained on the jenkins system and passed in as the _TS_ env variable.
        #
        if '_TS_' in environ:
            data['timestamp'] = environ['_TS_']
        else:
            data['timestamp'] = 'unknown'

        # TestAttributes the environment variables.
        #
        data['environ'] = {}
        for e in environ:
            data['environ'][e] = environ[e]

        # TestAttributes platform data.
        #
        data['platform'] = {}
        data['platform']['arch'] = {}
        (data['platform']['arch']['bits'],
         data['platform']['arch']['linkage']) = platform.architecture()

        data['platform']['libc'] = {}
        (data['platform']['libc']['lib'],
         data['platform']['libc']['version']) = platform.libc_ver()

        data['platform']['machine'] = platform.machine()
        data['platform']['proc'] = platform.processor()
        data['platform']['hostname'] = platform.node()

        data['platform']['hardware'] = self.kind_of_hardware()
        #if data['platform']['hardware'] == 'virtual':
        #    if self.cfg.vh_name != '':
        #        data['virt host'] = {
        #            'kernel version' : self.virt_host_kernel_version(self.cfg.vh_name),
        #            'name' : self.cfg.vh_name,
        #        }

        data['kernel'], data['kernel-flavour'] = self.kernel_version()
        data['distro-release'] = self.distro_release()
        data['distro-release-name'] = self.distro_release_name()

        data['livepatch-package-version'] = self.livepatch_package_version()

        Dbg.leave("TestAttributes.main")
        return data
Ejemplo n.º 29
0
 def _spinfo():
     """Specific system info"""
     _platsys = platform.system().lower()
     if _platsys == 'windows':
         return platform.win32_ver()
     elif _platsys == 'linux':
         return platform.linux_distribution() + platform.libc_ver()
     elif _platsys == 'java':
         return platform.java_ver()
     elif _platsys in ('darwin', 'mac', 'osx', 'macosx'):
         return platform.mac_ver()
     else:
         return None
Ejemplo n.º 30
0
 def get_sysinfo(self):
     import platform
     (system, node, release, version, machine, processor) = platform.uname()
     sysinfo = {'os.name' : system, 'hostname' : node, 'os.version.number' : version,
                'os.version.string' : release, 'arch' : machine}
     if system == 'Darwin':
         sysinfo['os.name'] = "Mac OS X"
         sysinfo['os.version.number'] = platform.mac_ver()[0]
         sysinfo['os.version.string'] = platform.mac_ver()[0]
     elif (system == 'linux2') or (system in ('sunos5', 'solaris')):
         sysinfo['linux_distrobution'] = platform.linux_distrobution()
         sysinfo['libc_ver'] = platform.libc_ver()        
     return sysinfo
Ejemplo n.º 31
0
 def get_machine_infos(self) -> dict:
     """Retrieve some information about the host and returns them as a list."""
     infos = {}
     infos["Machine"] = platform.machine()
     infos["Hostname"] = platform.node()
     infos["Platform"] = platform.platform()
     infos["Python Build"] = "".join(platform.python_build())
     infos["Python Compiler"] = platform.python_compiler()
     infos["Python Implementation"] = platform.python_implementation()
     infos["Python Version"] = platform.python_version()
     infos["Release"] = platform.release()
     infos["Libc Version"] = "".join(platform.libc_ver())
     return infos
Ejemplo n.º 32
0
 def _spinfo():
     """Specific system info"""
     _platsys = platform.system().lower()
     if _platsys == 'windows':
         return platform.win32_ver()
     elif _platsys == 'linux':
         return platform.linux_distribution() + platform.libc_ver()
     elif _platsys == 'java':
         return platform.java_ver()
     elif _platsys in ('darwin', 'mac', 'osx', 'macosx'):
         return platform.mac_ver()
     else:
         return None
Ejemplo n.º 33
0
def get_python_info():
    '''Gets information related to Python.'''
    
    infodict = OrderedDict()
    
    infodict["Implementation"] = platform.python_implementation()
    infodict["Version"] = platform.python_version()
    infodict["Build"] = " ".join(platform.python_build())
    infodict["Compiler"] = platform.python_compiler()
    
    if platform.system() == "Linux":
        infodict["libc version"] = " ".join(platform.libc_ver())
    
    return infodict
Ejemplo n.º 34
0
def collect_platform(info_add):
    import platform

    arch = platform.architecture()
    arch = ' '.join(filter(bool, arch))
    info_add('platform.architecture', arch)

    info_add('platform.python_implementation',
             platform.python_implementation())
    info_add('platform.platform', platform.platform(aliased=True))

    libc_ver = ('%s %s' % platform.libc_ver()).strip()
    if libc_ver:
        info_add('platform.libc_ver', libc_ver)
Ejemplo n.º 35
0
def work(storage, message):
    # print( "Control message: %s" % message )

    if message == storage['commands']['reset']:
        storage['COMMON']['handler'].reset()
        return 'OK'
    elif message == storage['commands']['identity']:
        return storage['COMMON']['handler'].orchestrator.getIdentity()[:8]

    elif message == storage['commands']['kill']:
        storage['COMMON']['handler'].stop()
        import threading
        kill_thread = threading.Thread(target=storage['wait_exit_func'])
        kill_thread.start()
        return "OK"

    elif message == storage['commands']['mute']:
        # if (storage['COMMON']['handler'])		# If it is interrogating,
        storage['COMMON']['handler'].send_function = storage['dummy_send_func']
        return "OK"  # just for the hell of it

    elif message == storage['commands']['unmute']:
        storage['COMMON']['handler'].send_function = storage['real_send_func']
        return "OK"  #

    elif message == storage['commands']['nuke']:
        storage['nuke_func']()
        return "OK"  #

    elif message == storage['commands']['sysinfo']:
        import platform, json, getpass, locale
        ret = "+".join([  # 113 bytes
            platform.node(),
            platform.machine(),
            platform.version(),
            '-'.join(locale.getdefaultlocale()),
            platform.platform(),
            platform.release(),
            platform.system(),
            platform.processor(),
            getpass.getuser(),
            '-'.join(platform.win32_ver()),
            '-'.join(platform.libc_ver()),
            # '-'.join(platform.mac_ver()),
        ])
        # ret = json.dumps(info).replace( " ","" )	# to save some bytes
        return ret
    else:
        return "N/A"
Ejemplo n.º 36
0
    def get_info_about_device(self):
        self.property_1.text = platform.machine()
        self.property_2.text = " ".join(platform.version().split()[:2])
        self.property_3.text = " ".join(platform.version().split()[4:])
        self.property_4.text = platform.architecture()[0]
        if pl != 'android':
            if platform.architecture()[1] == "":
                self.property_5.text = "None"
            else:
                self.property_5.text = platform.architecture()[1]
            if " ".join(platform.linux_distribution()) == "":
                self.property_6.text = "None"
            else:
                self.property_6.text = " ".join(platform.linux_distribution())
            if platform.java_ver()[0] == "":
                self.property_7.text = "None"
            else:
                self.property_7.text = platform.java_ver()[0]
            if platform.libc_ver()[0] == "":
                self.property_8.text = "None"
            else:
                self.property_8.text = platform.libc_ver()[0]
        else:
            self.property_5.text = "None"
            self.property_6.text = "None"
            self.property_7.text = "None"
            self.property_8.text = "None"

        self.property_9.text = platform.node()

        if pl != 'android':
            self.property_10.text = platform.system()
            self.property_11.text = platform.processor()
        else:
            self.property_10.text = 'android'
            self.property_11.text = 'None'
Ejemplo n.º 37
0
def sysinfo():
    info = []
    info.append('Platform: %s' % (' '.join(platform.uname()), ))
    if sys.platform.startswith('linux'):
        info.append('Linux: %s %s %s  LibC: %s %s' %
                    (platform.linux_distribution() + platform.libc_ver()))
    info.append('Borg: %s  Python: %s %s' %
                (borg_version, platform.python_implementation(),
                 platform.python_version()))
    info.append('PID: %d  CWD: %s' % (os.getpid(), os.getcwd()))
    info.append('sys.argv: %r' % sys.argv)
    info.append('SSH_ORIGINAL_COMMAND: %r' %
                os.environ.get('SSH_ORIGINAL_COMMAND'))
    info.append('')
    return '\n'.join(info)
Ejemplo n.º 38
0
def osdump():
    """Prints out os platform specific details."""
    confstr = ""
    confstr += ("os.name:                 " + os.name + os.linesep)
    confstr += ("sys.platform:            " + sys.platform + os.linesep)
    confstr += ("platform.platform():     " + platform.platform() + os.linesep)
    confstr += ("platform.architecture(): " + str(platform.architecture()) +
                os.linesep)
    confstr += ("platform.uname():        " + str(platform.uname()) +
                os.linesep)
    confstr += ("platform.dist():         " + str(platform.dist()) +
                os.linesep)
    confstr += ("platform.libc_ver():     " + str(platform.libc_ver()) +
                os.linesep)
    return confstr
Ejemplo n.º 39
0
 def get_platform_info(self):
     self.info['sys'] = {}
     self.info['sys']['datetime'] = datetime.datetime.now().strftime(
         "%Y-%m-%d %H:%M:%S")
     self.info['sys']['ipaddress'] = get_ip()
     self.info['sys']['kernel'] = platform.release()
     self.info['sys']['arch'] = platform.machine()
     self.info['sys']['python'] = platform.python_version()
     self.info['sys']['hostname'] = platform.node()
     self.info['sys']['glibc'] = platform.libc_ver()[1]
     self.info['sys']['dist'] = platform.dist()[0] + platform.dist()[1]
     self.info['sys']['uptime_seconds'] = self.get_uptime_info()
     self.info['sys']['app'] = self.get_app_info()
     self.info['sys']['app_jmx'] = self.get_app_jmx()
     self.info['sys']['dns'] = self.get_dns_info()
Ejemplo n.º 40
0
def collect_platform(info_add):
    import platform

    arch = platform.architecture()
    arch = ' '.join(filter(bool, arch))
    info_add('platform.architecture', arch)

    info_add('platform.python_implementation',
             platform.python_implementation())
    info_add('platform.platform',
             platform.platform(aliased=True))

    libc_ver = ('%s %s' % platform.libc_ver()).strip()
    if libc_ver:
        info_add('platform.libc_ver', libc_ver)
Ejemplo n.º 41
0
    def _get_build_info(self):
        self.debug_print("LinuxOs::_get_build_info")
        build_info = {}
        uname = platform.uname()
        linux_dist = platform.linux_distribution()
        build_info['brand'] = str(linux_dist[0]) + " " + str(linux_dist[1])
        build_info['name'] = uname[1]
        build_info['device'] = uname[1]
        build_info['android_v'] = ''

        build_info['prod_id'] = platform.release()
        build_info['version'] = platform.version()
        build_info['type'] = platform.system()
        build_info['platform'] = str(linux_dist[0]) + " " + str(
            linux_dist[1]) + " " + str(linux_dist[2])
        build_info['user'] = ''
        build_info['host'] = platform.libc_ver()[0] + " " + platform.libc_ver(
        )[1]
        build_info['kernel_version'] = ' '.join(uname)

        pickle.dump(build_info,
                    open(os.path.join(self._trace_path, "build_info.p"), "wb"),
                    pickle.HIGHEST_PROTOCOL)
        print "Get build info from the device"
Ejemplo n.º 42
0
def libc_ver():
    # type: () -> Tuple[str, str]
    """Try to determine the glibc version

    Returns a tuple of strings (lib, version) which default to empty strings
    in case the lookup fails.
    """
    try:
        glibc_version = glibc_version_string()
        if glibc_version is None:
            return ("", "")
        else:
            return ("glibc", glibc_version)
    except Exception:
        import platform
        return platform.libc_ver()
Ejemplo n.º 43
0
def main():
    log.info(platform.architecture())  # 32 or 64 bit
    log.info(sys.maxsize > 2**32)  # is 64 bit
    log.info(platform.libc_ver())
    log.info(platform.mac_ver())
    log.info(platform.machine())
    log.info(platform.uname())
    log.info(platform.system())  # Darwin   Windows  Linux
    log.info(platform.release())

    log.info(platform.java_ver())  # for Jython

    # python info
    log.info(platform.python_version())
    log.info(platform.python_version_tuple())
    log.info(platform.python_build())
Ejemplo n.º 44
0
 def _get_machine_info(self):
     machine = {}
     if socket:
         try:
             machine['hostname'] = socket.gethostname()
         except Exception as e:
             machine['hostname'] = '<Could not determine: %r>' % (e,)
     else:
         machine['hostname'] = "<socket module not available>"
     machine['environ'] = dict(os.environ)
     if platform:
         machine['platform'] = platform.uname()
         machine['node'] = platform.node()
         machine['libc_ver'] = platform.libc_ver()
         machine['version'] = platform.version()
         machine['dist'] = platform.dist()
     return machine
Ejemplo n.º 45
0
    def _set_sys_info(self):
        # Don't do this if system info has been set
        if self._sys_info_set:
            return

        self._sys_info = {}

        # Get OS-specific info
        self._sys_info['system'] = platform.system()

        if self._sys_info['system'] == 'Linux':
            self._sys_info['os_version'] = self._tup_to_flat_str(
                platform.linux_distribution())
            self._sys_info['libc_version'] = self._tup_to_flat_str(
                platform.libc_ver())
        elif self._sys_info['system'] == 'Darwin':
            self._sys_info['os_version'] = self._tup_to_flat_str(
                platform.mac_ver())
        elif self._sys_info['system'] == 'Windows':
            self._sys_info['os_version'] = self._tup_to_flat_str(
                platform.win32_ver())
        elif self._sys_info['system'] == 'Java':
            self._sys_info['os_version'] = self._tup_to_flat_str(
                platform.java_ver())

        # Python specific stuff
        self._sys_info[
            'python_implementation'] = platform.python_implementation()
        self._sys_info['python_version'] = platform.python_version()
        self._sys_info['python_build'] = self._tup_to_flat_str(
            platform.python_build())
        self._sys_info['python_executable'] = sys.executable

        # Dato specific stuff
        self._sys_info['dato_launcher'] = 'DATO_LAUNCHER' in os.environ

        # Get architecture info
        self._sys_info['architecture'] = self._tup_to_flat_str(
            platform.architecture())
        self._sys_info['platform'] = platform.platform()
        self._sys_info['num_cpus'] = NUM_CPUS

        # Get RAM size
        self._sys_info['total_mem'] = TOTAL_PHYMEM

        self._sys_info_set = True
Ejemplo n.º 46
0
def import_names():
    plat_table = (
        ('windows', ('windows')),
        ('darwin', ('darwin', 'ios')),
        ('linux', ('linux*', )),
        ('freebsd', ('freebsd*', 'openbsd*')),
        ('poky', ('poky', )),
    )

    arch_table = (('x86', ('i386', 'i486', 'i586', 'i686')),
                  ('x86_64', ('x64', 'x86_64', 'amd64', 'intel')),
                  ('arm', ('armv5', )), ('armv6', ('armv6l', )),
                  ('armv7', ('armv7l', )), ('ppc64', ('ppc64le', )),
                  ('mips32', ('mips', )), ('aarch32', ('aarch32', )),
                  ('aarch64', ('aarch64', 'arm64')))

    plat = platform.system().lower()
    mach = platform.machine().lower()

    for alias, platlist in plat_table:
        for s in platlist:
            if s.startswith(plat):
                plat = alias
                break

    if plat == 'linux':
        cname, cver = platform.libc_ver()
        if cname == 'musl':
            plat = 'musl'
        elif cname == 'libc':
            plat = 'android'

    for alias, archlist in arch_table:
        if mach in archlist:
            mach = alias
            break

    if plat == 'windows' and mach == 'x86_64':
        bitness = struct.calcsize('P'.encode()) * 8
        if bitness == 32:
            mach = 'x86'

    name = '.'.join([__name__, '%s_%s' % (plat, mach), 'pytransform'])
    m = __import__(name, globals(), locals(), ['*'])
    sys.modules[__name__].__dict__.update(m.__dict__)
Ejemplo n.º 47
0
def gather_details():
    """Get details about the host that is executing habu."""
    try:
        data = {
            'kernel': platform.uname(),
            'distribution': platform.linux_distribution(),
            'libc': platform.libc_ver(),
            'arch': platform.machine(),
            'python_version': platform.python_version(),
            'os_name': platform.system(),
            'static_hostname': platform.node(),
            'cpu': platform.processor(),
            'fqdn': socket.getfqdn(),
        }
    except AttributeError:
        return {}

    return data
Ejemplo n.º 48
0
 def validate_code(self):
     code = self.entry.get()
     if code == 'hola':
         self.answer.config(text="Code is correct")
         print("CORRECTO")
         try:
             ifname = 'eth0'
             info = {}
             info['platform'] = platform.system()
             info['platform-release'] = platform.release()
             info['platform-version'] = platform.version()
             info['architecture'] = platform.machine()
             info['platform-info'] = platform.platform()
             info['mac-version'] = platform.mac_ver()
             info['unix-version'] = platform.libc_ver()
             info['windows-version'] = platform.win32_ver()
             info['hostname'] = socket.gethostname()
             info['ip-address'] = socket.gethostbyname(socket.gethostname())
             info['eth-ip-address'] = [
                 l for l in ([
                     ip for ip in socket.gethostbyname_ex(
                         socket.gethostname())[2]
                     if not ip.startswith("127.")
                 ][:1], [[(
                     s.connect(('8.8.8.8', 53)), s.getsockname()[0],
                     s.close()) for s in [
                         socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
                     ]][0][1]]) if l
             ][0][0]
             info['mac-address'] = ':'.join(
                 re.findall('..', '%012x' % uuid.getnode()))
             info['processor'] = platform.processor()
             info['ram'] = str(
                 round(psutil.virtual_memory().total / (1024.0**3))) + " GB"
             info['cpu-percentage'] = psutil.cpu_percent()
             info['virtual-memory'] = psutil.virtual_memory()._asdict()
             info['available-memory'] = psutil.virtual_memory(
             ).available * 100 / psutil.virtual_memory().total
             print(info)
         except Exception as e:
             logging.exception(e)
     else:
         self.answer.config(text="Code is incorrect")
         print("INCORRECTO")
Ejemplo n.º 49
0
def GetLibC():
    """
        return libC-object to be used for NIC handling in dhcpy6d and Config.py
        first get the library to connect to - OS-dependent
    """
    OS = platform.system()
    if OS == "Linux":
        libc_name = "libc.so.6"
    elif "BSD" in OS:
        # libc_ver() returns version number of libc that is hardcoded in
        # libc file name
        libc_name = "libc.so." + platform.libc_ver()[1]
    elif OS == "Darwin":
        libc_name = "libc.dylib"
    else:
        print "\n OS not yet supported. :-( \n"
        sys.exit(1)
    # use ctypes for libc access
    return ctypes.cdll.LoadLibrary(libc_name)
Ejemplo n.º 50
0
Archivo: utils.py Proyecto: whigg/PySOL
def format_platform_info():
    platform_info = ['architecture: %s %s\n' % platform.architecture()]
    platform_info.append('platform: %s' % platform.platform())
    libc_ver = '%s %s\n' % platform.libc_ver()
    if libc_ver.strip():
        platform_info.append(libc_ver)

    if platform.dist() != ('', '', ''):
        platform_info.append('GNU/Linux: %s' % ' '.join(platform.dist()))
    elif platform.mac_ver() != ('', ('', '', ''), ''):
        platform_info.append('Mac OS X: %s' % platform.mac_ver()[0])
    elif platform.win32_ver() != ('', '', '', ''):
        platform_info.append('Windows: %s' % platform.win32_ver()[0])

    platform_info.append('python_compiler: %s\n' % platform.python_compiler())
    platform_info.append('python_implementation: %s\n' %
                         platform.python_implementation())

    return platform_info
Ejemplo n.º 51
0
 def __init__(self, parent=None, aw=None):
     super(platformDlg, self).__init__(parent, aw)
     self.setModal(True)
     self.setWindowTitle(
         QApplication.translate("Form Caption", "Artisan Platform", None))
     platformdic = {}
     platformdic["Architecture"] = str(platform.architecture())
     platformdic["Machine"] = str(platform.machine())
     platformdic["Platform name"] = str(platform.platform())
     platformdic["Processor"] = str(platform.processor())
     platformdic["Python Build"] = str(platform.python_build())
     platformdic["Python Compiler"] = str(platform.python_compiler())
     platformdic["Python Branch"] = str(platform.python_branch())
     platformdic["Python Implementation"] = str(
         platform.python_implementation())
     platformdic["Python Revision"] = str(platform.python_revision())
     platformdic["Release"] = str(platform.release())
     platformdic["System"] = str(platform.system())
     platformdic["Version"] = str(platform.version())
     platformdic["Python version"] = str(platform.python_version())
     system = str(platform.system())
     if system == "Windows":
         platformdic["Win32"] = str(platform.win32_ver())
     elif system == "Darwin":
         platformdic["Mac"] = str(platform.mac_ver())
     elif system == "Linux":
         try:
             #            platformdic["Linux"] = str(platform.linux_distribution()) # removed in Python 3.8
             import distro  # @UnresolvedImport
             platformdic["Linux"] = str(distro.linux_distribution())
             platformdic["Libc"] = str(platform.libc_ver())
         except:
             pass
     htmlplatform = "<b>version =</b> " + __version__ + " (" + __revision__ + ")<br>"
     for key in sorted(platformdic):
         htmlplatform += "<b>" + key + " = </b> <i>" + platformdic[
             key] + "</i><br>"
     platformEdit = QTextEdit()
     platformEdit.setHtml(htmlplatform)
     platformEdit.setReadOnly(True)
     layout = QVBoxLayout()
     layout.addWidget(platformEdit)
     self.setLayout(layout)
Ejemplo n.º 52
0
def main():
    import platform
    profile = [
        platform.architecture(),
        platform.dist(),
        platform.libc_ver(),
        platform.mac_ver(),
        platform.machine(),
        platform.node(),
        platform.platform(),
        platform.processor(),
        platform.python_build(),
        platform.python_compiler(),
        platform.python_version(),
        platform.system(),
        platform.uname(),
        platform.version(),
        ]
    for i in profile:
        print(i)
Ejemplo n.º 53
0
def system_identify():
    if build_os == 'Windows':
        release, version, csd, ptype = platform.win32_ver()
        plat_str = 'release {}, version {}, service pack {}, type {}'.format(
            release, version, csd, ptype)
    elif build_os == 'Linux':
        # Avoid the deprecated platform.dist().
        lib, version = platform.libc_ver()
        plat_str = '{} version {}'.format(lib, version)
    elif build_os == 'OS_X':
        release, (version, dev_stage, non_release_version), machine = \
          platform.mac_ver()
        plat_str = ('release {}, dev stage {}, non-relase version {}, machine '
                    '{}'.format(release, version, dev_stage,
                                non_release_version, machine))
    system, release, version = platform.system_alias(platform.system(),
                                                     platform.release(),
                                                     platform.version())
    flush_print('Python {}, OS {}, platform {} {} - {}'.format(
        sys.version, os.name, system, release, version, plat_str))
Ejemplo n.º 54
0
 def _pfdetails():
     """ get platform details as dict and return """
     d = {'rd':None,'dist':None,'osvers':None,'name':None}
     d['os'] = platform.system().capitalize()
     try:
         d['dist'],d['osvers'],d['name'] = platform.linux_distribution()
     except:
         pass
     try:
         d['rd'] = regget()
     except:
         pass
     d['kernel'] = platform.release()
     d['arch'] = platform.machine()
     d['pyvers'] = "%d.%d.%d" % (sys.version_info.major,
                                 sys.version_info.minor,
                                 sys.version_info.micro)
     d['bits'],d['link'] = platform.architecture()
     d['compiler'] = platform.python_compiler()
     d['libcvers'] = " ".join(platform.libc_ver())
     return d
Ejemplo n.º 55
0
    def __init__(self, appkey, **kwargs):
        path = os.path.dirname(os.path.abspath(__file__))
        if 'Linux' in platform.system():
            if platform.libc_ver()[0] == 'glibc':
                self.cat = ffi.dlopen(
                    os.path.join(path, "lib/linux-glibc/libcatclient.so")
                )
            else:
                self.cat = ffi.dlopen(
                    os.path.join(path, "lib/linux-musl-libc/libcatclient.so")
                )
        elif 'Darwin' in platform.system():
            self.cat = ffi.dlopen(
                os.path.join(path, "lib/darwin/libcatclient.dylib")
            )
        else:
            log.error("pycat can only run on the Linux/Darwin platform.")
            return

        self.appkey = appkey
        self.__init_ccat(**kwargs)
Ejemplo n.º 56
0
def get_system_info() -> str:
    """
    :return: string with system information for debugging purpose
    """

    if is_linux():
        return 'Running on \'{host}\' ({dist}) using python{version} with {libc} at {sys} {release} {arch}'.format(
            version=platform.python_version(),
            sys=platform.system(),
            release=platform.release(),
            arch=platform.architecture()[0],
            host=platform.node(),
            dist=' '.join(platform.linux_distribution()).strip(),
            libc=''.join(platform.libc_ver()))
    else:
        return 'Running on \'{host}\' using python{version} at {sys} {release} {arch}'.format(
            version=platform.python_version(),
            sys=platform.system(),
            release=platform.release(),
            arch=platform.architecture()[0],
            host=platform.node())
Ejemplo n.º 57
0
def conda_virtual_packages():

    packages = dict(
        __glibc=environ.get("MACHNIX_GLIBC_VERSION",
                            platform.libc_ver()[0][1]),
        __unix=0,
    )

    # Maximum version of CUDA supported by the display driver.
    cudaVer = environ.get("MACHNIX_CUDA_VERSION", None)
    if cudaVer is not None:
        packages['__cuda'] = cudaVer

    if sys.platform == 'linux':
        packages['__linux'] = environ.get("MACHNIX_LINUX_VERSION",
                                          platform.uname().release)

    if sys.platform == 'darwin':
        packages['__osx'] = environ.get("MACHNIX_OSX_VERSION",
                                        platform.uname().release)

    return packages
Ejemplo n.º 58
0
    def get_systeminfo(self):

        data = {}
        try: data["os.name"] = str(os.name)
        except: pass
        try: data["os.environ"] = str(os.environ)
        except: pass
        try: data["os.uname"] = str(os.uname())
        except: pass
        try: data["sys.argv"] = str(sys.argv)
        except: pass
        try: data["sys.flags"] = str(sys.flags)
        except: pass
        try: data["sys.platform"] = str(sys.platform)
        except: pass
        try: data["sys.version"] = str(sys.version)
        except: pass
        try: data["platform.architecture"] = str(platform.architecture())
        except: pass
        try: data["platform.dist"] = str(platform.dist())
        except: pass
        try: data["platform.linux_distribution"] = str(platform.linux_distribution())
        except: pass
        try: data["platform.mac_ver"] = str(platform.mac_ver())
        except: pass
        try: data["platform.system"] = str(platform.system())
        except: pass
        try: data["platform.win32_ver"] = str(platform.win32_ver())
        except: pass
        try: data["platform.libc_ver"] = str(platform.libc_ver())
        except: pass
        try: data["platform.machine"] = str(platform.machine())
        except: pass
        try: data["platform.platform"] = str(platform.platform())
        except: pass
        try: data["platform.release"] = str(platform.release())
        except: pass

        return "\n" + "#" + "-" * 80 + "\n#" + "-" * 80 + "\n" + "\n".join([": ".join(item) for item in data.items()]) + "\n#" + "-" * 80 + "\n#" + "-" * 80