python类python_compiler()的实例源码

oil.py 文件源码 项目:oil 作者: oilshell 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def _ShowVersion():
  loader = util.GetResourceLoader()
  f = loader.open('oil-version.txt')
  version = f.readline().strip()
  f.close()

  try:
    f = loader.open('release-date.txt')
  except IOError:
    release_date = '-'  # in dev tree
  else:
    release_date = f.readline().strip()
  finally:
    f.close()

  # What C functions do these come from?
  print('Oil version %s' % version)
  print('Release Date: %s' % release_date)
  print('Arch: %s' % platform.machine())
  print('OS: %s' % platform.system())
  print('Platform: %s' % platform.version())
  print('Compiler: %s' % platform.python_compiler())
  print('Interpreter: %s' % platform.python_implementation())
  print('Interpreter version: %s' % platform.python_version())
provenance.py 文件源码 项目:r5 作者: benureau 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def provenance(dirty=False):
    """Return provenance data about the execution environment.

    :param dirty:  if False, will exit with an error if the git repository
                   is dirty or absent.
    """
    return {'python'   : {'implementation': platform.python_implementation(),
                                'version' : platform.python_version_tuple(),
                                'compiler': platform.python_compiler(),
                                'branch'  : platform.python_branch(),
                                'revision': platform.python_revision()},
            'platform'  : platform.platform(),
            'packages'  : list(pip.commands.freeze.freeze()), # list of installed packages
            'git_info'  : git_info(dirty_allowed=dirty),
            'timestamp' : datetime.utcnow().isoformat()+'Z',  # Z stands for UTC
           }
000_JythonConsoleCommand.py 文件源码 项目:openhab2-jython 作者: steve-bate 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def execute(self, args, console):
        print 'architecture:', platform.architecture()[0]
        print 'java_ver:', platform.java_ver()
        print 'node:', platform.node()
        print 'processor:', platform.processor()
        print 'python_compiler:', platform.python_compiler()
        print 'python_implementation:', platform.python_implementation()
        print 'python_version:', platform.python_version()
        print 'release:', platform.release()
pybench.py 文件源码 项目:oil 作者: oilshell 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def get_machine_details():

    if _debug:
        print 'Getting machine details...'
    buildno, builddate = platform.python_build()
    python = platform.python_version()
    try:
        unichr(100000)
    except ValueError:
        # UCS2 build (standard)
        unicode = 'UCS2'
    except NameError:
        unicode = None
    else:
        # UCS4 build (most recent Linux distros)
        unicode = 'UCS4'
    bits, linkage = platform.architecture()
    return {
        'platform': platform.platform(),
        'processor': platform.processor(),
        'executable': sys.executable,
        'implementation': getattr(platform, 'python_implementation',
                                  lambda:'n/a')(),
        'python': platform.python_version(),
        'compiler': platform.python_compiler(),
        'buildno': buildno,
        'builddate': builddate,
        'unicode': unicode,
        'bits': bits,
        }
pybench.py 文件源码 项目:python2-tracer 作者: extremecoders-re 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def get_machine_details():

    if _debug:
        print 'Getting machine details...'
    buildno, builddate = platform.python_build()
    python = platform.python_version()
    try:
        unichr(100000)
    except ValueError:
        # UCS2 build (standard)
        unicode = 'UCS2'
    except NameError:
        unicode = None
    else:
        # UCS4 build (most recent Linux distros)
        unicode = 'UCS4'
    bits, linkage = platform.architecture()
    return {
        'platform': platform.platform(),
        'processor': platform.processor(),
        'executable': sys.executable,
        'implementation': getattr(platform, 'python_implementation',
                                  lambda:'n/a')(),
        'python': platform.python_version(),
        'compiler': platform.python_compiler(),
        'buildno': buildno,
        'builddate': builddate,
        'unicode': unicode,
        'bits': bits,
        }
basicinfo.py 文件源码 项目:automatic-repo 作者: WZQ1397 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def get_python_compiler(self):
        '''Returns a string identifying the compiler used for compiling Python'''
        return platform.python_compiler()
windows.py 文件源码 项目:py-sys 作者: vicky-tan 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self):
        self.w = wmi.WMI ()
        self.pv = 32 if '32 bit' in platform.python_compiler() else 64
