Ejemplo n.º 1
0
def TestPlatform( ):
    print ("----------Operation System--------------------------")
    #   取得 python 版本
    print '取得 python 版本 : ' + platform.python_version()

    #   取得操作系統可執行結構 : ex('64bit','WindowsPE')
    print "取得操作系統可執行結構 : ex('64bit','WindowsPE')"
    print platform.architecture()

    #   電腦目前網路群組名稱
    print '電腦目前網路群組名稱' + platform.node()

    #   獲取操作系統名稱及版本號,‘Windows-7-6.1.7601-SP1’
    print '獲取操作系統名稱及版本號 : ' + platform.platform()

    #   電腦處理器資訊,’Intel64 Family 6 Model 42 Stepping 7, GenuineIntel’
    print '電腦處理器資訊 : ' + platform.processor()

    #   獲取操作系統中 Python 的構建日期
    print "獲取操作系統中 Python 的構建日期"
    print platform.python_build()

    #  獲取系統中 python 解釋器的信息
    print '獲取系統中 python 解釋器的信息 : ' + platform.python_compiler()

    if platform.python_branch()=="":
        print platform.python_implementation()
        print platform.python_revision()
    print "platform.release : " + platform.release()
    print "platform.system : " + platform.system()

    #print platform.system_alias()
    #  獲取操作系統版本
    print '獲取操作系統版本 : ' + platform.version()
Ejemplo n.º 2
0
def TestPlatform():
    print("----------Operation System----------")
    #  获取Python版本
    print platform.python_version()

    #   获取操作系统可执行程序的结构
    print platform.architecture()

    #   计算机的网络名称
    print platform.node()

    # 获取操作系统名称及版本号
    print platform.platform()

    # 计算机处理器信息
    print platform.processor()

    # 获取操作系统中Python的构建日期
    print platform.python_build()

    #  获取系统中python解释器的信息
    print platform.python_compiler()

    if platform.python_branch() == "":
        print platform.python_implementation()
        print platform.python_revision()
    print platform.release()
    print platform.system()

    # print platform.system_alias()
    #  获取操作系统的版本
    print platform.version()

    #  包含上面所有的信息汇总
    print platform.uname()
Ejemplo n.º 3
0
def TestPlatform():
    print("----------Operation System--------------------------")
    #  获取Python版本
    print platform.python_version()

    #   获取操作系统可执行程序的结构,,(’32bit’, ‘WindowsPE’)
    print platform.architecture()

    #   计算机的网络名称,’acer-PC’
    print platform.node()

    #获取操作系统名称及版本号,’Windows-7-6.1.7601-SP1′
    print platform.platform()

    #计算机处理器信息,’Intel64 Family 6 Model 42 Stepping 7, GenuineIntel’
    print platform.processor()

    # 获取操作系统中Python的构建日期
    print platform.python_build()

    #  获取系统中python解释器的信息
    print platform.python_compiler()

    if platform.python_branch() == "":
        print platform.python_implementation()
        print platform.python_revision()
    print platform.release()
    print platform.system()

    #print platform.system_alias()
    #  获取操作系统的版本
    print platform.version()

    #  包含上面所有的信息汇总
    print platform.uname()
Ejemplo n.º 4
0
def getOS(query=None):
    if "OSInfo" not in LMI.cache:
        OSInfo = {
            "machine": platform.machine(),
            "node": platform.node(),
            "processor": platform.processor(),
            "python_build": platform.python_build(),
            "python_compiler": platform.python_compiler(),
            "python_branch": platform.python_branch(),
            "python_implementation": platform.python_implementation(),
            "python_revision": platform.python_revision(),
            "python_version": platform.python_revision(),
            "python_version_tuple": platform.python_version_tuple(),
            "release": platform.release(),
            "system": platform.system(),
            "version": platform.version(),
            "uname": platform.uname()
        }
        LMI.cache["OSInfo"] = OSInfo
    else:
        OSInfo = LMI.cache["OSInfo"]
    if "java" in OSInfo["system"].lower():
        OSInfo["java_version"] = platform.java_ver()
    elif "windows" in OSInfo["system"].lower():
        OSInfo["win32_version"] = platform.win32_ver()
    elif "mac" in OSInfo["system"].lower():
        OSInfo["mac_version"] = platform.mac_ver()
    elif ("unix" in OSInfo["system"].lower()) or ("linux" in OSInfo["system"].lower()):
        OSInfo["libc_version"] = platform.libc_ver()
    if query is not None:
        if query in OSInfo.keys():
            return 1, OSInfo[query]
        return 0, "Query Not Found"
    return 1, OSInfo
Ejemplo n.º 5
0
def get_python_info():
    platform.python_build()
    platform.python_compiler()
    platform.python_branch()
    platform.python_implementation()
    platform.python_revision()
    platform.python_version()
    platform.python_version_tuple()
Ejemplo n.º 6
0
 def __init__(self):
     self.python_build = platform.python_build()
     self.python_compiler = platform.python_compiler()
     self.python_branch = platform.python_branch()
     self.python_implementation = platform.python_implementation()
     self.python_revision = platform.python_revision()
     self.python_version_tuple = platform.python_version_tuple()
Ejemplo n.º 7
0
def main():

    nltk.download('stopwords')
    nltk.download('vader_lexicon')        
        
    print("\n================================================================================\n")
    print("---------------------------------- Platform Information ------------------------")
    print('machine: {}'.format(platform.machine()))
    print('node: {}'.format(platform.node()))    
    print('processor: {}'.format(platform.processor()))    
    print('release: {}'.format(platform.release()))
    print('system: {}'.format(platform.system()))    
    print('version: {}'.format(platform.version()))
    print('uname: {}'.format(platform.uname()))
    
    #mem = virtual_memory()
    #print('memory: {}'.format(mem.total))  # total physical memory available
    
    print('python_build: {}'.format(platform.python_build()))
    print('python_compiler: {}'.format(platform.python_compiler()))
    print('python_branch: {}'.format(platform.python_branch()))
    print('python_implementation: {}'.format(platform.python_implementation()))
    
    print('python_revision: {}'.format(platform.python_revision()))
    print('python_version: {}'.format(platform.python_version()))
    
    print("\n================================================================================\n")
Ejemplo n.º 8
0
def show_version():
    """The version of Python, and other details."""
    print("Python version:\n    {0}".format(sys.version.replace("\n", "\n    ")))
    print("Python implementation: {0!r}".format(platform.python_implementation()))
    print("Python executable: {0!r}".format(sys.executable))
    more_about_file(sys.executable)
    print("Python prefix: {0!r}".format(sys.prefix))
    more_about_file(sys.prefix)
    if hasattr(sys, "base_prefix"):
        print("Python base_prefix: {0!r}".format(sys.base_prefix))
        more_about_file(sys.base_prefix)
    else:
        print("There is no base_prefix")
    if hasattr(sys, "real_prefix"):
        print("This is a virtualenv.")
        with indent():
            print("The real_prefix is: {0!r}".format(sys.real_prefix))
            more_about_file(sys.real_prefix)
    elif hasattr(sys, "base_prefix") and sys.prefix != sys.base_prefix:
        print("This is a venv virtualenv.")
    else:
        print("This is not a virtualenv.")
    print("Python build:")
    with indent():
        print("branch: {0!r}".format(platform.python_branch()))
        print("revision: {0!r}".format(platform.python_revision()))
Ejemplo n.º 9
0
def TestPlatform():
    #获取Python版本
    print(platform.python_version())
    #获取操作系统可执行程序结构(32bit,windowsPE)
    print(platform.architecture())
    #计算机网络名称
    print(platform.node())
    #计算机处理器信息 'Interl 64'
    print(platform.processor())
    #获取操作系统中的python构建日期
    print(platform.python_build())
    #获取系统中python解释器的信息
    print(platform.python_compiler())

    if platform.python_branch() == '':
        print(platform.python_implementation())
        print(platform.python_revision())

    print(platform.release())
    print(platform.system())

    #获取操作系统版本
    print(platform.version())
    #获取上面的所有信息
    print(platform.uname())
Ejemplo n.º 10
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.º 11
0
def print_banner(label):
    """Print the version of Python."""
    try:
        impl = platform.python_implementation()
    except AttributeError:
        impl = "Python"

    version = platform.python_version()

    if PYPY:
        version += " (pypy %s)" % ".".join(
            str(v) for v in sys.pypy_version_info)

    rev = platform.python_revision()
    if rev:
        version += f" (rev {rev})"

    try:
        which_python = os.path.relpath(sys.executable)
    except ValueError:
        # On Windows having a python executable on a different drive
        # than the sources cannot be relative.
        which_python = sys.executable
    print(f'=== {impl} {version} {label} ({which_python}) ===')
    sys.stdout.flush()
