Python platform.machine() Examples
The following are 30
code examples of platform.machine().
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: provenance.py From tsinfer with GNU General Public License v3.0 | 6 votes |
def get_environment(): """ Returns a dictionary describing the environment in which tsinfer is currently running. """ env = { "libraries": { "zarr": {"version": zarr.__version__}, "numcodecs": {"version": numcodecs.__version__}, "lmdb": {"version": lmdb.__version__}, "tskit": {"version": tskit.__version__}, }, "os": { "system": platform.system(), "node": platform.node(), "release": platform.release(), "version": platform.version(), "machine": platform.machine(), }, "python": { "implementation": platform.python_implementation(), "version": platform.python_version_tuple(), }, } return env
Example #2
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 #3
Source File: markers.py From ironpython2 with Apache License 2.0 | 6 votes |
def default_environment(): if hasattr(sys, 'implementation'): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = '0' implementation_name = '' return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #4
Source File: computer.py From pyspectator with BSD 3-Clause "New" or "Revised" License | 6 votes |
def __init__(self): self.datetime_format = '%H:%M:%S %d/%m/%Y' self.__raw_boot_time = psutil.boot_time() self.__boot_time = datetime.fromtimestamp(self.raw_boot_time) self.__boot_time = self.__boot_time.strftime(self.datetime_format) self.__hostname = platform.node() self.__os = Computer.__get_os_name() self.__architecture = platform.machine() self.__python_version = '{} ver. {}'.format( platform.python_implementation(), platform.python_version() ) self.__processor = Cpu(monitoring_latency=1) self.__nonvolatile_memory = NonvolatileMemory.instances_connected_devices(monitoring_latency=10) self.__nonvolatile_memory_devices = set( [dev_info.device for dev_info in self.__nonvolatile_memory] ) self.__virtual_memory = VirtualMemory(monitoring_latency=1) self.__swap_memory = SwapMemory(monitoring_latency=1) self.__network_interface = NetworkInterface(monitoring_latency=3) super().__init__(monitoring_latency=3)
Example #5
Source File: casting.py From me-ica with GNU Lesser General Public License v2.1 | 6 votes |
def best_float(): """ Floating point type with best precision This is nearly always np.longdouble, except on Windows, where np.longdouble is Intel80 storage, but with float64 precision for calculations. In that case we return float64 on the basis it's the fastest and smallest at the highest precision. Returns ------- best_type : numpy type floating point type with highest precision """ if (type_info(np.longdouble)['nmant'] > type_info(np.float64)['nmant'] and machine() != 'sparc64'): # sparc has crazy-slow float128 return np.longdouble return np.float64
Example #6
Source File: markers.py From auto-alt-text-lambda-api with MIT License | 6 votes |
def default_environment(): if hasattr(sys, 'implementation'): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = '0' implementation_name = '' return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #7
Source File: pep508.py From pdm with MIT License | 6 votes |
def default_environment(): if hasattr(sys, "implementation"): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = "0" implementation_name = "" return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementaiton": platform.python_implementation(), "python_version": ".".join(platform.python_version_tuple()[:2]), "sys_platform": sys.platform, }
Example #8
Source File: easy_install.py From lambda-chef-node-cleanup with Apache License 2.0 | 6 votes |
def get_win_launcher(type): """ Load the Windows launcher (executable) suitable for launching a script. `type` should be either 'cli' or 'gui' Returns the executable as a byte string. """ launcher_fn = '%s.exe' % type if platform.machine().lower() == 'arm': launcher_fn = launcher_fn.replace(".", "-arm.") if is_64bit(): launcher_fn = launcher_fn.replace(".", "-64.") else: launcher_fn = launcher_fn.replace(".", "-32.") return resource_string('setuptools', launcher_fn)
Example #9
Source File: crackfortran.py From auto-alt-text-lambda-api with MIT License | 6 votes |
def _selected_real_kind_func(p, r=0, radix=0): # XXX: This should be processor dependent # This is only good for 0 <= p <= 20 if p < 7: return 4 if p < 16: return 8 if platform.machine().lower().startswith('power'): if p <= 20: return 16 else: if p < 19: return 10 elif p <= 20: return 16 return -1
Example #10
Source File: markers.py From recruit with Apache License 2.0 | 6 votes |
def default_environment(): if hasattr(sys, 'implementation'): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = '0' implementation_name = '' return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #11
Source File: base.py From briefcase with BSD 3-Clause "New" or "Revised" License | 6 votes |
def __init__(self, base_path, home_path=Path.home(), apps=None, input_enabled=True): self.base_path = base_path self.home_path = home_path self.dot_briefcase_path = home_path / ".briefcase" self.global_config = None self.apps = {} if apps is None else apps # Some details about the host machine self.host_arch = platform.machine() self.host_os = platform.system() # External service APIs. # These are abstracted to enable testing without patching. self.cookiecutter = cookiecutter self.requests = requests self.input = Console(enabled=input_enabled) self.os = os self.sys = sys self.shutil = shutil self.subprocess = Subprocess(self) # The internal Briefcase integrations API. self.integrations = integrations
Example #12
Source File: cli.py From stdpopsim with GNU General Public License v3.0 | 6 votes |
def get_environment(): """ Returns a dictionary describing the environment in which stdpopsim is currently running. """ env = { "os": { "system": platform.system(), "node": platform.node(), "release": platform.release(), "version": platform.version(), "machine": platform.machine(), }, "python": { "implementation": platform.python_implementation(), "version": platform.python_version(), }, "libraries": { "msprime": {"version": msprime.__version__}, "tskit": {"version": tskit.__version__}, } } return env
Example #13
Source File: markers.py From jbox with MIT License | 6 votes |
def default_environment(): if hasattr(sys, 'implementation'): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = '0' implementation_name = '' return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #14
Source File: __init__.py From jbox with MIT License | 6 votes |
def get_build_platform(): """Return this platform's string for platform-specific distributions XXX Currently this is the same as ``distutils.util.get_platform()``, but it needs some hacks for Linux and Mac OS X. """ try: # Python 2.7 or >=3.2 from sysconfig import get_platform except ImportError: from distutils.util import get_platform plat = get_platform() if sys.platform == "darwin" and not plat.startswith('macosx-'): try: version = _macosx_vers() machine = os.uname()[4].replace(" ", "_") return "macosx-%d.%d-%s" % (int(version[0]), int(version[1]), _macosx_arch(machine)) except ValueError: # if someone is running a non-Mac darwin system, this will fall # through to the default implementation pass return plat
Example #15
Source File: markers.py From jbox with MIT License | 6 votes |
def default_environment(): if hasattr(sys, 'implementation'): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = '0' implementation_name = '' return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #16
Source File: labview.py From python_labview_automation with MIT License | 6 votes |
def wait_until_server_loaded(self, timeout_s=900, port=2552): """ This function will wait until the LabVIEW server is loaded on the local machine. :param timeout_s: How long to wait for the LabVIEW server to load. Default is 15 minutes (900 seconds). :raises TimeoutError: Raised when timeout exceeded while waiting """ waiting = True start_time = time.time() while waiting: try: with self.client(): pass except Exception: if time.time() - start_time > timeout_s: raise TimeoutError('Timed out while waiting for LabVIEW' ' server to load') else: waiting = False
Example #17
Source File: util.py From porcupine with Apache License 2.0 | 6 votes |
def _pv_linux_machine(machine): if machine == 'x86_64': return machine cpu_info = subprocess.check_output(['cat', '/proc/cpuinfo']).decode() hardware_info = [x for x in cpu_info.split('\n') if 'Hardware' in x][0] model_info = [x for x in cpu_info.split('\n') if 'model name' in x][0] if 'BCM' in hardware_info: if 'rev 7' in model_info: return 'arm11' elif 'rev 5' in model_info: return 'cortex-a7' elif 'rev 4' in model_info: return 'cortex-a53' elif 'rev 3' in model_info: return 'cortex-a72' elif 'AM33' in hardware_info: return 'beaglebone' else: raise NotImplementedError('unsupported CPU:\n%s' % cpu_info)
Example #18
Source File: crackfortran.py From lambda-packs with MIT License | 6 votes |
def _selected_real_kind_func(p, r=0, radix=0): # XXX: This should be processor dependent # This is only good for 0 <= p <= 20 if p < 7: return 4 if p < 16: return 8 if platform.machine().lower().startswith('power'): if p <= 20: return 16 else: if p < 19: return 10 elif p <= 20: return 16 return -1
Example #19
Source File: markers.py From lambda-packs with MIT License | 6 votes |
def default_environment(): if hasattr(sys, 'implementation'): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = '0' implementation_name = '' return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #20
Source File: crackfortran.py From lambda-packs with MIT License | 6 votes |
def _selected_real_kind_func(p, r=0, radix=0): # XXX: This should be processor dependent # This is only good for 0 <= p <= 20 if p < 7: return 4 if p < 16: return 8 machine = platform.machine().lower() if machine.startswith(('aarch64', 'power', 'ppc64', 's390x')): if p <= 20: return 16 else: if p < 19: return 10 elif p <= 20: return 16 return -1
Example #21
Source File: markers.py From lambda-packs with MIT License | 6 votes |
def default_environment(): if hasattr(sys, 'implementation'): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = '0' implementation_name = '' return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #22
Source File: pkg_resources.py From pledgeservice with Apache License 2.0 | 6 votes |
def get_build_platform(): """Return this platform's string for platform-specific distributions XXX Currently this is the same as ``distutils.util.get_platform()``, but it needs some hacks for Linux and Mac OS X. """ try: # Python 2.7 or >=3.2 from sysconfig import get_platform except ImportError: from distutils.util import get_platform plat = get_platform() if sys.platform == "darwin" and not plat.startswith('macosx-'): try: version = _macosx_vers() machine = os.uname()[4].replace(" ", "_") return "macosx-%d.%d-%s" % (int(version[0]), int(version[1]), _macosx_arch(machine)) except ValueError: # if someone is running a non-Mac darwin system, this will fall # through to the default implementation pass return plat
Example #23
Source File: easy_install.py From pledgeservice with Apache License 2.0 | 6 votes |
def get_win_launcher(type): """ Load the Windows launcher (executable) suitable for launching a script. `type` should be either 'cli' or 'gui' Returns the executable as a byte string. """ launcher_fn = '%s.exe' % type if platform.machine().lower()=='arm': launcher_fn = launcher_fn.replace(".", "-arm.") if is_64bit(): launcher_fn = launcher_fn.replace(".", "-64.") else: launcher_fn = launcher_fn.replace(".", "-32.") return resource_string('setuptools', launcher_fn)
Example #24
Source File: markers.py From python-netsurv with MIT License | 6 votes |
def default_environment(): if hasattr(sys, 'implementation'): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = '0' implementation_name = '' return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #25
Source File: pytester.py From python-netsurv with MIT License | 6 votes |
def spawn(self, cmd, expect_timeout=10.0): """Run a command using pexpect. The pexpect child is returned. """ pexpect = pytest.importorskip("pexpect", "3.0") if hasattr(sys, "pypy_version_info") and "64" in platform.machine(): pytest.skip("pypy-64 bit not supported") if sys.platform.startswith("freebsd"): pytest.xfail("pexpect does not work reliably on freebsd") logfile = self.tmpdir.join("spawn.out").open("wb") # Do not load user config. env = os.environ.copy() env.update(self._env_run_update) child = pexpect.spawn(cmd, logfile=logfile, env=env) self.request.addfinalizer(logfile.close) child.timeout = expect_timeout return child
Example #26
Source File: markers.py From python-netsurv with MIT License | 6 votes |
def default_environment(): if hasattr(sys, "implementation"): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = "0" implementation_name = "" return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #27
Source File: markers.py From python-netsurv with MIT License | 6 votes |
def default_environment(): if hasattr(sys, 'implementation'): iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name else: iver = '0' implementation_name = '' return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": platform.python_version()[:3], "sys_platform": sys.platform, }
Example #28
Source File: pytester.py From python-netsurv with MIT License | 6 votes |
def spawn(self, cmd, expect_timeout=10.0): """Run a command using pexpect. The pexpect child is returned. """ pexpect = pytest.importorskip("pexpect", "3.0") if hasattr(sys, "pypy_version_info") and "64" in platform.machine(): pytest.skip("pypy-64 bit not supported") if sys.platform.startswith("freebsd"): pytest.xfail("pexpect does not work reliably on freebsd") logfile = self.tmpdir.join("spawn.out").open("wb") # Do not load user config. env = os.environ.copy() env.update(self._env_run_update) child = pexpect.spawn(cmd, logfile=logfile, env=env) self.request.addfinalizer(logfile.close) child.timeout = expect_timeout return child
Example #29
Source File: vc.py From arnold-usd with Apache License 2.0 | 6 votes |
def is_host_target_supported(host_target, msvc_version): """Check if the given (host, target) tuple is supported for given version. Args: host_target: tuple tuple of (canonalized) host-targets, e.g. ("x86", "amd64") for cross compilation from 32 bit Windows to 64 bits. msvc_version: str msvc version (major.minor, e.g. 10.0) Returns: bool: Note: This only checks whether a given version *may* support the given (host, target), not that the toolchain is actually present on the machine. """ # We assume that any Visual Studio version supports x86 as a target if host_target[1] != "x86": maj, min = msvc_version_to_maj_min(msvc_version) if maj < 8: return False return True
Example #30
Source File: rpmutils.py From arnold-usd with Apache License 2.0 | 6 votes |
def defaultMachine(use_rpm_default=True): """ Return the canonicalized machine name. """ if use_rpm_default: try: # This should be the most reliable way to get the default arch rmachine = subprocess.check_output(['rpm', '--eval=%_target_cpu'], shell=False).rstrip() rmachine = SCons.Util.to_str(rmachine) except Exception as e: # Something went wrong, try again by looking up platform.machine() return defaultMachine(False) else: rmachine = platform.machine() # Try to lookup the string in the canon table if rmachine in arch_canon: rmachine = arch_canon[rmachine][0] return rmachine