pyinfo.py 文件源码 项目:NZ-ORCID-Hub 作者: Royal-Society-of-New-Zealand 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def get_system_info():  # noqa: D103
    system_info = []

    distname = platform.linux_distribution()[0]
    version = platform.linux_distribution()[1]
    if distname != '' and version != '':
        os_version = '%s %s (%s %s)' % (platform.system(), platform.release(), distname, version)
    else:
        os_version = '%s %s' % (platform.system(), platform.release())
    system_info.append(('OS Version', os_version))

    if hasattr(os, 'path'):
        system_info.append(('OS Path', os.environ['PATH']))

    if hasattr(sys, 'version'):
        system_info.append(('Python Version', sys.version))

    if hasattr(sys, 'subversion'):
        system_info.append(('Python Subversion', sys.subversion[0]))

    if hasattr(sys, 'prefix'):
        system_info.append(('Python Prefix', sys.prefix))

    if hasattr(sys, 'path'):
        system_info.append(('Python Path', sys.path))

    if hasattr(sys, 'executable'):
        system_info.append(('Python Executable', sys.executable))

    if hasattr(sys, 'api_version'):
        system_info.append(('Python API', sys.api_version))

    system_info.append(('Build Date', platform.python_build()[1]))
    system_info.append(('Compiler', platform.python_compiler()))

    return system_info
sysinfo.py 文件源码 项目:sia-cog 作者: deepakkumar1984 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def getSystemInfo():
    result = {"machine": platform.machine(),
              "platform": platform.platform(),
              "processor": platform.processor(),
              "cpu_count": psutil.cpu_count(),
              "os": platform.system(),
              "python_compiler": platform.python_compiler(),
              "python_version": platform.python_version()}
    return result
test_platform.py 文件源码 项目:zippy 作者: securesystemslab 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 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])
test_platform.py 文件源码 项目:ndk-python 作者: gittor 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 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.iteritems():
            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])
core.py 文件源码 项目:PyChroner 作者: NephyProject 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self, prompt: bool=True) -> None:
        pidFile = f"{os.getcwd()}/lock"
        if os.path.isfile(pidFile):
            running = False
            with open(pidFile) as f:
                pid = f.read()
                if pid.isdigit() and psutil.pid_exists(int(pid.strip())):
                    running = True
            if running:
                print("PyChroner is already running.")
                exit(1)
        with open(pidFile, "w") as f:
            f.write(str(os.getpid()))

        self.prompt: bool = prompt
        self.config: Config = Config()
        sys.path.append(self.config.directory.library)

        makeDirs(self.config.directory.dirs)
        self.queue = Queue()
        self.logger: Logger = getLogger(
                name="pychroner", directory=self.config.directory.logs, logLevel=self.config.logging.level,
                slack=self.config.logging.slack,
                queue=self.queue
        )
        self.logger.info(f"Logger started. Current time is {datetime.now()}.")
        self.logger.info(f"Working directory is {os.getcwd()}. Running as {os.getlogin()}, PID {os.getpid()}.")
        self.logger.info(
                f"Operating System is {platform.system()} {platform.release()} "
                f"[version {platform.version()}] ({platform.architecture()[0]}). "
        )
        self.logger.info(
                f"Running Python is version {platform.python_version()} ({platform.python_implementation()}) "
                f"build {platform.python_compiler()} [{ platform.python_build()[1]}]."
        )
        if os.getlogin() in ["root", "Administrator"]:
            self.logger.warning(f"PyChroner is running as root or Administrator. Bot should be running as a normal user.")

        self.UM: UserStreamManager = UserStreamManager(self)
        self.WSM: WebSocketManager = WebSocketManager(self)
        self.TM: ThreadManager = ThreadManager(self)

        self.PM: PluginManager = PluginManager(self)
        self.PM.loadPluginsFromDir()

        self.FS: FileSystemWatcher = FileSystemWatcher(self)
        self.CM = ConsoleManager(self)
        self.WM = WebUIManager(self)
        self.LS = LocalStorage()

        self.logger.info(f"Initialization Complate. Current time is {datetime.now()}.")


问题


面经


文章

微信
公众号

扫码关注公众号