Ejemplo n.º 12
0
    def report(self, *args):
        report = ""
        report += self.entry.text.replace("(optional)", "") + "\n\n---\n\n"
        report += "**Application:** {0}\n".format(APP_NAME)
        report += "**Version:** {0}\n".format(APP_VERSION)
        report += "**Platform:** {0}\n".format(platform)
        report += "**Distro:** {0}\n".format(platfm.dist())
        report += "**OS release:** {0}\n".format(platfm.release())
        if platform == "macosx":
            report += "**Mac version:** {0}\n".format(platfm.mac_ver)
        if platform == "win":
            report += "**Win32 version:** {0}\n".format(platfm.win32_ver())
        report += "**Uname:** {0}\n".format(platfm.uname())
        report += "**Python version:** {0}\n".format(platfm.python_version())
        report += "**Python branch:** {0}\n".format(platfm.python_branch())        
        report += "**Python revision:** {0}\n".format(platfm.python_revision())
        report += "**Python build:** {0}\n".format(platfm.python_build())
        report += "**Python implementation:** {0}\n".format(platfm.python_implementation())
        report += "**Python compiler:** {0}\n".format(platfm.python_compiler())
        report += "**Kivy version:** {0}\n".format(kivy.__version__)
        report += "**Prefix:** {0}\n".format(sys.prefix)
        report += "\n\n---\n\n<pre>\n"
        report += self.exception
        report += "</pre>"

        exc = traceback.format_exception_only(*self.exc_info[0:2])[0].split(":")[0]
        last = traceback.format_tb(self.exc_info[-1])[-1].replace("  File", "file").split("\n")[0].replace(misc.home, "~")

        title = "{exception} in {file}".format(exception=exc, file=last)

        from urllib import quote

        open_url("https://github.com/Davideddu/Karaokivy/issues/new?title={title}&body={body}&labels=bug".format(title=quote(title), body=quote(report)))

        self.quit()
Ejemplo n.º 13
0
def get_metadata() -> OrderedArgsDict:
    '''
    Ordered dictionary synopsizing the active Python interpreter's
    implementation.

    This function aggregates the metadata reported by the reasonably
    cross-platform module `platform` into a simple dictionary.
    '''

    # This dictionary.
    metadata = OrderedArgsDict(
        'name',
        get_name(),
        'vcs revision',
        platform.python_revision() or 'none',
        'vcs branch',
        platform.python_branch() or 'none',
        'compiler',
        platform.python_compiler(),
    )

    # 2-tuple providing this interpreter's build number and date as strings.
    python_build = platform.python_build()

    # Append this metadata.
    metadata['build number'] = python_build[0]
    metadata['build data'] = python_build[1]

    # Return this dictionary.
    return metadata
Ejemplo n.º 14
0
def TestPlatform():

    print("----------Operation System----------")
    print(platform.python_version())
    # 获取python版本

    print(platform.architecture())
    # 获取操作系统可执行程序的结构,,('32bit' , 'windowsPE' )

    print(platform.node())
    # 计算机的网络名称,'acer-PC'

    print(platform.platform())
    # 获取操作系统名称及版本号

    print(platform.processor())
    # 计算机处理器信息

    print(platform.python_build())
    # 获取操作系统中Python的构建日期

    print(platform.python_compiler())
    # 获取系统中python结束前的信息

    if platform.python_branch() == "":
        print(platform.python_implementation())
        print(platform.python_revision())
    print(platform.release())
    print(platform.system())

    print(platform.version())
    # 获取操作系统的版本

    print(platform.uname())
Ejemplo n.º 15
0
    def __init__(self, app):
        self.properties = dict()
        self.properties['python_executable'] = sys.executable
        self.properties['flask_version'] = flask.__version__
        self.properties['import_name'] = app.import_name
        self.properties['static_url_path'] = app.static_url_path
        self.properties['static_folder'] = app.static_folder
        self.properties['template_folder'] = app.template_folder
        self.properties['instance_path'] = app.instance_path
        #self.properties['instance_relative_config'] = app.instance_relative_config
        self.properties['root_path'] = app.root_path

        self.properties['python_build'] = platform.python_build()
        self.properties['python_compiler'] = platform.python_compiler()
        self.properties['python_branch'] = platform.python_branch()
        #self.properties['python_implementtion'] = platform.python_implemention()
        self.properties['python_revision'] = platform.python_revision()
        self.properties['python_version'] = platform.python_version()
        self.properties[
            'python_version_tuple'] = platform.python_version_tuple()

        #self.properties['Platform Info'] = ''
        self.properties['platform_machine'] = platform.machine()
        self.properties['platform_version'] = platform.version()
        self.properties['platform_node'] = platform.node()
        self.properties['platform_processor'] = platform.processor()

        self.properties['platform_release'] = platform.release()
        self.properties['platform_system'] = platform.system()
Ejemplo n.º 16
0
def python_platform():
    output = {
        'architecture': platform.architecture(),
        'machine': platform.machine(),
        'node': platform.node(),
        'platform': {
            'normal': platform.platform(),
            'aliased': platform.platform(aliased=True),
            'terse': platform.platform(terse=True)
        },
        'processor': platform.processor(),
        'python': {
            'branch': platform.python_branch(),
            'build': platform.python_build(),
            'compiler': platform.python_compiler(),
            'implementation': platform.python_implementation(),
            'revision': platform.python_revision(),
            'version': platform.python_version(),
            'versionTuple': platform.python_version_tuple(),
        },
        'release': platform.release(),
        'system': platform.system(),
        'version': platform.version(),
        'uname': platform.uname(),
    }
    return output
Ejemplo n.º 17
0
def TestPlatform():
    print("------Operation System------")

    print(platform.python_version())  #  获取Python版本   3.7.6

    print(platform.architecture())  #   获取操作系统可执行程序的结构  ('64bit', 'WindowsPE')

    print(platform.node())  #   计算机的网络名称    LAPTOP-O6R63GS8

    print(platform.platform())  # 获取操作系统名称及版本号  Windows-10-10.0.18362-SP0

    print(platform.processor()
          )  # 计算机处理器信息 Intel64 Family 6 Model 92 Stepping 9, GenuineIntel

    print(platform.python_build())  # 获取操作系统中Python的构建日期

    print(platform.python_compiler())  #  获取系统中python解释器的信息
    if platform.python_branch() == "":
        print(platform.python_implementation())
        print(platform.python_revision())
    print(platform.release())
    print(platform.system())
    print(platform.version())  #  获取操作系统的版本
    print(
        platform.uname()
    )  #  包含上面所有的信息汇总  uname_result(system='Windows', node='LAPTOP-O6R63GS8', release='10', version='10.0.18362', machine='AMD64', processor='Intel64 Family 6 Model 92 Stepping 9, GenuineIntel')
Ejemplo n.º 18
0
        def searchs():
            try:

                info = [{
                    'system': platform.system(),
                    'node name': platform.node(),
                    'realese': platform.release(),
                    'platform version': platform.version(),
                    'machine': platform.machine(),
                    'processor': platform.processor(),
                    'platfrom name': platform.platform(),
                    'win 32 version': platform.win32_ver(),
                    'architecture': platform.architecture(),
                    'java version': platform.java_ver(),
                    'lib version': platform.libc_ver(),
                    'mac version': platform.mac_ver(),
                    'python build': platform.python_build(),
                    'python version': platform.python_branch(),
                    'python implemention': platform.python_implementation(),
                    'python revision': platform.python_revision(),
                }]
                x = json.dumps(info, indent=3)
                text.insert("end", x)

            except Exception as e:
                #print(e)
                tkinter.messagebox.showerror("Error",
                                             "Please Enter only Domain Name")
    def __init__(self):
        '''
        Initialize the class. Return standard runtime environment.
        '''

        self.theArchitecture = platform.architecture(executable=sys.executable,
                                                     bits='',
                                                     linkage='')
        self.theMachine = platform.machine()
        self.theNode = platform.node()

        if platformAvailable:
            # Introduced with Python 2.3
            self.thePlatform = platform.platform(aliased=1, terse=0)
        else:
            # NOT Introduced until Python 2.3
            self.thePlatform = ''

        if platformAvailable:
            try:
                # Introduced with Python 2.6
                self.thePython_branch = platform.python_branch()
                self.thePython_implementation = \
                                              platform.python_implementation()
                self.thePython_revision = platform.python_revision()
            except Exception, errorCode:
                # NOT Introduced until Python 2.6
                self.thePython_branch = ''
                self.thePython_implementation = ''
                self.thePython_revision = ''
Ejemplo n.º 20
0
def main():
    print("platform.architecture: {}".format(p.architecture()));

    print("platform.machine: {}".format(p.machine()));

    print("platform.node: {}".format(p.node()));

    print("platform.processor: {}".format(p.processor()));

    print("platform.python_build: {}".format(p.python_build()));

    print("platform.python_compiler: {}".format(p.python_compiler()));

    print("platform.python_branch: {}".format(p.python_branch()));

    print("platform.python_implementation: {}".format(p.python_implementation()));

    print("platform.python_revision: {}".format(p.python_revision()));

    print("platform.python_version: {}".format(p.python_version()));

    print("platform.python_version_tuple: {}".format(p.python_version_tuple()));

    print("platform.release: {}".format(p.release()));

    print("platform.system: {}".format(p.system()));

    #print("platform.system_alias: {}".format(p.system_alias()));

    print("platform.version: {}".format(p.version()));

    print("platform.uname: {}".format(p.uname()));

    print("platform.win32_ver: {}".format(p.win32_ver()));
