Python platform.processor() Examples
The following are 30
code examples of platform.processor().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
platform
, or try the search function
.
Example #1
Source File: test_platform.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def test_uname_win32_ARCHITEW6432(self): # Issue 7860: make sure we get architecture from the correct variable # on 64 bit Windows: if PROCESSOR_ARCHITEW6432 exists we should be # using it, per # http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx try: with support.EnvironmentVarGuard() as environ: if 'PROCESSOR_ARCHITEW6432' in environ: del environ['PROCESSOR_ARCHITEW6432'] environ['PROCESSOR_ARCHITECTURE'] = 'foo' platform._uname_cache = None system, node, release, version, machine, processor = platform.uname() self.assertEqual(machine, 'foo') environ['PROCESSOR_ARCHITEW6432'] = 'bar' platform._uname_cache = None system, node, release, version, machine, processor = platform.uname() self.assertEqual(machine, 'bar') finally: platform._uname_cache = None
Example #2
Source File: system_info.py From lbry-sdk with MIT License | 6 votes |
def get_platform() -> dict: os_system = platform.system() if os.environ and 'ANDROID_ARGUMENT' in os.environ: os_system = 'android' d = { "processor": platform.processor(), "python_version": platform.python_version(), "platform": platform.platform(), "os_release": platform.release(), "os_system": os_system, "lbrynet_version": lbrynet_version, "version": lbrynet_version, "build": build_info.BUILD, # CI server sets this during build step } if d["os_system"] == "Linux": import distro # pylint: disable=import-outside-toplevel d["distro"] = distro.info() d["desktop"] = os.environ.get('XDG_CURRENT_DESKTOP', 'Unknown') return d
Example #3
Source File: experiments.py From BIRL with BSD 3-Clause "New" or "Revised" License | 6 votes |
def computer_info(): """cet basic computer information. :return dict: >>> len(computer_info()) 9 """ return { 'system': platform.system(), 'architecture': platform.architecture(), 'name': platform.node(), 'release': platform.release(), 'version': platform.version(), 'machine': platform.machine(), 'processor': platform.processor(), 'virtual CPUs': mproc.cpu_count(), 'total RAM': _get_ram(), }
Example #4
Source File: boxes.py From saltops with GNU General Public License v3.0 | 6 votes |
def get_items(self): upMinionCount = Host.objects.filter(minion_status=1).count() downMinionCount = Host.objects.filter(minion_status=0).count() # 系统基础信息 item_info = Item( html_id='SysInfo', name='主机系统信息', display=Item.AS_TABLE, value=( ('系统', '%s, %s, %s' % ( platform.system(), ' '.join(platform.linux_distribution()), platform.release())), ('架构', ' '.join(platform.architecture())), ('处理器', platform.processor()), ('Python版本', platform.python_version()), ('接入主机数量', Host.objects.count()), ('业务数量', Project.objects.count()), ('客户端运行情况', '运行中 %s,未运行 %s' % (upMinionCount, downMinionCount)), ), classes='table-bordered table-condensed ' 'table-hover table-striped' ) return [item_info]
Example #5
Source File: test_platform.py From oss-ftp with MIT License | 6 votes |
def test_uname_win32_ARCHITEW6432(self): # Issue 7860: make sure we get architecture from the correct variable # on 64 bit Windows: if PROCESSOR_ARCHITEW6432 exists we should be # using it, per # http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx try: with test_support.EnvironmentVarGuard() as environ: if 'PROCESSOR_ARCHITEW6432' in environ: del environ['PROCESSOR_ARCHITEW6432'] environ['PROCESSOR_ARCHITECTURE'] = 'foo' platform._uname_cache = None system, node, release, version, machine, processor = platform.uname() self.assertEqual(machine, 'foo') environ['PROCESSOR_ARCHITEW6432'] = 'bar' platform._uname_cache = None system, node, release, version, machine, processor = platform.uname() self.assertEqual(machine, 'bar') finally: platform._uname_cache = None
Example #6
Source File: test_platform.py From BinderFilter with MIT License | 6 votes |
def test_uname_win32_ARCHITEW6432(self): # Issue 7860: make sure we get architecture from the correct variable # on 64 bit Windows: if PROCESSOR_ARCHITEW6432 exists we should be # using it, per # http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx try: with test_support.EnvironmentVarGuard() as environ: if 'PROCESSOR_ARCHITEW6432' in environ: del environ['PROCESSOR_ARCHITEW6432'] environ['PROCESSOR_ARCHITECTURE'] = 'foo' platform._uname_cache = None system, node, release, version, machine, processor = platform.uname() self.assertEqual(machine, 'foo') environ['PROCESSOR_ARCHITEW6432'] = 'bar' platform._uname_cache = None system, node, release, version, machine, processor = platform.uname() self.assertEqual(machine, 'bar') finally: platform._uname_cache = None
Example #7
Source File: utils.py From BrundleFuzz with MIT License | 6 votes |
def get_platform_info(self): """ Information regarding the computer where the fuzzer is running """ try: node_properties = { 'node_name' : platform.node(), 'os_release': platform.release(), 'os_version': platform.version(), 'machine' : platform.machine(), 'processor' : platform.processor() } except: self.ae.m_alert('[x] Error getting platform information') return None return node_properties
Example #8
Source File: utils.py From BrundleFuzz with MIT License | 6 votes |
def get_platform_info(self): """ Information regarding the computer where the fuzzer is running """ try: node_properties = { 'node_name' : platform.node(), 'os_release': platform.release(), 'os_version': platform.version(), 'machine' : platform.machine(), 'processor' : platform.processor() } except: self.ae.m_alert('[x] Error getting platform information') return None return node_properties
Example #9
Source File: Common.py From PyMenu with GNU General Public License v3.0 | 6 votes |
def mountUSB(): if(platform.processor() != ""): return try: fileName = "run" file = open("/tmp/" + fileName,"w") file.write("#!/bin/sh\n") file.write("/usr/bin/retrofw stop\n") file.write("/usr/bin/retrofw storage\n") sys.exit() except Exception as ex: print("mount exception " + str(ex))
Example #10
Source File: test_platform.py From gcblue with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_uname_win32_ARCHITEW6432(self): # Issue 7860: make sure we get architecture from the correct variable # on 64 bit Windows: if PROCESSOR_ARCHITEW6432 exists we should be # using it, per # http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx try: with test_support.EnvironmentVarGuard() as environ: if 'PROCESSOR_ARCHITEW6432' in environ: del environ['PROCESSOR_ARCHITEW6432'] environ['PROCESSOR_ARCHITECTURE'] = 'foo' platform._uname_cache = None system, node, release, version, machine, processor = platform.uname() self.assertEqual(machine, 'foo') environ['PROCESSOR_ARCHITEW6432'] = 'bar' platform._uname_cache = None system, node, release, version, machine, processor = platform.uname() self.assertEqual(machine, 'bar') finally: platform._uname_cache = None
Example #11
Source File: test_platform.py From ironpython3 with Apache License 2.0 | 6 votes |
def test_uname_win32_ARCHITEW6432(self): # Issue 7860: make sure we get architecture from the correct variable # on 64 bit Windows: if PROCESSOR_ARCHITEW6432 exists we should be # using it, per # http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx try: with support.EnvironmentVarGuard() as environ: if 'PROCESSOR_ARCHITEW6432' in environ: del environ['PROCESSOR_ARCHITEW6432'] environ['PROCESSOR_ARCHITECTURE'] = 'foo' platform._uname_cache = None system, node, release, version, machine, processor = platform.uname() self.assertEqual(machine, 'foo') environ['PROCESSOR_ARCHITEW6432'] = 'bar' platform._uname_cache = None system, node, release, version, machine, processor = platform.uname() self.assertEqual(machine, 'bar') finally: platform._uname_cache = None
Example #12
Source File: test_platform.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_uname_win32_ARCHITEW6432(self): # Issue 7860: make sure we get architecture from the correct variable # on 64 bit Windows: if PROCESSOR_ARCHITEW6432 exists we should be # using it, per # http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx try: with support.EnvironmentVarGuard() as environ: if 'PROCESSOR_ARCHITEW6432' in environ: del environ['PROCESSOR_ARCHITEW6432'] environ['PROCESSOR_ARCHITECTURE'] = 'foo' platform._uname_cache = None system, node, release, version, machine, processor = platform.uname() self.assertEqual(machine, 'foo') environ['PROCESSOR_ARCHITEW6432'] = 'bar' platform._uname_cache = None system, node, release, version, machine, processor = platform.uname() self.assertEqual(machine, 'bar') finally: platform._uname_cache = None
Example #13
Source File: Runner.py From PyMenu with GNU General Public License v3.0 | 6 votes |
def runEmu(config, rom): ResumeHandler.storeResume() Common.addToCustomList(config, rom, "lastPlayedData") name = config["name"] workdir = config["workingDir"] if "workingDir" in config else None cmd = config["cmd"] if "workingDir" in config else None if(cmd == None or not os.path.isfile(cmd)): print("cmd needs to be set to an existing executable") return print("Platform is: '" + platform.processor() + "'") if(workdir == None and not cmd == None): workdir = os.path.abspath(os.path.join(cmd, os.pardir)) if(platform.processor() == ""): runEmuMIPS(name, cmd, workdir, config, rom) else: runEmuHost(name, cmd, workdir, config, rom)
Example #14
Source File: service.py From client-Python with Apache License 2.0 | 6 votes |
def get_system_information(agent_name='agent_name'): """ Get system information about agent, os, cpu, system, etc. :param agent_name: Name of the agent: pytest-reportportal, roborframework-reportportal, nosetest-reportportal, behave-reportportal :return: dict {'agent': pytest-pytest 5.0.5, 'os': 'Windows', 'cpu': 'AMD', 'machine': "Windows10_pc"} """ try: agent_version = pkg_resources.get_distribution( agent_name).version agent = '{0}-{1}'.format(agent_name, agent_version) except pkg_resources.DistributionNotFound: agent = 'not found' return {'agent': agent, 'os': platform.system(), 'cpu': platform.processor() or 'unknown', 'machine': platform.machine()}
Example #15
Source File: helper_functions.py From s-tui with GNU General Public License v2.0 | 6 votes |
def get_processor_name(): """ Returns the processor name in the system """ if platform.system() == "Linux": with open("/proc/cpuinfo", "rb") as cpuinfo: all_info = cpuinfo.readlines() for line in all_info: if b'model name' in line: return re.sub(b'.*model name.*:', b'', line, 1) elif platform.system() == "FreeBSD": cmd = ["sysctl", "-n", "hw.model"] process = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) str_value = process.stdout.read() return str_value elif platform.system() == "Darwin": cmd = ['sysctl', '-n', 'machdep.cpu.brand_string'] process = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) str_value = process.stdout.read() return str_value return platform.processor()
Example #16
Source File: utilities.py From alibuild with GNU General Public License v3.0 | 6 votes |
def detectArch(): try: with open("/etc/os-release") as osr: osReleaseLines = osr.readlines() hasOsRelease = True except (IOError,OSError): osReleaseLines = [] hasOsRelease = False try: import platform if platform.system() == "Darwin": return "osx_x86-64" except: pass try: import platform, distro platformTuple = distro.linux_distribution() platformSystem = platform.system() platformProcessor = platform.processor() if " " in platformProcessor: platformProcessor = platform.machine() return doDetectArch(hasOsRelease, osReleaseLines, platformTuple, platformSystem, platformProcessor) except: return doDetectArch(hasOsRelease, osReleaseLines, ["unknown", "", ""], "", "")
Example #17
Source File: processor.py From pyspectator with BSD 3-Clause "New" or "Revised" License | 6 votes |
def __get_processor_name(cls): cpu_name = None os_name = platform.system() if os_name == 'Windows': cpu_name = platform.processor() elif os_name == 'Darwin': os.environ['PATH'] = os.environ['PATH'] + os.pathsep + '/usr/sbin' command = ('sysctl', '-n', 'machdep.cpu.brand_string') output = subprocess.check_output(command) if output: cpu_name = output.decode().strip() elif os_name == 'Linux': all_info = subprocess.check_output('cat /proc/cpuinfo', shell=True) all_info = all_info.strip().split(os.linesep.encode()) for line in all_info: line = line.decode() if 'model name' not in line: continue cpu_name = re.sub('.*model name.*:', str(), line, 1).strip() break return cpu_name
Example #18
Source File: track_version.py From TextDetector with GNU General Public License v3.0 | 5 votes |
def _get_exp_env_info(self): """ Get information about the experimental environment such as the cpu, os and the hostname of the machine on which the experiment is running. """ self.exp_env_info['host'] = socket.gethostname() self.exp_env_info['cpu'] = platform.processor() self.exp_env_info['os'] = platform.platform() if 'theano' in sys.modules: self.exp_env_info['theano_config'] = sys.modules['theano'].config else: self.exp_env_info['theano_config'] = None
Example #19
Source File: sysinfo.py From faceswap with GNU General Public License v3.0 | 5 votes |
def __init__(self): self._state_file = _State().state_file self._configs = _Configs().configs self._system = dict(platform=platform.platform(), system=platform.system(), machine=platform.machine(), release=platform.release(), processor=platform.processor(), cpu_count=os.cpu_count()) self._python = dict(implementation=platform.python_implementation(), version=platform.python_version()) self._gpu = GPUStats(log=False).sys_info self._cuda_path = self._get_cuda_path()
Example #20
Source File: system.py From hae with MIT License | 5 votes |
def processor(self): return platform.processor() # 获取当前用户名
Example #21
Source File: system.py From ahenk with GNU Lesser General Public License v3.0 | 5 votes |
def architecture(): return platform.processor()
Example #22
Source File: dashboard_modules.py From saltops with GNU General Public License v3.0 | 5 votes |
def init_with_context(self, context): upMinionCount = Host.objects.filter(minion_status=1).count() downMinionCount = Host.objects.filter(minion_status=0).count() self.hostname = platform.node() self.system_info = '%s, %s, %s' % ( platform.system(), ' '.join(platform.linux_distribution()), platform.release()) self.arch = ' '.join(platform.architecture()) self.procesor = platform.processor(), self.py_version = platform.python_version() self.host_count = Host.objects.count() self.buss_count = Project.objects.count() self.minions_status = '运行中 %s,未运行 %s' % (upMinionCount, downMinionCount)
Example #23
Source File: host_platform.py From FAI-PEP with Apache License 2.0 | 5 votes |
def _getProcessorName(self): if platform.system() == "Windows": return platform.processor() elif platform.system() == "Darwin": processor_info, _ = processRun( ["sysctl", "-n", "machdep.cpu.brand_string"]) if len(processor_info) > 0: return processor_info[0].rstrip() elif platform.system() == "Linux": processor_info, _ = processRun(["cat", "/proc/cpuinfo"]) if processor_info: for line in processor_info: if "model name" in line: return re.sub(".*model name.*:", "", line, 1) return ""
Example #24
Source File: environment.py From revscoring with MIT License | 5 votes |
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()
Example #25
Source File: test_umath.py From mxnet-lambda with Apache License 2.0 | 5 votes |
def on_powerpc(): """ True if we are running on a Power PC platform.""" return platform.processor() == 'powerpc' or \ platform.machine().startswith('ppc')
Example #26
Source File: provenance.py From ctapipe with BSD 3-Clause "New" or "Revised" License | 5 votes |
def _get_system_provenance(): """ return JSON string containing provenance for all things that are fixed during the runtime""" bits, linkage = platform.architecture() return dict( ctapipe_version=ctapipe.__version__, ctapipe_resources_version=get_module_version("ctapipe_resources"), eventio_version=get_module_version("eventio"), ctapipe_svc_path=os.getenv("CTAPIPE_SVC_PATH"), executable=sys.executable, platform=dict( architecture_bits=bits, architecture_linkage=linkage, machine=platform.machine(), processor=platform.processor(), node=platform.node(), version=platform.version(), system=platform.system(), release=platform.release(), libcver=platform.libc_ver(), num_cpus=psutil.cpu_count(), boot_time=Time(psutil.boot_time(), format="unix").isot, ), python=dict( version_string=sys.version, version=platform.python_version_tuple(), compiler=platform.python_compiler(), implementation=platform.python_implementation(), ), environment=_get_env_vars(), arguments=sys.argv, start_time_utc=Time.now().isot, )
Example #27
Source File: translate.py From GDMC with ISC License | 5 votes |
def getPlatInfo(**kwargs): """kwargs: dict: {"module_name": module,...} used to display version information about modules.""" log.debug("*** Platform information") log.debug(" System: %s"%platform.system()) log.debug(" Release: %s"%platform.release()) log.debug(" Version: %s"%platform.version()) log.debug(" Architecture: %s, %s"%platform.architecture()) log.debug(" Dist: %s, %s, %s"%platform.dist()) log.debug(" Machine: %s"%platform.machine()) log.debug(" Processor: %s"%platform.processor()) log.debug(" Locale: %s"%locale.getdefaultlocale()[0]) log.debug(" Encoding: %s"%locale.getdefaultlocale()[1]) log.debug(" FS encoding: %s"%os.sys.getfilesystemencoding()) reVer = re.compile(r"__version__|_version_|__version|_version|version|" "__ver__|_ver_|__ver|_ver|ver", re.IGNORECASE) for name, mod in kwargs.items(): s = "%s"%dir(mod) verObjNames = list(re.findall(reVer, s)) if len(verObjNames) > 0: while verObjNames: verObjName = verObjNames.pop() verObj = getattr(mod, verObjName, None) if verObj: if type(verObj) in (str, unicode, int, list, tuple): ver = "%s"%verObj break elif "%s"%type(verObj) == "<type 'module'>": verObjNames += ["%s.%s"%(verObjName, a) for a in re.findall(reVer, "%s"%dir(verObj))] else: ver = verObj() else: ver = "%s"%type(verObj) log.debug(" %s version: %s"%(name, ver)) log.debug("***")
Example #28
Source File: test_platform.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_processor(self): res = platform.processor()
Example #29
Source File: openvino-usbcamera-cpu-ncs2-async.py From MobileNetV2-PoseEstimation with MIT License | 5 votes |
def __init__(self, devid, device, model_xml, frameBuffer, results, camera_width, camera_height, number_of_ncs, vidfps, nPoints, w, h, new_w, new_h): self.devid = devid self.frameBuffer = frameBuffer self.model_xml = model_xml self.model_bin = os.path.splitext(model_xml)[0] + ".bin" self.camera_width = camera_width self.camera_height = camera_height self.threshold = 0.1 self.nPoints = nPoints self.num_requests = 4 self.inferred_request = [0] * self.num_requests self.heap_request = [] self.inferred_cnt = 0 self.plugin = IEPlugin(device=device) if "CPU" == device: if platform.processor() == "x86_64": self.plugin.add_cpu_extension("lib/libcpu_extension.so") self.net = IENetwork(model=self.model_xml, weights=self.model_bin) self.input_blob = next(iter(self.net.inputs)) self.exec_net = self.plugin.load(network=self.net, num_requests=self.num_requests) self.results = results self.number_of_ncs = number_of_ncs self.predict_async_time = 250 self.skip_frame = 0 self.roop_frame = 0 self.vidfps = vidfps self.w = w #432 self.h = h #368 self.new_w = new_w self.new_h = new_h
Example #30
Source File: test_platform.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_uname(self): res = platform.uname() self.assertTrue(any(res)) self.assertEqual(res[0], res.system) self.assertEqual(res[1], res.node) self.assertEqual(res[2], res.release) self.assertEqual(res[3], res.version) self.assertEqual(res[4], res.machine) self.assertEqual(res[5], res.processor)