Ejemplo n.º 21
0
def TestPlatform():
    print ("---------- Operation System ----------")
    # 获取Python版本
    print(platform.python_version())

    # 获取操作系统可执行程序的结构,,(’32bit’, ‘WindowsPE’)
    print(platform.architecture())

    # 计算机的网络名称,’acer-PC’
    print(platform.node())

    #获取操作系统名称及版本号,’Windows-7-6.1.7601-SP1′
    print(platform.platform())

    #计算机处理器信息,’Intel64 Family 6 Model 42 Stepping 7, GenuineIntel’
    print(platform.processor())

    # 获取操作系统中Python的构建日期
    print(platform.python_build())

    #  获取系统中python解释器的信息
    print(platform.python_compiler())

    if platform.python_branch() == "":
        print(platform.python_implementation())
        print(platform.python_revision())
    print(platform.release())
    print(platform.system())

    #  获取操作系统的版本
    print(platform.version())

    #  包含上面所有的信息汇总
    print(platform.uname())
Ejemplo n.º 22
0
    def test_sys_version(self):
        # Old test.
        for input, output in (
            ('2.4.3 (#1, Jun 21 2006, 13:54:21) \n[GCC 3.3.4 (pre 3.3.5 20040809)]',
             ('CPython', '2.4.3', '', '', '1', 'Jun 21 2006 13:54:21', 'GCC 3.3.4 (pre 3.3.5 20040809)')),
            ('IronPython 1.0.60816 on .NET 2.0.50727.42',
             ('IronPython', '1.0.60816', '', '', '', '', '.NET 2.0.50727.42')),
            ('IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42',
             ('IronPython', '1.0.0', '', '', '', '', '.NET 2.0.50727.42')),
            ):
            # branch and revision are not "parsed", but fetched
            # from sys.subversion.  Ignore them
            (name, version, branch, revision, buildno, builddate, compiler) \
                   = platform._sys_version(input)
            self.assertEqual(
                (name, version, '', '', buildno, builddate, compiler), output)

        # Tests for python_implementation(), python_version(), python_branch(),
        # python_revision(), python_build(), and python_compiler().
        sys_versions = {
            ("2.6.1 (r261:67515, Dec  6 2008, 15:26:00) \n[GCC 4.0.1 (Apple Computer, Inc. build 5370)]",
             ('CPython', 'tags/r261', '67515'), self.save_platform)
            :
                ("CPython", "2.6.1", "tags/r261", "67515",
                 ('r261:67515', 'Dec  6 2008 15:26:00'),
                 'GCC 4.0.1 (Apple Computer, Inc. build 5370)'),
            ("IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.3053", None, "cli")
            :
                ("IronPython", "2.0.0", "", "", ("", ""),
                 ".NET 2.0.50727.3053"),
            ("2.5 (trunk:6107, Mar 26 2009, 13:02:18) \n[Java HotSpot(TM) Client VM (\"Apple Computer, Inc.\")]",
            ('Jython', 'trunk', '6107'), "java1.5.0_16")
            :
                ("Jython", "2.5.0", "trunk", "6107",
                 ('trunk:6107', 'Mar 26 2009'), "java1.5.0_16"),
            ("2.5.2 (63378, Mar 26 2009, 18:03:29)\n[PyPy 1.0.0]",
             ('PyPy', 'trunk', '63378'), self.save_platform)
            :
                ("PyPy", "2.5.2", "trunk", "63378", ('63378', 'Mar 26 2009'),
                 "")
            }
        for (version_tag, subversion, sys_platform), info in \
                sys_versions.items():
            sys.version = version_tag
            if subversion is None:
                if hasattr(sys, "_mercurial"):
                    del sys._mercurial
                if hasattr(sys, "subversion"):
                    del sys.subversion
            else:
                sys._mercurial = subversion
            if sys_platform is not None:
                sys.platform = sys_platform
            self.assertEqual(platform.python_implementation(), info[0])
            self.assertEqual(platform.python_version(), info[1])
            self.assertEqual(platform.python_branch(), info[2])
            self.assertEqual(platform.python_revision(), info[3])
            self.assertEqual(platform.python_build(), info[4])
            self.assertEqual(platform.python_compiler(), info[5])
Ejemplo n.º 23
0
def current_platform_info():
    return {
        'architecture': platform.architecture(),
        'platform': platform.platform(),
        'implementation': platform.python_implementation(),
        'version': platform.python_version(),
        'revision': platform.python_revision(),
    }
Ejemplo n.º 24
0
def PyInfo():
    print('获取python构建号和日期', platform.python_build())
    print('获取用于编译python的编译器', platform.python_compiler())
    print('获取python实现SCM分支', platform.python_branch())
    print('获取python实现的字符串', platform.python_implementation())
    print('获取python版本', platform.python_version())
    print('获取python实现SCM修订', platform.python_revision())
    print('获取python实现的数组', platform.python_version_tuple())
Ejemplo n.º 25
0
def about_python():
    """Show information about the python install"""
    if parameters["Python"]:
        print("[Python]")
        print("sysconfig.get_python_version()={}".format(
            sysconfig.get_python_version()))
        if sys_type() == "Windows":
            print("sys.winver={}".format(sys.winver))
        printm("sys.version", sys.version)
        print("sys.version_info={}".format(sys.version_info))
        print("sys.hexversion={}".format(sys.hexversion))
        print("sys.implementation={}".format(sys.implementation))
        print("platform.python_build()={}".format(platform.python_build()))
        print("platform.python_branch()={}".format(platform.python_branch()))
        print("platform.python_implementation()={}".format(
            platform.python_implementation()))
        print("platform.python_revision()={}".format(
            platform.python_revision()))
        print("platform.python_version()={}".format(platform.python_version()))
        print("platform.python_version_tuple()={}".format(
            platform.python_version_tuple()))
        printm("sys.copyright", sys.copyright)
        print()

        print("[Python/Config]")
        print("sys.base_prefix={}".format(sys.base_prefix))
        print("sys.executable={}".format(sys.executable))
        print("sys.flags={}".format(sys.flags))
        printm("sys.builtin_module_names", sys.builtin_module_names)
        printm("sys.modules", sys.modules)
        print("sys.path={}".format(sys.path))
        python_version = platform.python_version_tuple()
        if python_version[0] == 3 and python_version[1] >= 9:
            printm("sys.platlibdir", sys.platlibdir)  # Python 3.9+
        print("sys.getrecursionlimit()={}".format(sys.getrecursionlimit()))
        print("sys.getswitchinterval()={}".format(sys.getswitchinterval()))
        print("sys.thread_info={}".format(sys.thread_info))
        print("platform.python_compiler()={}".format(
            platform.python_compiler()))
        if sys_type() == "Unix":
            print("platform.libc_ver()={}".format(platform.libc_ver()))
        print("sys.api_version={}".format(sys.api_version))
        print()

        print("[Python/Math]")
        print("sys.int_info={}".format(sys.int_info))
        print("sys.maxsize={}".format(sys.maxsize))
        print("sys.float_info={}".format(sys.float_info))
        print()

        print("[Python/Unicode]")
        print("sys.getdefaultencoding()={}".format(sys.getdefaultencoding()))
        print("sys.getfilesystemencoding()={}".format(
            sys.getfilesystemencoding()))
        print("unicodedata.unidata_version={}".format(
            unicodedata.unidata_version))
        print("sys.maxunicode={}".format(sys.maxunicode))
        print()
Ejemplo n.º 26
0
def information():
    return flask.jsonify({
        "python_version":
        platform.python_version() + "+" + platform.python_revision(),
        "service_version":
        bhamon_orchestra_service.__version__,
        "service_version_date":
        bhamon_orchestra_service.__date__,
    })
    def test_sys_version(self):
        # Old test.
        for input, output in (
            ('2.4.3 (#1, Jun 21 2006, 13:54:21) \n[GCC 3.3.4 (pre 3.3.5 20040809)]',
             ('CPython', '2.4.3', '', '', '1', 'Jun 21 2006 13:54:21', 'GCC 3.3.4 (pre 3.3.5 20040809)')),
            ('IronPython 1.0.60816 on .NET 2.0.50727.42',
             ('IronPython', '1.0.60816', '', '', '', '', '.NET 2.0.50727.42')),
            ('IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42',
             ('IronPython', '1.0.0', '', '', '', '', '.NET 2.0.50727.42')),
            ):
            # branch and revision are not "parsed", but fetched
            # from sys.subversion.  Ignore them
            (name, version, branch, revision, buildno, builddate, compiler) \
                   = platform._sys_version(input)
            self.assertEqual(
                (name, version, '', '', buildno, builddate, compiler), output)

        # Tests for python_implementation(), python_version(), python_branch(),
        # python_revision(), python_build(), and python_compiler().
        sys_versions = {
            ("2.6.1 (r261:67515, Dec  6 2008, 15:26:00) \n[GCC 4.0.1 (Apple Computer, Inc. build 5370)]",
             ('CPython', 'tags/r261', '67515'), self.save_platform)
            :
                ("CPython", "2.6.1", "tags/r261", "67515",
                 ('r261:67515', 'Dec  6 2008 15:26:00'),
                 'GCC 4.0.1 (Apple Computer, Inc. build 5370)'),
            ("IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.3053", None, "cli")
            :
                ("IronPython", "2.0.0", "", "", ("", ""),
                 ".NET 2.0.50727.3053"),
            ("2.5 (trunk:6107, Mar 26 2009, 13:02:18) \n[Java HotSpot(TM) Client VM (\"Apple Computer, Inc.\")]",
            ('Jython', 'trunk', '6107'), "java1.5.0_16")
            :
                ("Jython", "2.5.0", "trunk", "6107",
                 ('trunk:6107', 'Mar 26 2009'), "java1.5.0_16"),
            ("2.5.2 (63378, Mar 26 2009, 18:03:29)\n[PyPy 1.0.0]",
             ('PyPy', 'trunk', '63378'), self.save_platform)
            :
                ("PyPy", "2.5.2", "trunk", "63378", ('63378', 'Mar 26 2009'),
                 "")
            }
        for (version_tag, subversion, sys_platform), info in \
                sys_versions.items():
            sys.version = version_tag
            if subversion is None:
                if hasattr(sys, "subversion"):
                    del sys.subversion
            else:
                sys.subversion = subversion
            if sys_platform is not None:
                sys.platform = sys_platform
            self.assertEqual(platform.python_implementation(), info[0])
            self.assertEqual(platform.python_version(), info[1])
            self.assertEqual(platform.python_branch(), info[2])
            self.assertEqual(platform.python_revision(), info[3])
            self.assertEqual(platform.python_build(), info[4])
            self.assertEqual(platform.python_compiler(), info[5])
Ejemplo n.º 28
0
def get_Python():
    '''
    :Description:get information about Python Interpreter
    '''
    print("获取Python解释器版本:", platform.python_branch())
    print("获取构建信息:", platform.python_build())
    print("获取编译器信息:", platform.python_compiler())
    print("获取解释器的发行版本:", platform.python_implementation())
    print("获取修订信息:", platform.python_revision())
    print("获取版本信息:", platform.python_version())
    print("以元组的形式返回版本信息:", platform.python_version_tuple())
Ejemplo n.º 29
0
 def _add_python(self):
     """
     Collects all python interpreter's data
     """
     self.details["python"] = {
         "branch": platform.python_branch(),
         "build": platform.python_build(),
         "compiler": platform.python_compiler(),
         "implementation": platform.python_implementation(),
         "revision": platform.python_revision(),
         "version": platform.python_version()
     }
Ejemplo n.º 30
0
 def _add_python(self):
     """
     Collects all python interpreter's data
     """
     self.details["python"]={
         "branch": platform.python_branch(),
         "build": platform.python_build(),
         "compiler": platform.python_compiler(),
         "implementation": platform.python_implementation(),
         "revision": platform.python_revision(),
         "version": platform.python_version()
     }
Ejemplo n.º 31
0
def get_app_version_info():

    return model.AppVersionInfo(
        app_version=constants.WARC_HEADER_VALUE_APPLICATION_VERSION,
        app_link=constants.WARC_HEADER_VALUE_APPLICATION_GITHUB_LINK,
        git_hash=get_git_hash(),
        python_version=platform.python_version(),
        python_revision=platform.python_revision(),
        python_build=platform.python_build(),
        python_platform=platform.platform(),
        python_compiler=platform.python_compiler(),
        python_branch=platform.python_branch())
Ejemplo n.º 32
0
def get_runtime_info() -> None:
    """
    Log the environment status
    :return:
    :rtype: None
    """
    logger.info("Platform: %(platform)s",
                {"platform": pprint.pformat(platform.platform())})
    logger.info(
        "Platform details:\n%s",
        pprint.pformat({
            "OpenSSL":
            ssl.OPENSSL_VERSION,
            "architecture":
            platform.architecture(),
            "machine":
            platform.machine(),
            "node":
            platform.node(),
            "processor":
            platform.processor(),
            "python_build":
            platform.python_build(),
            "python_compiler":
            platform.python_compiler(),
            "python_branch":
            platform.python_branch(),
            "python_implementation":
            platform.python_implementation(),
            "python_revision":
            platform.python_revision(),
            "python_version":
            platform.python_version(),
            "release":
            platform.release(),
            "system":
            platform.system(),
            "version":
            platform.version(),
        }),
    )
    logger.info(
        "Versions:\n%s",
        pprint.pformat({
            "Python": platform.python_version(),
            "Sanic": sanic.__version__,
            "cachetools": cachetools.__version__,
            "grpcio": grpc.__version__,
            "orjson": orjson.__version__,  # pylint: disable=c-extension-no-member
            "uvloop": uvloop.__version__,
            "websockets": websockets.__version__,
        }),
    )
Ejemplo n.º 33
0
def TestPlatform():
        #获取操作系统类型
        print platform.system()
        #计算机的网络名称
        print platform.node()
        #获取操作系统名称及版本号
        print platform.platform()
        #获取操作系统的位数
        print platform.architecture()
        # 计算机处理器信息
        print platform.processor()
        #获取计算机类型
        print platform.machine()
        #获取计算机处理机信息
        print platform.processor()
        #获取操作系统中Python的构建日期
        print platform.python_build()
        #获取系统中python解释器的信息
        print platform.python_compiler()

        if platform.python_branch() == "":
        print platform.python_implementation()
        print platform.python_revision()
        print platform.release()
        print platform.system()
        #信息汇总
        print platform.uname()
        
def UsePlatform():
    sysstr = platform.system()
    if (sysstr == "Windows"):
        print ("Call Windows tasks")
    elif (sysstr == "Linux"):
        print ("Call Linux tasks")
    else:
        print ("Other System tasks")

if __name__ == '__main__':
    main()
Ejemplo n.º 34
0
     self.info.arch.machineType = platform.machine()
     self.info.arch.networkName = platform.node()
     self.info.arch.processorType = platform.processor()
     
 def initInfoPython(self):    
     self.info.python.buildNumber, self.info.python.buildDate = platform.python_build()
     self.info.python.compiler = platform.python_compiler()
     self.info.python.branch = platform.python_branch()
     self.info.python.implementation = platform.python_implementation()
     self.info.python.revision = platform.python_revision()
     self.info.python.version = platform.python_version()
     tmp = platform.python_version_tuple()
     self.info.python.versionTuple = tmp
    def __init__(self):
        '''
        Initialize the class. Return standard runtime environment.
        '''

        self.theArchitecture = platform.architecture(executable=sys.executable,
                                                     bits='',
                                                     linkage='')
        self.theMachine = platform.machine()
        self.theNode = platform.node()

        if platformAvailable:
            # Introduced with Python 2.3
            self.thePlatform = platform.platform(aliased=1, terse=0)
        else:
            # NOT Introduced until Python 2.3
            self.thePlatform = ''

        if platformAvailable:
            try:
                # Introduced with Python 2.6
                self.thePython_branch = platform.python_branch()
                self.thePython_implementation = \
                                              platform.python_implementation()
                self.thePython_revision = platform.python_revision()
            except Exception as errorCode:
                # NOT Introduced until Python 2.6
                self.thePython_branch = ''
                self.thePython_implementation = ''
                self.thePython_revision = ''
        else:
            # NOT Introduced until Python 2.6
            self.thePython_branch = ''
            self.thePython_implementation = ''
            self.thePython_revision = ''

        self.theProcessor = platform.processor()
        self.thePython_build = platform.python_build()
        self.thePython_compiler = platform.python_compiler()
        self.thePython_version = platform.python_version()
        self.thePython_version_tuple = platform.python_version_tuple()
        self.theRelease = platform.release()
        self.theSystem = platform.system()
        self.theUname = platform.uname()
        self.theVersion = platform.version()

        self.theSystem_alias = platform.system_alias(self.theSystem,
                                                     self.theRelease,
                                                     self.theVersion)
Ejemplo n.º 36
0
def get_runtime_info(logger) -> None:
    """

    :param logger:
    :type logger: logging.Logger
    :return:
    :rtype: None
    """
    logger.info("Platform: %(platform)s",
                {"platform": pprint.pformat(platform.platform())})

    logger.info(
        "Platform details:\n%(details)s",
        {
            "details":
            pprint.pformat(
                {
                    "OpenSSL": ssl.OPENSSL_VERSION,
                    "architecture": platform.architecture(),
                    "machine": platform.machine(),
                    "node": platform.node(),
                    "processor": platform.processor(),
                    "python_build": platform.python_build(),
                    "python_compiler": platform.python_compiler(),
                    "python_branch": platform.python_branch(),
                    "python_implementation": platform.python_implementation(),
                    "python_revision": platform.python_revision(),
                    "python_version": platform.python_version(),
                    "release": platform.release(),
                    "system": platform.system(),
                    "version": platform.version(),
                })
        },
    )

    logger.info(
        "Versions:\n%(versions)s",
        {
            "versions":
            pprint.pformat({
                "Python": platform.python_version(),
                "aiokafka": aiokafka.__version__,
                "apscheduler": apscheduler.__version__,
                "asyncpg": asyncpg.__version__,
                "cachetools": cachetools.__version__,
                "uvloop": uvloop.__version__,
            })
        },
    )
Ejemplo n.º 37
0
 def __init__(self):
     super().__init__()
     self['revscoring_version'] = __version__
     self['platform'] = platform.platform()
     self['machine'] = platform.machine()
     self['version'] = platform.version()
     self['system'] = platform.system()
     self['processor'] = platform.processor()
     self['python_build'] = platform.python_build()
     self['python_compiler'] = platform.python_compiler()
     self['python_branch'] = platform.python_branch()
     self['python_implementation'] = platform.python_implementation()
     self['python_revision'] = platform.python_revision()
     self['python_version'] = platform.python_version()
     self['release'] = platform.release()
Ejemplo n.º 38
0
def get_text(co, fo, args):
    l = []
    l.append(("version", platform.python_version()))
    l.append(("build", platform.python_build()[0]))
    l.append(("build date", platform.python_build()[1]))
    l.append(("compiler", platform.python_compiler()))
    if fileobj.util.is_python_version_or_ht(2, 6, 0):
        l.append(("implementation", platform.python_implementation()))
        l.append(("branch", platform.python_branch()))
        l.append(("revision", platform.python_revision()))
    l.append(("executable", sys.executable))

    n = max([len(x[0]) for x in l])
    f = "{{0:<{0}}} {{1}}".format(n)
    return [f.format(*x) for x in l]
Ejemplo n.º 39
0
def get_text(co, fo, args):
    l = []
    l.append(("version", platform.python_version()))
    l.append(("build", platform.python_build()[0]))
    l.append(("build date", platform.python_build()[1]))
    l.append(("compiler", platform.python_compiler()))
    if fileobj.util.is_python_version_or_ht(2, 6, 0):
        l.append(("implementation", platform.python_implementation()))
        l.append(("branch", platform.python_branch()))
        l.append(("revision", platform.python_revision()))
    l.append(("executable", sys.executable))

    n = max([len(x[0]) for x in l])
    f = "{{0:<{0}}} {{1}}".format(n)
    return [f.format(*x) for x in l]
	def get(self):

		retVal = {}
		retVal["success"] = True
		retVal["message"] = "OK"
		retVal["commit"] = os.environ["COMMIT"] if "COMMIT" in os.environ else "dev"
		retVal["timestamp"] = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
		retVal["lastmod"] = os.environ["LASTMOD"] if "LASTMOD" in os.environ else "dev"
		retVal["tech"] = "Python %d.%d.%d" % (sys.version_info.major, sys.version_info.minor, sys.version_info.micro)
		retVal["version"] = "%s (%s)" % (platform.python_version(), platform.python_implementation())
		add_if_exists(retVal, "platform.machine()", platform.machine())
		add_if_exists(retVal, "platform.node()", platform.node())
		#IOError: add_if_exists(retVal, "platform.platform()", platform.platform())
		add_if_exists(retVal, "platform.processor()", platform.processor())
		add_if_exists(retVal, "platform.python_branch()", platform.python_branch())
		add_if_exists(retVal, "platform.python_build()", platform.python_build())
		add_if_exists(retVal, "platform.python_compiler()", platform.python_compiler())
		add_if_exists(retVal, "platform.python_implementation()", platform.python_implementation())
		add_if_exists(retVal, "platform.python_version()", platform.python_version())
		add_if_exists(retVal, "platform.python_revision()", platform.python_revision())
		add_if_exists(retVal, "platform.release()", platform.release())
		add_if_exists(retVal, "platform.system()", platform.system())
		add_if_exists(retVal, "platform.version()", platform.version())
		add_if_exists(retVal, "platform.uname()", platform.uname())
		add_if_exists(retVal, "sysconfig.get_platform()", sysconfig.get_platform())
		add_if_exists(retVal, "sysconfig.get_python_version()", sysconfig.get_python_version())
		add_if_exists(retVal, "sys.byteorder", sys.byteorder)
		add_if_exists(retVal, "sys.copyright", sys.copyright)
		add_if_exists(retVal, "sys.getdefaultencoding()", sys.getdefaultencoding())
		add_if_exists(retVal, "sys.getfilesystemencoding()", sys.getfilesystemencoding())
		add_if_exists(retVal, "sys.maxint", sys.maxint)
		add_if_exists(retVal, "sys.maxsize", sys.maxsize)
		add_if_exists(retVal, "sys.maxunicode", sys.maxunicode)
		add_if_exists(retVal, "sys.version", sys.version)

		self.response.headers['Content-Type'] = 'text/plain'

		callback = self.request.get('callback')
		if len(callback) == 0 or re.match("[a-zA-Z][-a-zA-Z0-9_]*$", callback) is None:
			self.response.headers['Access-Control-Allow-Origin'] = '*'
			self.response.headers['Access-Control-Allow-Methods'] = 'POST, GET'
			self.response.headers['Access-Control-Max-Age'] = '604800' # 1 week
			self.response.out.write(json.dumps(retVal, separators=(',', ':')))
		else:
			self.response.out.write(callback)
			self.response.out.write("(")
			self.response.out.write(json.dumps(retVal, separators=(',', ':')))
			self.response.out.write(");")
Ejemplo n.º 41
0
def TestPlatform():
    print("----------Operation System Info--------------------------")
    print('The version of Python is:',platform.python_version())#  获取Python版本
    print('The structure of OS executable is:',platform.architecture())#   获取操作系统可执行程序的结构
    print('The network name of the computer is:',platform.node())#   计算机的网络名称
    print('The name of OS and version number is:',platform.platform())# 获取操作系统名称及版本号
    print('The computer processor information is:',platform.processor())# 计算机处理器信息
    print('The build date for Python on the OS is:',platform.python_build())# 获取操作系统中Python的构建日期
    print('The information about the Python interpreter in the OS is:',platform.python_compiler()) #  获取系统中python解释器的信息
    if platform.python_branch() == "":
        print('The Python implementation is:',platform.python_implementation())
        print('The Python implementation SCM revision is:',platform.python_revision())
    print('The release information is:',platform.release())
    print('The operating system is:',platform.system())#获取此电脑使用什么操作系统
    print('The OS version is:',platform.version())#  获取操作系统的版本
    print('All the information is:',platform.uname())#  包含上面所有的信息汇总
Ejemplo n.º 42
0
 def __init__(self):
     """
     Construct an environment snapshot.
     """
     super().__init__()
     self['revscoring_version'] = __version__
     self['platform'] = platform.platform()
     self['machine'] = platform.machine()
     self['version'] = platform.version()
     self['system'] = platform.system()
     self['processor'] = platform.processor()
     self['python_build'] = platform.python_build()
     self['python_compiler'] = platform.python_compiler()
     self['python_branch'] = platform.python_branch()
     self['python_implementation'] = platform.python_implementation()
     self['python_revision'] = platform.python_revision()
     self['python_version'] = platform.python_version()
     self['release'] = platform.release()
Ejemplo n.º 43
0
    def python_details():
        """
        Returns a dictionary containing details about the Python interpreter
        """
        build_no, build_date = platform.python_build()
        results = {
            # Version of interpreter
            'build.number': build_no,
            'build.date': build_date,
            'compiler': platform.python_compiler(),
            'branch': platform.python_branch(),
            'revision': platform.python_revision(),
            'implementation': platform.python_implementation(),
            'version': '.'.join(str(v) for v in sys.version_info),

            # API version
            'api.version': sys.api_version,

            # Installation details
            'prefix': sys.prefix,
            'base_prefix': getattr(sys, 'base_prefix', None),
            'exec_prefix': sys.exec_prefix,
            'base_exec_prefix': getattr(sys, 'base_exec_prefix', None),

            # Execution details
            'executable': sys.executable,
            'encoding.default': sys.getdefaultencoding(),

            # Other details, ...
            'recursion_limit': sys.getrecursionlimit()
        }

        # Threads implementation details
        thread_info = getattr(sys, 'thread_info', (None, None, None))
        results['thread_info.name'] = thread_info[0]
        results['thread_info.lock'] = thread_info[1]
        results['thread_info.version'] = thread_info[2]

        # ABI flags (POSIX only)
        results['abiflags'] = getattr(sys, 'abiflags', None)

        # -X options (CPython only)
        results['x_options'] = getattr(sys, '_xoptions', None)
        return results
Ejemplo n.º 44
0
	def get(self):

		retVal = {}
		retVal["success"] = True
		retVal["message"] = "OK"
		retVal["version"] = "%s (%s)" % (platform.python_version(), platform.python_implementation())
		add_if_exists(retVal, "platform.machine()", platform.machine())
		add_if_exists(retVal, "platform.node()", platform.node())
		#IOError: add_if_exists(retVal, "platform.platform()", platform.platform())
		add_if_exists(retVal, "platform.processor()", platform.processor())
		add_if_exists(retVal, "platform.python_branch()", platform.python_branch())
		add_if_exists(retVal, "platform.python_build()", platform.python_build())
		add_if_exists(retVal, "platform.python_compiler()", platform.python_compiler())
		add_if_exists(retVal, "platform.python_implementation()", platform.python_implementation())
		add_if_exists(retVal, "platform.python_version()", platform.python_version())
		add_if_exists(retVal, "platform.python_revision()", platform.python_revision())
		add_if_exists(retVal, "platform.release()", platform.release())
		add_if_exists(retVal, "platform.system()", platform.system())
		add_if_exists(retVal, "platform.version()", platform.version())
		add_if_exists(retVal, "platform.uname()", platform.uname())
		add_if_exists(retVal, "sysconfig.get_platform()", sysconfig.get_platform())
		add_if_exists(retVal, "sysconfig.get_python_version()", sysconfig.get_python_version())
		add_if_exists(retVal, "sys.byteorder", sys.byteorder)
		add_if_exists(retVal, "sys.copyright", sys.copyright)
		add_if_exists(retVal, "sys.getdefaultencoding()", sys.getdefaultencoding())
		add_if_exists(retVal, "sys.getfilesystemencoding()", sys.getfilesystemencoding())
		add_if_exists(retVal, "sys.maxint", sys.maxint)
		add_if_exists(retVal, "sys.maxsize", sys.maxsize)
		add_if_exists(retVal, "sys.maxunicode", sys.maxunicode)
		add_if_exists(retVal, "sys.version", sys.version)

		self.response.headers['Content-Type'] = 'text/plain'

		callback = self.request.get('callback')
		if len(callback) == 0 or re.match("[a-zA-Z][-a-zA-Z0-9_]*$", callback) is None:
			self.response.out.write(json.dumps(retVal, separators=(',', ':')))
		else:
			self.response.out.write(callback)
			self.response.out.write("(")
			self.response.out.write(json.dumps(retVal, separators=(',', ':')))
			self.response.out.write(");")
Ejemplo n.º 45
0
 def __init__(self):
     dict.__init__(self, {
         'architecture': platform.architecture(),
         'max_int': sys.maxint,
         'max_size': sys.maxsize,
         'max_unicode': sys.maxunicode,
         'name': platform.node(),
         'path_seperator': os.path.sep,
         'processor': platform.processor(),
         'python_version': platform.python_version(),
         'python_branch': platform.python_branch(),
         'python_build': platform.python_build(),
         'python_compiler': platform.python_compiler(),
         'python_implementation': platform.python_implementation(),
         'python_revision': platform.python_revision(),
         'python_version_tuple': platform.python_version_tuple(),
         'python_path': sys.path,
         'system': platform.system(),
         'temp_directory': tempfile.gettempdir(),
         'uname': platform.uname(),
 })
Ejemplo n.º 46
0
    def python_details():
        """
        Returns a dictionary containing details about the Python interpreter
        """
        build_no, build_date = platform.python_build()
        results = {
            # Version of interpreter
            "build.number": build_no,
            "build.date": build_date,
            "compiler": platform.python_compiler(),
            "branch": platform.python_branch(),
            "revision": platform.python_revision(),
            "implementation": platform.python_implementation(),
            "version": ".".join(str(v) for v in sys.version_info),
            # API version
            "api.version": sys.api_version,
            # Installation details
            "prefix": sys.prefix,
            "base_prefix": getattr(sys, "base_prefix", None),
            "exec_prefix": sys.exec_prefix,
            "base_exec_prefix": getattr(sys, "base_exec_prefix", None),
            # Execution details
            "executable": sys.executable,
            "encoding.default": sys.getdefaultencoding(),
            # Other details, ...
            "recursion_limit": sys.getrecursionlimit(),
        }

        # Threads implementation details
        thread_info = getattr(sys, "thread_info", (None, None, None))
        results["thread_info.name"] = thread_info[0]
        results["thread_info.lock"] = thread_info[1]
        results["thread_info.version"] = thread_info[2]

        # ABI flags (POSIX only)
        results["abiflags"] = getattr(sys, "abiflags", None)

        # -X options (CPython only)
        results["x_options"] = getattr(sys, "_xoptions", None)
        return results
Ejemplo n.º 47
0
def about(name):
    """Return generic 'about' information used across all toolboxes."""
    import platform
    import pkg_resources
    namever = str(pkg_resources.get_distribution(name.split('.')[0]))
    print('package name = {0}\npackage version = {1}'.format(
        *namever.split()))

    print('platform architecture = {0}'.format(platform.architecture()))
    print('platform machine = {0}'.format(platform.machine()))
    print('platform = {0}'.format(platform.platform()))
    print('platform processor = {0}'.format(platform.processor()))
    print('platform python_build = {0}'.format(platform.python_build()))
    print('platform python_compiler = {0}'.format(platform.python_compiler()))
    print('platform python branch = {0}'.format(platform.python_branch()))
    print('platform python implementation = {0}'.format(
        platform.python_implementation()))
    print('platform python revision = {0}'.format(platform.python_revision()))
    print('platform python version = {0}'.format(platform.python_version()))
    print('platform release = {0}'.format(platform.release()))
    print('platform system = {0}'.format(platform.system()))
    print('platform version = {0}'.format(platform.version()))
Ejemplo n.º 48
0
import platform

print(platform.architecture())
print(platform.machine())
print(platform.platform())
print(platform.processor())
print(platform.python_implementation())
print(platform.python_version())
print(platform.python_revision())
print(platform.release())
print(platform.system())
print(platform.win32_ver())
Ejemplo n.º 49
0
 def test_python_revision(self):
     res = platform.python_revision()
Ejemplo n.º 50
0
def __internal(type,message,thread = None,fyle = None,line = None,context = None):
 try:
  global __host,__apiKey,__version,__enableEnvironmentInfo,__enableSystemInfo

  trace = message
  if not context is None: trace = ('%s\n%s' % (message,context)).replace('\n  ','\n\t')

  extra = {}
  extra['Message'] = message
  if not fyle is None: extra['File'] = fyle
  if not line is None: extra['Line'] = line
  if not context is None: extra['Context'] = context
  if not thread is None: extra['Thread'] = thread
  extra['Crumbs'] = json.dumps(__getCrumbs())
  try:
   if __enableEnvironmentInfo is True:
    e = {}
    for k,v in os.environ.items(): e[k] = v
    extra['Environment'] = json.loads(json.dumps(e))
  finally:
   pass

  try:
   if __enableSystemInfo is True:
    info = {}
    info['API Version'] = sys.api_version
    info['Builtin Modules'] = ', '.join(sys.builtin_module_names)
    info['Byte Order'] = sys.byteorder
    info['Command Line'] = ' '.join(sys.argv)
    info['Default Encoding'] = sys.getdefaultencoding()
    info['File System Encoding'] = sys.getfilesystemencoding()
    info['Flags'] = __fromTuple(sys.flags)
    info['Float Info'] = __fromTuple(sys.float_info)
    info['Loaded Modules'] = ', '.join(sorted(sys.modules.keys()))
    info['Path'] = sys.path
    info['Python Executable'] = sys.executable
    info['Platform'] = sys.platform
    info['Machine Name'] = platform.node()
    info['Machine Type'] = platform.machine()
    info['Python Architecture'] = platform.architecture()[0]
    info['Python Build Date'] = platform.python_build()[1]
    info['Python Compiler'] = platform.python_compiler()
    info['Python Branch'] = platform.python_branch()
    info['Python Implementation'] = platform.python_implementation()
    info['Python Revision'] = platform.python_revision()
    info['Python Version'] = platform.python_version()
    info['Python Release'] = platform.release()
    info['System'] = platform.system()
    extra['System'] = json.loads(json.dumps(info))
  finally:
   pass

  payload = {
   'APIKey':__apiKey,
   'Event':trace,
   'Extra':json.dumps(extra,separators = (',',':')),
   'Platform':'11',
   'Time':int(time.time()),
   'Type':type,
   'Version':__version
   }
  sock = ssl.wrap_socket(socket(),cert_reqs = ssl.CERT_REQUIRED,ca_certs = __getCACert())
  sock.connect((__host,443))
  if not __verifySocket(sock): return
  if sys.version_info[0] == 3:
   payload = urllib.parse.urlencode(payload) # getattr(getattr(urllib,'parse'),'urlencode')(payload)
  else:
   payload = urllib.urlencode(payload) # getattr(urllib,'urlencode')(payload)
  sock.sendall(('POST ' + __path + '/rest/event-add.jsp HTTP/1.0\r\nContent-Length: ' + str(len(payload)) + '\r\nContent-Type: application/x-www-form-urlencoded\r\nHost: ' + __host + '\r\n\r\n' + payload).encode('utf-8'))
  # while 1:
  # buf = sock.recv(1000)
  # if not buf: break
  # sys.stdout.write(buf)
  sock.close()
 # except:
 # print(sys.exc_info()[0],sys.exc_info()[1],__excepttrace(sys.exc_info()[2],False)[3])
 finally:
  pass
Ejemplo n.º 51
0
verinfofile = open(verinfofilename, "r");
verinfodata = verinfofile.read();
verinfofile.close();
mycurtime = datetime.datetime.now();
mycurtimetuple = mycurtime.timetuple();
mycurtimestamp = int(time.mktime(mycurtimetuple));
'''verinfodata = verinfodata.replace('__build_time__ = {"timestamp": None, "year": None, "month": None, "day": None, "hour": None, "minute": None, "second": None};', '__build_time__ = {"timestamp": '+str(mycurtimestamp)+', "year": '+str(mycurtimetuple[0])+', "month": '+str(mycurtimetuple[1])+', "day": '+str(mycurtimetuple[2])+', "hour": '+str(mycurtimetuple[3])+', "minute": '+str(mycurtimetuple[4])+', "second": '+str(mycurtimetuple[5])+'};');'''
verinfodata = re.sub("__build_time__ \= \{.*\}\;", '__build_time__ = {"timestamp": '+str(mycurtimestamp)+', "year": '+str(mycurtimetuple[0])+', "month": '+str(mycurtimetuple[1])+', "day": '+str(mycurtimetuple[2])+', "hour": '+str(mycurtimetuple[3])+', "minute": '+str(mycurtimetuple[4])+', "second": '+str(mycurtimetuple[5])+'};', verinfodata);
utccurtime = datetime.datetime.utcnow();
utccurtimetuple = utccurtime.timetuple();
utccurtimestamp = int(time.mktime(utccurtimetuple));
'''verinfodata = verinfodata.replace('__build_time_utc__ = {"timestamp": None, "year": None, "month": None, "day": None, "hour": None, "minute": None, "second": None};', '__build_time_utc__ = {"timestamp": '+str(utccurtimestamp)+', "year": '+str(utccurtimetuple[0])+', "month": '+str(utccurtimetuple[1])+', "day": '+str(utccurtimetuple[2])+', "hour": '+str(utccurtimetuple[3])+', "minute": '+str(utccurtimetuple[4])+', "second": '+str(utccurtimetuple[5])+'};');'''
verinfodata = re.sub("__build_time_utc__ \= \{.*\}\;", '__build_time_utc__ = {"timestamp": '+str(utccurtimestamp)+', "year": '+str(utccurtimetuple[0])+', "month": '+str(utccurtimetuple[1])+', "day": '+str(utccurtimetuple[2])+', "hour": '+str(utccurtimetuple[3])+', "minute": '+str(utccurtimetuple[4])+', "second": '+str(utccurtimetuple[5])+'};', verinfodata);
if(sys.version[0]=="2"):
 '''verinfodata = verinfodata.replace('__build_python_info__ = {"python_branch": None, "python_build": None, "python_compiler": None, "python_implementation": None, "python_revision": None, "python_version": None, "python_version_tuple": None, "release": None, "system": None, "uname": None, "machine": None, "node": None, "platform": None, "processor": None, "version": None, "java_ver": None, "win32_ver": None, "mac_ver": None, "linux_distribution": None, "libc_ver": None};', '__build_python_info__ = '+str({'python_branch': platform.python_branch(), 'python_build': platform.python_build(), 'python_compiler': platform.python_compiler(), 'python_implementation': platform.python_implementation(), 'python_revision': platform.python_revision(), 'python_version': platform.python_version(), 'python_version_tuple': platform.python_version_tuple(), 'release': platform.release(), 'system': platform.system(), 'uname': platform.uname(), 'machine': platform.machine(), 'node': platform.node(), 'platform': platform.platform(), 'processor': platform.processor(), 'architecture': platform.architecture(), 'version': platform.version(), 'java_ver': platform.java_ver(), 'win32_ver': platform.win32_ver(), 'mac_ver': platform.mac_ver(), 'linux_distribution': platform.linux_distribution(), 'libc_ver': platform.libc_ver()})+';');'''
 verinfodata = re.sub("__build_python_info__ \= \{.*\}\;", '__build_python_info__ = '+str({'python_branch': platform.python_branch(), 'python_build': platform.python_build(), 'python_compiler': platform.python_compiler(), 'python_implementation': platform.python_implementation(), 'python_revision': platform.python_revision(), 'python_version': platform.python_version(), 'python_version_tuple': platform.python_version_tuple(), 'release': platform.release(), 'system': platform.system(), 'uname': platform.uname(), 'machine': platform.machine(), 'node': platform.node(), 'platform': platform.platform(), 'processor': platform.processor(), 'architecture': platform.architecture(), 'version': platform.version(), 'java_ver': platform.java_ver(), 'win32_ver': platform.win32_ver(), 'mac_ver': platform.mac_ver(), 'linux_distribution': platform.linux_distribution(), 'libc_ver': platform.libc_ver()})+';', verinfodata);
if(sys.version[0]=="3"):
 '''verinfodata = verinfodata.replace('__build_python_info__ = {"python_branch": None, "python_build": None, "python_compiler": None, "python_implementation": None, "python_revision": None, "python_version": None, "python_version_tuple": None, "release": None, "system": None, "uname": None, "machine": None, "node": None, "platform": None, "processor": None, "version": None, "java_ver": None, "win32_ver": None, "mac_ver": None, "linux_distribution": None, "libc_ver": None};', '__build_python_info__ = '+str({'python_branch': platform.python_branch(), 'python_build': platform.python_build(), 'python_compiler': platform.python_compiler(), 'python_implementation': platform.python_implementation(), 'python_revision': platform.python_revision(), 'python_version': platform.python_version(), 'python_version_tuple': platform.python_version_tuple(), 'release': platform.release(), 'system': platform.system(), 'uname': (platform.uname()[0], platform.uname()[1], platform.uname()[2], platform.uname()[3], platform.uname()[4], platform.uname()[5]), 'machine': platform.machine(), 'node': platform.node(), 'platform': platform.platform(), 'processor': platform.processor(), 'architecture': platform.architecture(), 'version': platform.version(), 'java_ver': platform.java_ver(), 'win32_ver': platform.win32_ver(), 'mac_ver': platform.mac_ver(), 'linux_distribution': platform.linux_distribution(), 'libc_ver': platform.libc_ver()})+';');'''
 verinfodata = re.sub("__build_python_info__ \= \{.*\}\;", '__build_python_info__ = '+str({'python_branch': platform.python_branch(), 'python_build': platform.python_build(), 'python_compiler': platform.python_compiler(), 'python_implementation': platform.python_implementation(), 'python_revision': platform.python_revision(), 'python_version': platform.python_version(), 'python_version_tuple': platform.python_version_tuple(), 'release': platform.release(), 'system': platform.system(), 'uname': (platform.uname()[0], platform.uname()[1], platform.uname()[2], platform.uname()[3], platform.uname()[4], platform.uname()[5]), 'machine': platform.machine(), 'node': platform.node(), 'platform': platform.platform(), 'processor': platform.processor(), 'architecture': platform.architecture(), 'version': platform.version(), 'java_ver': platform.java_ver(), 'win32_ver': platform.win32_ver(), 'mac_ver': platform.mac_ver(), 'linux_distribution': platform.linux_distribution(), 'libc_ver': platform.libc_ver()})+';', verinfodata);
verinfofile = open(verinfofilename, "w");
verinfofile.write(verinfodata);
verinfofile.close();
setup(
 name = 'PyUPC-EAN',
 version = '2.7.11',
 author = 'Kazuki Przyborowski',
 author_email = '*****@*****.**',
 maintainer = 'Kazuki Przyborowski',
 maintainer_email = '*****@*****.**',
 description = 'A barcode library/module for python.',
 license = 'Revised BSD License',
Ejemplo n.º 52
0
def _get_facts(*, kit=None):
    """
    Get facts

    Facts are immutable global variables
    set at the very end of variable resolution.

    :param kit: A kit from which facts are going to be extracted
    :return: A dictionary with a bunch of scavenged variables
    """

    # these are the facts
    facts = {}

    # General facts that are available for every platform
    _create_fact(facts, 'version', pkg_version)
    _create_fact(facts, 'install_prefix', os.getenv('HOME'))

    # General system-related facts
    _create_fact(facts, 'sys_uid', os.getuid())
    _create_fact(facts, 'sys_gid', os.getgid())

    # A collection of current environment variables is held in here
    _create_fact(facts, 'env', dict(os.environ))

    # Facts for *nix operating systems
    _create_fact(facts, 'sys_path', os.getenv("PATH").split(":"))
    if os.name == 'posix':
        _create_fact(facts, 'sys_user', os.getenv('USER'))
        _create_fact(facts, 'sys_user_home', os.getenv('HOME'))

    ####################################################
    # System-related facts:
    # ---------------------
    # These facts collect characteristics of the current
    # platform zenfig is running on
    ####################################################

    # Operating System facts
    _system = platform.system()
    _create_fact(facts, 'system', _system)
    _create_fact(facts, 'sys_node', platform.node())

    # These are exclusive to linux-based systems
    if _system == 'Linux':
        linux_distro = platform.linux_distribution()
        _create_fact(facts, 'linux_dist_name', linux_distro[0])
        _create_fact(facts, 'linux_dist_version', linux_distro[1])
        _create_fact(facts, 'linux_dist_id', linux_distro[2])

        # kernel version
        _create_fact(facts, 'linux_release', platform.release())

    # OSX-specific facts
    if _system == 'Darwin':
        _create_fact(facts, 'osx_ver', platform.mac_ver())

    # Hardware-related facts
    _create_fact(facts, 'sys_machine', platform.machine())

    # Low level CPU information (thanks to cpuinfo)
    _cpu_info = cpuinfo.get_cpu_info()
    _create_fact(facts, 'cpu_vendor_id', _cpu_info['vendor_id'])
    _create_fact(facts, 'cpu_brand', _cpu_info['brand'])
    _create_fact(facts, 'cpu_cores', _cpu_info['count'])
    _create_fact(facts, 'cpu_hz', _cpu_info['hz_advertised_raw'][0])
    _create_fact(facts, 'cpu_arch', _cpu_info['arch'])
    _create_fact(facts, 'cpu_bits', _cpu_info['bits'])

    # RAM information
    _create_fact(facts, 'mem_total', psutil.virtual_memory()[0])

    ####################
    # Python information
    ####################
    _py_ver = platform.python_version_tuple()
    _create_fact(facts, 'python_implementation', platform.python_revision())
    _create_fact(facts, 'python_version', platform.python_version())
    _create_fact(facts, 'python_version_major', _py_ver[0])
    _create_fact(facts, 'python_version_minor', _py_ver[1])
    _create_fact(facts, 'python_version_patch', _py_ver[2])

    # Kit index variables are taken as well as facts
    # so they can be referenced by other variables, also
    # this means that index variables from a kit can reference
    # other variables as well, because all these variables get
    # rendered as part of variable resolution.
    if kit is not None:
        for key, value in kit.index_data.items():
            _create_fact(facts, key, value, prefix="{}_{}".format(pkg_name, "kit"))

    # Give those variables already!
    return facts
Ejemplo n.º 53
0
        platform.dist(),
        platform.java_ver(),
        platform.libc_ver(),
        platform.linux_distribution(),
        platform.mac_ver(),
        platform.machine(),
        platform.node(),
        platform.os,
        platform.platform(),
        platform.popen,
        platform.processor(),
        platform.python_branch(),
        platform.python_build(),
        platform.python_compiler(),
        platform.python_implementation(),
        platform.python_revision(),
        platform.python_version(),
        platform.python_version_tuple(),
        platform.re,
        platform.release(),
        platform.sys,
        platform.system(),
        platform.system_alias,
        platform.uname(),
        platform.version(),
        platform.win32_ver(),
        django.get_version()
    )

if not ('LOGSTART' in globals()):
    logger = logging.getLogger(__name__)
	def __init__(self):
		# 1073741824 is a "binary" gigabyte.
		self._Gigabyte = 1073741824.0

		# Last time the disk stats were updated.
		self._LastTime = 0.0

		# Default string for when we have an error getting data.
		self._DefaultErrorStr = '?????'

		# Default data.
		self._Stats = {'system' : platform.system(),
			'platform' : platform.platform(),
			'node' : platform.node(),
			'python_version' : platform.python_version(),
			'python_revision' : platform.python_revision(),

			'extendedstats' : False,

			'memtotal' : None,
			'cpumodel_name' : None,
			'disksize' : None,

			'cputotal' : None,
			'cpuidle' : None,
			'servercpu' : None,
			'diskfree' : None
		}

		# The following information is platform specific, but it won't
		# change during run time.
		if platform.system() == 'Linux':

			# Extended stats are available.
			self._Stats['extendedstats'] = True

			# We extract the total amount of installed memory.
			try:
				with open('/proc/meminfo') as f:
					meminfo = f.readlines()
					# Find the line with the total memory.
					memtotalstr = [x for x in meminfo if x.lower().startswith('memtotal:')]
					# Split the field on the first ":" character, get 
					# the second half, and strip the leading and trailing blanks.
					self._Stats['memtotal'] = memtotalstr[0].split(':', 1)[1].strip()
			except:
				self._Stats['memtotal'] = self._DefaultErrorStr

			# We extract the model (name) of CPU.
			try:
				with open('/proc/cpuinfo') as f:
					cpuinfo = f.readlines()
					#model_namestr = filter(lambda x: x.startswith('model name'), cpuinfo)
					# See if we can find the model name.
					model_namestr = [x for x in cpuinfo if x.lower().startswith('model name')]
					# No? Perhaps this is an ARM board using the "processor" for this.
					if len(model_namestr) == 0:
						model_namestr = [x for x in cpuinfo if x.lower().startswith('processor')]
					modelstr = model_namestr[0].split(':', 1)[1].strip()

					# If this can be successfully converted to an integer, it 
					# isn't really a CPU name. This problem may arise with ARM.
					# If everything *is* OK, then we should get an exception.
					try:
						cpuint = int(modelstr)
						modelstr = self._DefaultErrorStr
					except:
						pass

					self._Stats['cpumodel_name'] = modelstr
			except:
					self._Stats['cpumodel_name'] = self._DefaultErrorStr

			# Disk size.
			try:
				diskstats = os.statvfs('/home')
				self._Stats['disksize'] = '%.1f GB' % ((diskstats.f_bsize * diskstats.f_blocks) / self._Gigabyte)
			except:
				self._Stats['disksize'] = self._DefaultErrorStr
Ejemplo n.º 55
0
# coding=utf-8
# 获取系统平台信息

import platform

print platform.platform() #鑾峰彇鎿嶄綔绯荤粺鍚嶇О鍙婄増鏈彿锛屸�橶indows-7-6.1.7601-SP1鈥�
print platform.version() #鑾峰彇鎿嶄綔绯荤粺鐗堟湰鍙凤紝鈥�6.1.7601鈥�
print platform.architecture() #鑾峰彇鎿嶄綔绯荤粺鐨勪綅鏁帮紝(鈥�32bit鈥�, 鈥榃indowsPE鈥�)
print platform.machine() #璁$畻鏈虹被鍨嬶紝鈥檟86鈥�
print platform.node() #璁$畻鏈虹殑缃戠粶鍚嶇О锛屸�檋ongjie-PC鈥�
print platform.processor() #璁$畻鏈哄鐞嗗櫒淇℃伅锛屸�檟86 Family 16 Model 6 Stepping 3, AuthenticAMD鈥�
print platform.uname() #鍖呭惈涓婇潰鎵�鏈夌殑淇℃伅姹囨�伙紝uname_result(system=鈥橶indows鈥�, node=鈥檋ongjie-PC鈥�,


#杩樺彲浠ヨ幏寰楄绠楁満涓璸ython鐨勪竴浜涗俊鎭細

print platform.python_build()
print platform.python_compiler()
print platform.python_branch()
print platform.python_implementation()
print platform.python_revision()
Ejemplo n.º 56
0
def get_python_revision():
    '''Returns a string identifying the Python implementation SCM revision.'''
    return platform.python_revision()
Ejemplo n.º 57
0
def get_pillow_version(infotype=None):
 pilsupport = check_for_pil();
 if(not pilsupport):
  return pilsupport;
 if(pilsupport):
  from PIL import Image;
  try:
   pillow_ver = Image.PILLOW_VERSION;
   pillow_ver = pillow_ver.split(".");
   pillow_ver = [int(x) for x in pillow_ver];
   pil_is_pillow = True;
  except AttributeError:
   pillow_ver = None;
   pil_is_pillow = False;
  except NameError:
   pillow_ver = None;
   pil_is_pillow = False;
  if(pillow_ver is None):
   return False;
  if(pillow_ver is not None):
   pillow_info = {'pillow_ver': pillow_ver, 'pil_is_pillow': pil_is_pillow};
   return pillow_info.get(infotype, pillow_info);
python_info = {'python_branch': platform.python_branch(), 'python_build': platform.python_build(), 'python_compiler': platform.python_compiler(), 'python_implementation': platform.python_implementation(), 'python_revision': platform.python_revision(), 'python_version': platform.python_version(), 'python_version_tuple': platform.python_version_tuple(), 'release': platform.release(), 'system': platform.system(), 'uname': platform.uname(), 'architecture': platform.architecture(), 'machine': platform.machine(), 'node': platform.node(), 'platform': platform.platform(), 'processor': platform.processor(), 'version': platform.version(), 'java_ver': platform.java_ver(), 'win32_ver': platform.win32_ver(), 'mac_ver': platform.mac_ver(), 'linux_distribution': platform.linux_distribution(), 'libc_ver': platform.libc_ver()};
def get_python_info(infotype=None):
 global python_info;
 python_info = python_info;
 if(infotype is None):
  return python_info;
 if(infotype is not None):
  return python_info.get(infotype, python_info);
    osinfo['os.name'] = os.name
    osinfo['hostname'] = socket.gethostname()
    osinfo['fully-qualified-name'] = socket.getfqdn(osinfo['hostname'])
    osinfo['os.uname'] = os.uname()
    
    try:
        hostinfo['ips'] = ", ".join(getipaddrs(osinfo['hostname']))
    except socket.gaierror, e:
        hostinfo['ips'] = None
    
    platforminfo['machine'] = platform.machine()
    platforminfo['node'] = platform.node()
    platforminfo['platform'] = platform.platform(aliased=0, terse=0)
    platforminfo['processor'] = platform.processor()
    platforminfo['architecture'] = platform.architecture()
    platforminfo['python_build'] = platform.python_build()
    platforminfo['python_version'] = platform.python_version()
    platforminfo['python_compiler'] = platform.python_compiler()
    platforminfo['python_branch'] = platform.python_branch()
    platforminfo['python_implementation'] = platform.python_implementation()
    platforminfo['python_revision'] = platform.python_revision()
    platforminfo['python_version_tuple'] = platform.python_version_tuple()
    platforminfo['release'] = platform.release()
    platforminfo['system'] = platform.system()
    platforminfo['version'] = platform.version()
    platforminfo['system_alias'] = platform.system_alias(platforminfo['system'], platforminfo['release'], platforminfo['version'])
    platforminfo['uname'] = platform.uname()
    platforminfo['linux_distribution'] = platform.linux_distribution()
    
    return render_to_response("home.html", {'request': request, 'osinfo': osinfo, 'hostinfo': hostinfo, 'envinfo': envinfo, 'platforminfo': platforminfo})