def geisysteminfo(): """""" print platform.system() print platform.version() print platform.architecture() print platform.node() print platform.java_ver() print platform.dist() print platform.python_version() print platform.win32_ver()
def get_sys_info(): sys_info = {} # Get OS-specific info sys_info['system'] = platform.system() if sys_info['system'] == 'Linux': sys_info['os_version'] = _tup_to_flat_str(platform.linux_distribution()) sys_info['libc_version'] = _tup_to_flat_str(platform.libc_ver()) elif sys_info['system'] == 'Darwin': sys_info['os_version'] = _tup_to_flat_str(platform.mac_ver()) elif sys_info['system'] == 'Windows': sys_info['os_version'] = _tup_to_flat_str(platform.win32_ver()) elif sys_info['system'] == 'Java': sys_info['os_version'] = _tup_to_flat_str(platform.java_ver()) # Python specific stuff sys_info['python_implementation'] = platform.python_implementation() sys_info['python_version'] = platform.python_version() sys_info['python_build'] = _tup_to_flat_str(platform.python_build()) sys_info['python_executable'] = sys.executable # Launcher specific stuff sys_info['dato_launcher'] = 'DATO_LAUNCHER' in os.environ sys_info['graphlab_create_launcher'] = 'GRAPHLAB_CREATE_LAUNCHER' in os.environ # Get architecture info sys_info['architecture'] = _tup_to_flat_str(platform.architecture()) sys_info['platform'] = platform.platform() sys_info['num_cpus'] = NUM_CPUS # Get RAM size sys_info['total_mem'] = TOTAL_PHYMEM return sys_info
def app_data_path (appauthor, appname, roaming=True): if sys.platform.startswith('java'): os_name = platform.java_ver()[3][0] if os_name.startswith('Windows'): system = 'win32' elif os_name.startswith('Mac'): system = 'darwin' else: system = 'linux2' else: system = sys.platform if system == "win32": if appauthor is None: appauthor = appname const = roaming and "CSIDL_APPDATA" or "CSIDL_LOCAL_APPDATA" path = os.path.normpath(_get_win_folder(const)) if appname: if appauthor is not False: path = os.path.join(path, appauthor, appname) else: path = os.path.join(path, appname) elif system == 'darwin': path = os.path.expanduser('~/Library/Application Support/') if appname: path = os.path.join(path, appname) else: path = os.getenv('XDG_DATA_HOME', os.path.expanduser("~/")) if appname: path = os.path.join(path, '.'+appname) return path
def user_cache_dir(appname=None): if sys.platform.startswith('java'): import platform os_name = platform.java_ver()[3][0] if os_name.startswith('Windows'): # "Windows XP", "Windows 7", etc. system = 'win32' elif os_name.startswith('Mac'): system = 'darwin' else: system = 'linux2' else: system = sys.platform if system == 'darwin': path = os.path.expanduser('~/Library/Caches') if appname: path = os.path.join(path, appname) else: if 'XDG_CACHE_HOME' not in os.environ.keys(): path = os.getenv('XDG_CACHE_HOME', os.path.expanduser('~/.cache')) else: if appname in os.environ['XDG_CACHE_HOME']: path = os.environ['XDG_CACHE_HOME'].split(appname)[0] else: path = os.getenv('XDG_CACHE_HOME', os.path.expanduser('~/.cache')) if appname: path = os.path.join(path, appname) if not os.path.exists(os.path.join(path, 'astropy')): os.makedirs(os.path.join(path, 'astropy')) return path
def get_platform_name(): """ Returns the platform name for this machine. May return 'win32', 'unix', 'java', 'mac' or '' (in case it wasn't possible to resolve the name). """ if platform.mac_ver()[0]: return 'mac' if platform.win32_ver()[0]: return 'windows' if any(platform.dist()): return 'unix' if platform.java_ver()[0] or platform.java_ver()[1]: return 'java' return ''
def capture(): """ Capture current OS information """ result = OSInfo() result.family = OSInfo.family() if result.family == "windows": # i.e: subfamily = '7', version = "6.66612" result.subfamily = platform.release() result.version = Version(platform.version()) elif result.family == "linux": result.subfamily = platform.linux_distribution()[0] result.version = Version(platform.linux_distribution()[1]) elif result.family == "macos": result.subfamily = None result.version = Version(platform.mac_ver()[0]) elif result.family == "java": result.subfamily = " ".join(platform.java_ver()[2]) result.version = Version(platform.release()) else: result.subfamily = None # Default value is none in ToolInfo result.version = Version() # Default value is Version() in ToolInfo result.arch = OSInfo.architecture() return result
def _set_sys_info(self): # Don't do this if system info has been set if self._sys_info_set: return self._sys_info = {} # Get OS-specific info self._sys_info['system'] = platform.system() if self._sys_info['system'] == 'Linux': self._sys_info['os_version'] = self._tup_to_flat_str(platform.linux_distribution()) self._sys_info['libc_version'] = self._tup_to_flat_str(platform.libc_ver()) elif self._sys_info['system'] == 'Darwin': self._sys_info['os_version'] = self._tup_to_flat_str(platform.mac_ver()) elif self._sys_info['system'] == 'Windows': self._sys_info['os_version'] = self._tup_to_flat_str(platform.win32_ver()) elif self._sys_info['system'] == 'Java': self._sys_info['os_version'] = self._tup_to_flat_str(platform.java_ver()) # Python specific stuff self._sys_info['python_implementation'] = platform.python_implementation() self._sys_info['python_version'] = platform.python_version() self._sys_info['python_build'] = self._tup_to_flat_str(platform.python_build()) # Get architecture info self._sys_info['architecture'] = self._tup_to_flat_str(platform.architecture()) self._sys_info['platform'] = platform.platform() self._sys_info['num_cpus'] = NUM_CPUS # Get RAM size self._sys_info['total_mem'] = TOTAL_PHYMEM self._sys_info_set = True
def info(self): res = { "machine": platform.machine(), "version": platform.version(), "platform": platform.platform(), "uname": platform.uname(), "cpu": platform.processor(), "java_ver": platform.java_ver(), "user": getpass.getuser() } return res
def get_system(): """ Returns the system name (``str``). """ system = platform.system() if system == 'Java': system = platform.java_ver()[3][0] if system.startswith('Windows'): system = 'Windows' elif system.startswith('Mac'): system = 'Darwin' return system
def _spinfo(): """Specific system info""" _platsys = platform.system().lower() if _platsys == 'windows': return platform.win32_ver() elif _platsys == 'linux': return platform.linux_distribution() + platform.libc_ver() elif _platsys == 'java': return platform.java_ver() elif _platsys in ('darwin', 'mac', 'osx', 'macosx'): return platform.mac_ver() else: return None
def detect_distro(): config = Config() distro_dict = { 'mac_os': platform.mac_ver(), 'linux': platform.linux_distribution(), 'windows': platform.win32_ver(), 'java': platform.java_ver() } for dist, ver in distro_dict.items(): if ver[0] != '' and dist not in config.supported_platforms: raise SystemError( "The OS you are currently using ({}) is not supported yet" .format(dist) ) elif ver[0] != '' and dist in config.supported_platforms: return {'distro': dist, 'version': ver}
def get_distro(): system = platform.system() if system == "Linux": dist = linux_distribution() return "{}:{}".format(dist[0], dist[1]) elif system == "Windows": dist = platform.win32_ver() return "{}:{}".format(dist[0], dist[1]) elif system == "Java": dist = platform.java_ver() return "{}:{}".format(dist[0], dist[1]) elif system == "Darwin": dist = platform.mac_ver() return "{}".format(dist[0]) # else: return ":".join(platform.uname()[0:1])
def main(): log.info(platform.architecture()) # 32 or 64 bit log.info(sys.maxsize > 2**32) # is 64 bit log.info(platform.libc_ver()) log.info(platform.mac_ver()) log.info(platform.machine()) log.info(platform.uname()) log.info(platform.system()) # Darwin Windows Linux log.info(platform.release()) log.info(platform.java_ver()) # for Jython # python info log.info(platform.python_version()) log.info(platform.python_version_tuple()) log.info(platform.python_build())
def get_sys_platform(): if sys.platform.startswith('java'): os_name = platform.java_ver()[3][0] if os_name.startswith('Windows'): # "Windows XP", "Windows 7", etc. system = 'win32' elif os.name.startswith('Mac'): # "Mac OS X", etc. system = 'darwin' else: # "Linux", "SunOS", "FreeBSD", etc. # Setting this to "linux2" is not ideal, but only Windows or Mac # are actually checked for and the rest of the module expects # *sys.platform* style strings. system = 'linux2' else: system = sys.platform return system
def __get_base_path(self): # from appdirs https://github.com/ActiveState/appdirs/blob/master/appdirs.py # default mac path is not the one we use (we use unix path), so using special case for this system = sys.platform if system.startswith("java"): import platform os_name = platform.java_ver()[3][0] if os_name.startswith("Mac"): system = "darwin" if system == "darwin": path = os.path.expanduser("~/.config/") return os.path.join(path, self.app_name) else: return user_data_dir(appname=self.app_name, appauthor=False, roaming=True)
def _set_sys_info(self): # Don't do this if system info has been set if self._sys_info_set: return self._sys_info = {} # Get OS-specific info self._sys_info['system'] = platform.system() if self._sys_info['system'] == 'Linux': self._sys_info['os_version'] = self._tup_to_flat_str( platform.linux_distribution()) self._sys_info['libc_version'] = self._tup_to_flat_str( platform.libc_ver()) elif self._sys_info['system'] == 'Darwin': self._sys_info['os_version'] = self._tup_to_flat_str( platform.mac_ver()) elif self._sys_info['system'] == 'Windows': self._sys_info['os_version'] = self._tup_to_flat_str( platform.win32_ver()) elif self._sys_info['system'] == 'Java': self._sys_info['os_version'] = self._tup_to_flat_str( platform.java_ver()) # Python specific stuff self._sys_info[ 'python_implementation'] = platform.python_implementation() self._sys_info['python_version'] = platform.python_version() self._sys_info['python_build'] = self._tup_to_flat_str( platform.python_build()) self._sys_info['python_executable'] = sys.executable # Dato specific stuff self._sys_info['dato_launcher'] = 'DATO_LAUNCHER' in os.environ # Get architecture info self._sys_info['architecture'] = self._tup_to_flat_str( platform.architecture()) self._sys_info['platform'] = platform.platform() self._sys_info['num_cpus'] = NUM_CPUS # Get RAM size self._sys_info['total_mem'] = TOTAL_PHYMEM self._sys_info_set = True
def initKeyMap(self): import platform os_name = platform.java_ver()[-1][0] if os_name.startswith('Win'): exit_key = KeyEvent.VK_Z interrupt_key = KeyEvent.VK_PAUSE else: exit_key = KeyEvent.VK_D interrupt_key = KeyEvent.VK_C bindings = [ (KeyEvent.VK_ENTER, 0, 'jython.enter', self.enterAction), (KeyEvent.VK_DELETE, 0, 'jython.delete', self.deleteAction), (KeyEvent.VK_TAB, 0, 'jython.tab', self.tabAction), (KeyEvent.VK_HOME, 0, 'jython.home', self.homeAction), (KeyEvent.VK_LEFT, InputEvent.META_DOWN_MASK, 'jython.home', self.homeAction), (KeyEvent.VK_END, 0, 'jython.end', self.endAction), (KeyEvent.VK_RIGHT, InputEvent.META_DOWN_MASK, 'jython.end', self.endAction), (KeyEvent.VK_UP, 0, 'jython.up', self.history.historyUp), (KeyEvent.VK_DOWN, 0, 'jython.down', self.history.historyDown), (KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), 'jython.paste', self.pasteAction), (KeyEvent.VK_A, InputEvent.CTRL_MASK, 'jython.home', self.homeAction), (KeyEvent.VK_E, InputEvent.CTRL_MASK, 'jython.end', self.endAction), (KeyEvent.VK_K, InputEvent.CTRL_MASK, 'jython.deleteEndLine', self.deleteEndLineAction), (KeyEvent.VK_Y, InputEvent.CTRL_MASK, 'jython.paste', self.pasteAction), #(interrupt_key, InputEvent.CTRL_MASK, 'jython.keyboardInterrupt', self.keyboardInterruptAction), ] keymap = JTextComponent.addKeymap('jython', self.textpane.getKeymap()) for key, modifier, name, function in bindings: keymap.addActionForKeyStroke(KeyStroke.getKeyStroke(key, modifier), ActionDelegator(name, function)) self.textpane.keymap = keymap
def __init__(self): import os.path from test import test_socket_ssl from test import test_timeout self.valid = False if _platform in _expectations: s = _expectations[_platform] self.expected = set(s.split()) if not os.path.supports_unicode_filenames: self.expected.add('test_pep277') if test_socket_ssl.skip_expected: self.expected.add('test_socket_ssl') if test_timeout.skip_expected: self.expected.add('test_timeout') if sys.maxint == 9223372036854775807L: self.expected.add('test_rgbimg') self.expected.add('test_imageop') if not sys.platform in ("mac", "darwin"): MAC_ONLY = ["test_macostools", "test_macfs", "test_aepack", "test_plistlib", "test_scriptpackages"] for skip in MAC_ONLY: self.expected.add(skip) if sys.platform != "win32": WIN_ONLY = ["test_unicode_file", "test_winreg", "test_winsound"] for skip in WIN_ONLY: self.expected.add(skip) if test_support.is_jython: if os._name != 'posix': self.expected.add('test_mhlib') import platform os_name = platform.java_ver()[3][0] if os_name == 'Mac OS X' or 'BSD' in os_name: self.expected.add('test_asynchat') self.valid = True
def SystemVersion(): #from sys import platform as _platform import platform #import os from collections import namedtuple ver = namedtuple("ver", [ "machine", "network_name", "processor_name", "python_compiler", "python_implementation", "python_version", "python_version_tuple", "system_release", "system_system", "system_version", "system_tuple", "system_uname", "platform_info" ]) platform_information = "" try: # Java Platform platform_information = platform.java_ver() if platform_information[0] == '': raise Exception() except: try: # Windows Platform platform_information = platform.win32_ver() if platform_information[0] == '': raise Exception() except: try: # Mac OS Platform platform_information = platform.mac_ver() if platform_information[0] == '': raise Exception() except: # Unknown platform_information = () osversion = ver(machine=platform.machine(), network_name=platform.node(), processor_name=platform.processor(), python_compiler=platform.python_compiler(), python_implementation=platform.python_implementation(), python_version=platform.python_version(), python_version_tuple=platform.python_version_tuple(), system_system=platform.system(), system_release=platform.release(), system_version=platform.version(), system_tuple=platform.system_alias(platform.system(), platform.release(), platform.version()), system_uname=platform.uname(), platform_info=platform_information) return osversion
def determine_system_string(self): """ Determine upon which system this AppDirs instance has been brought into existence – DEPRECIATED, see the appdirectories.System enum class (and the System.determine() class method in particular) for the replcaement logic """ if sys.platform.startswith('java'): os_name = platform.java_ver()[3][0] if os_name.startswith('Windows'): # "Windows XP", "Windows 7", etc. system = 'win32' elif os_name.startswith('Mac'): # "Mac OS X", etc. system = 'darwin' else: # "Linux", "SunOS", "FreeBSD", etc. # Setting this to "linux2" is not ideal, but only Windows or Mac # are actually checked for and the rest of the module expects # *sys.platform* style strings. system = 'linux2' else: system = sys.platform return system
def tsGetJavaPlatform(self, theInfo): ''' Return Java specific runtime environment. ''' (release, vendor, vminfo, osinfo) = platform.java_ver(release='', vendor='', vminfo=('','',''), osinfo=('','','')) (vm_name, vm_release, vm_vendor) = vminfo (os_name, os_version, os_arch)= osinfo if release != '' or \ vendor != '' or \ vm_name != '' or \ vm_release != '' or \ vm_vendor != '' or \ os_name != '' or \ os_version != '' or \ os_arch != '': dataAvailable = True else: dataAvailable = False if dataAvailable: theInfo += ['\n'] theInfo += [' Java Platform'] theInfo += [' -------------'] theInfo += [' release = <%s>' % release] theInfo += [' vendor = <%s>' % vendor] theInfo += [' vm_name = <%s>' % vm_name] theInfo += [' vm_vendor = <%s>' % vm_vendor] theInfo += [' vm_release = <%s>' % vm_release] theInfo += [' os_arch = <%s>' % os_arch] theInfo += [' os_name = <%s>' % os_name] theInfo += [' os_version = <%s>' % os_version]
def initKeyMap(self): import platform os_name = platform.java_ver()[-1][0] if os_name.startswith('Win'): exit_key = KeyEvent.VK_Z interrupt_key = KeyEvent.VK_PAUSE else: exit_key = KeyEvent.VK_D interrupt_key = KeyEvent.VK_C bindings = [ (KeyEvent.VK_ENTER, 0, 'jython.enter', self.enterAction), (KeyEvent.VK_DELETE, 0, 'jython.delete', self.deleteAction), (KeyEvent.VK_HOME, 0, 'jython.home', self.homeAction), (KeyEvent.VK_LEFT, InputEvent.META_DOWN_MASK, 'jython.home', self.homeAction), (KeyEvent.VK_END, 0, 'jython.end', self.endAction), (KeyEvent.VK_RIGHT, InputEvent.META_DOWN_MASK, 'jython.end', self.endAction), (KeyEvent.VK_UP, 0, 'jython.up', self.history.historyUp), (KeyEvent.VK_DOWN, 0, 'jython.down', self.history.historyDown), (KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), 'jython.paste', self.pasteAction), (KeyEvent.VK_A, InputEvent.CTRL_MASK, 'jython.home', self.homeAction), (KeyEvent.VK_E, InputEvent.CTRL_MASK, 'jython.end', self.endAction), (KeyEvent.VK_K, InputEvent.CTRL_MASK, 'jython.deleteEndLine', self.deleteEndLineAction), (KeyEvent.VK_Y, InputEvent.CTRL_MASK, 'jython.paste', self.pasteAction), #(interrupt_key, InputEvent.CTRL_MASK, 'jython.keyboardInterrupt', self.keyboardInterruptAction), ] keymap = JTextComponent.addKeymap('jython', self.textpane.getKeymap()) for key, modifier, name, function in bindings: keymap.addActionForKeyStroke( KeyStroke.getKeyStroke(key, modifier), ActionDelegator(name, function)) self.textpane.keymap = keymap
def get_distro(): try: from distro import linux_distribution except ImportError: linux_distribution = None system = platform.system() if system == "Linux": dist = linux_distribution() return "{}:{}".format(dist[0], dist[1]) elif system == "Windows": dist = platform.win32_ver() return "{}:{}".format(dist[0], dist[1]) elif system == "Java": dist = platform.java_ver() return "{}:{}".format(dist[0], dist[1]) elif system == "Darwin": dist = platform.mac_ver() return "{}".format(dist[0]) else: return ":".join(platform.uname()[0:1])
def add_platform_info(d): def non_empty(x): if isinstance(x, (list, tuple)): for i in x: if non_empty(i): return True return False elif x: return True else: return False p = {} p["platform"] = platform.platform() p["processor"] = platform.processor() system = p["system"] = platform.system() if system == "Linux": (dist, version, linux_id) = platform.linux_distribution() p["linux"] = {"dist": dist, "version": version, "id": linux_id} elif system == "Darwin": (release, versioninfo, machine) = platform.mac_ver() p["mac"] = {"release": release, "machine": machine} elif system == "Windows": (release, version, csd, ptype) = platform.win32_ver() p["win"] = {"release": release, "version": version, "csd": csd} elif system == "Java": # Just dump it... very unlikely p["java"] = platform.java_ver() # Everybody has a uname! (system, node, release, version, machine, processor) = platform.uname() p["uname"] = dict(system=system, node=node, release=release, version=version, machine=machine, processor=processor) plat = d["platform"] = {} for (k, v) in list(p.items()): if non_empty(v): plat[k] = v
def system(string=False): """ Returns information about the OS in use. Pass string=True to get a formatted string, otherwise returns tuple. Works with Linux, Macintosh, Win32, and Java. (Untested for UNIX) """ # UNIX if platform.linux_distribution()[0]: # (distname,version,id) try: os = platform.linux_distribution() except AttributeError: os = platform.dist() # deprecated if string: # return formatted, plus machine platform return "{1} {2} ({3}) on an {0}".format(machine(), *os) return os #otherwise return tuple # Macintosh if platform.mac_ver()[0]: # (release, versioninfo, machine) os = platform.mac_ver() # versioninfo is a 3 string tuple if string: #Version tuple is usually blank (why?) so leave it out return "{0} {1} {3}".format(platform.system(), *os) return os # Win32 if platform.win32_ver()[0]: os = platform.win32_ver()[:-1] # remove useless last part if string: return "{0} {1} {2} {3}".format(platform.system(), *os) return os # Java if platform.java_ver()[0]: os = platfrm.java_ver() if string: return "{0} {1} {2} {3}".format(platform.system, *os) return os
def getJavaVersion(self): return str(platform.java_ver()) # @expect to return JavaScript array
opts.add_comment("Simple testing code.\nVersion 1") opts.add_data('header','version',1) print("Check the error reporting.") print("Adding duplicate value") try: opts.add_data('header','version',2) except iniException, e: print ("Error: %s" % e) print("Error adding duplicate!") # More data to actually create something intersting opts.add_data('system info') opts.add_comment('more information about the system', 'system info') opts.add_data('system info', 'machine', platform.machine()) opts.add_data('system info', 'java_ver', platform.java_ver()) opts.add_data('system info', 'processor', platform.processor()) opts.add_data('system info', 'python_version', platform.python_version()) print("Get the values back") print("Version: %s\n" % opts.get_data('header', 'version')) print("Get the values back 2") for b in opts.get_data('system info'): key, val = b print("%s-%s" % (key, val)) print ("%s" % '-'*40) print opts ###############################################################################
# Copyright (c) 2016-2020, Adam Karpierz # Licensed under the BSD license # https://opensource.org/licenses/BSD-3-Clause import sys import os import platform is_windows = (bool(platform.win32_ver()[0]) or (sys.platform in ("win32", "cygwin")) or (sys.platform == "cli" and os.name in ("nt", "ce")) or (os.name == "java" and "windows" in platform.java_ver()[3][0].lower())) is_linux = sys.platform.startswith("linux") is_osx = (sys.platform == "darwin") is_android = False is_posix = (os.name == "posix") is_32bit = (sys.maxsize <= 2**32) def defined(varname, _getframe=sys._getframe): frame = _getframe(1) return varname in frame.f_locals or varname in frame.f_globals del sys, os, platform if is_windows: from ._windows import DLL_PATH, DLL, dlclose, CFUNC from ._windows import timeval, SOCKET, INVALID_SOCKET from ._windows import sockaddr, in_addr, sockaddr_in, in6_addr, sockaddr_in6
import os import platform import sys print(sys.gettrace()) print(os.getcwd(), os.get_blocking(1), os.get_exec_path(), os.get_inheritable(1)) print(os.get_terminal_size()) print("The code is running from : " + os.getcwd()) print("The credention " + str(os.geteuid())) print("The os use groups are " + str(os.getgroups())) print("The average system load information " + str(os.getloadavg())) print("Get os login " + os.getlogin() + " \n The p_id: " + str(os.getpgid(1)) + "\n the p_group: " + str(os.getpgrp())) print("\n os p_id :" + str(os.getpid()) + "\n os_pp_id :" + str(os.getppid())) print("\nvgroup id" + str(os.getresgid()) + "\nuser_id " + str(os.getresuid())) print("\n " + str(os.getsid(1)) + "\n" + str(os.getuid())) print("cpu count :" + str(os.cpu_count())) print("\n\n\n \t\t<--- SYSTEM INFORMATION ---> \n\n\n") print("" + str(platform.uname())) print("With processor " + platform.processor() + "The machine " + platform.machine() + " run in " + platform.node() + "node is connected in " + str(platform.mac_ver())) print("" + str(platform.java_ver())) print("python version " + str(platform.python_version_tuple()))
def test_java_ver(self): res = platform.java_ver()
def record_preexecute(self): """ Record basic runtime information in this dict before the exeuction is started. Function used to record runtime information prior to executing the process we want to track, e.g., the `execute_analysis(...)` of a standard analysis. The function may be overwritten in child classes to add recording of additional runtime information. All runtime data should be recorded in the main dict (i.e, self). This ensures in the case of standard analysis that the data is stored in the HDF5 file. Other data should be stored in separate variables that we may add to the object. When overwriting the function we should typically call super(...,self).runinfo_record_pretexecute() last in the custom version to ensure that the start_time is properly recorded right before the execution of the analysis. """ log_helper.debug(__name__, 'Recording pre-execution runtime data', root=self.mpi_root, comm=self.mpi_comm) # Record basic runtime environment information using the platform module try: self['architecture'] = unicode(platform.architecture()) self['java_ver'] = unicode(platform.java_ver()) self['libc_ver'] = unicode(platform.libc_ver()) self['linux_distribution'] = unicode(platform.linux_distribution()) self['mac_ver'] = unicode(platform.mac_ver()) self['machine'] = unicode(platform.machine()) self['node'] = unicode(platform.node()) self['platform'] = unicode(platform.platform()) self['processor'] = unicode(platform.processor()) self['python_branch'] = unicode(platform.python_branch()) self['python_build'] = unicode(platform.python_build()) self['python_compiler'] = unicode(platform.python_compiler()) self['python_implementation'] = unicode( platform.python_implementation()) self['python_revision'] = unicode(platform.python_revision()) self['python_version'] = unicode(platform.python_version()) self['release'] = unicode(platform.release()) self['system'] = unicode(platform.system()) self['uname'] = unicode(platform.uname()) self['version'] = unicode(platform.version()) self['win32_ver'] = unicode(platform.win32_ver()) except: warnings.warn( "WARNING: Recording of platform provenance failed: " + str(sys.exc_info())) # Attempt to record the svn version information try: import subprocess self['svn_ver'] = subprocess.check_output('svnversion').rstrip( '\n') except ImportError: log_helper.warning( __name__, 'Recording of svn version not possible. subprocess not installed', root=self.mpi_root, comm=self.mpi_comm) except: warnings.warn("Recording of svn version information failed: " + str(sys.exc_info())) # Attempt to record software library version try: import numpy as np self['numpy_version_full_version'] = unicode( np.version.full_version) self['numpy_version_release'] = unicode(np.version.release) self['numpy_version_git_revision'] = unicode( np.version.git_revision) except ImportError: log_helper.warning(__name__, 'Recording of numpy version not possible.', root=self.mpi_root, comm=self.mpi_comm) # Attempt to record psutil data try: import psutil self['logical_cpu_count'] = unicode(psutil.cpu_count()) self['cpu_count'] = unicode(psutil.cpu_count(logical=False)) process = psutil.Process() self['open_files'] = unicode(process.open_files()) self['memory_info_before'] = unicode(process.memory_info()) except ImportError: log_helper.warning( __name__, 'psutil not installed. Recording of part of runtime information not possible', root=self.mpi_root, comm=self.mpi_comm) except: warnings.warn( "Recording of psutil-based runtime information failed: " + str(sys.exc_info())) # Record the start time for the analysis self['start_time'] = unicode(datetime.datetime.now()) # Enable time and usage profiling if requested if self.__profile_time_and_usage: self.__time_and_use_profiler = Profile() self.__time_and_use_profiler.enable()
print( "\nPYTHON\t\t\t................................................................" ) print("buildno\t\t\t", platform.python_build()[0]) print("builddate\t\t", platform.python_build()[1]) print("compiler\t\t", platform.python_compiler()) print("branch\t\t\t", platform.python_branch()) print("implementation\t\t", platform.python_implementation()) print("revision\t\t", platform.python_revision()) print("version\t\t\t", platform.python_version()) print( "\nJAVA\t\t\t................................................................" ) print("release\t\t\t", platform.java_ver()[0]) print("vendor\t\t\t", platform.java_ver()[1]) print("vm_name\t\t\t", platform.java_ver()[2][0]) print("vm_release\t\t", platform.java_ver()[2][1]) print("vm_vendor\t\t", platform.java_ver()[2][2]) print("os_name\t\t\t", platform.java_ver()[3][0]) print("os_release\t\t", platform.java_ver()[3][1]) print("os_vendor\t\t", platform.java_ver()[3][2]) print( "\nWINDOWS\t\t\t................................................................" ) print("release\t\t\t", platform.win32_ver()[0]) print("version\t\t\t", platform.win32_ver()[1]) print("csd\t\t\t", platform.win32_ver()[2]) print("ptype\t\t\t", platform.win32_ver()[3])
import json, platform # Collect the data about the system info = { "architecture": platform.architecture(), "java version": platform.java_ver(), "c standard library version": platform.libc_ver(), "machine": platform.machine(), "mac version": platform.mac_ver(), "node": platform.node(), "platform": platform.platform(), "processor": platform.processor(), "release": platform.release(), "system": platform.system(), "uname": platform.uname(), "version": platform.version(), "windows": { "edition": platform.win32_edition(), "version": platform.win32_ver(), "is iot": platform.win32_is_iot() }, "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() } }
"win32_release": platform.win32_ver()[0], "win32_ver": platform.win32_ver()[1], "win32_service_pack": platform.win32_ver()[2], "win32_os_type": platform.win32_ver()[3], "win32_edition": platform.win32_edition(), "win32_iot_edition": platform.win32_is_iot() } VARIABLES["constants"]["shell"]["ps_null"] = "$null" VARIABLES["constants"]["shell"]["cmd_null"] = "NUL" # On Windows alias to a reasonable default VARIABLES["constants"]["shell"]["dev_null"] = "$null" elif platform.system() == "Darwin": VARIABLES["variables"]["mac"] = { "mac_release": platform.mac_ver()[0], "mac_version": platform.mac_ver()[1][0], "mac_dev_stage": platform.mac_ver()[1][1], "mac_non_release_version": platform.mac_ver()[1][2], "mac_machine": platform.mac_ver()[2] } elif platform.system() == "Java": VARIABLES["variables"]["java"] = { "java_version": platform.java_ver()[0], "java_vendor": platform.java_ver()[1], "java_vm_name": platform.java_ver()[2][0], "java_vm_release": platform.java_ver()[2][1], "java_vm_vendor": platform.java_ver()[2][3], "java_os_name": platform.java_ver()[3][0], "java_os_version": platform.java_ver()[3][1], "java_os_arch": platform.java_ver()[3][2] }
#12 zip_path = r'E:\learnings\python\temp' with zipfile.ZipFile('sample.zip', 'w') as z: for files in os.listdir(): z.write(files) #13 x = os.popen('python.exe') x._stream x.__doc__ x._proc #14 os.lstat(base_path + 'sample.txt') #15 os.cpu_count() #16 os.environ os.getenv('USERNAME') platform.architecture() platform.dist() platform.java_ver() platform.machine() platform.mac_ver() platform.os platform.python_build() platform.release()
print("Biezacy folder:", os.getcwd()) print("Listowanie:", os.listdir(".")) if not os.path.exists("tmp"): os.mkdir("tmp") else: print("podfolder 'tmp' juz jest") os.removedirs("tmp") import shutil shutil.copy("json.txt", "json-kopia.txt") disk = shutil.disk_usage(".") print(disk) curr_dir = os.getcwd() #new_dir = curr_dir + "\\tmp" - bedzie dzialac tylko w Windows new_dir = os.path.join(curr_dir, "tmp") print("OS:",os.name) print("separator katalogow: ",os.sep) print(new_dir) # windows - c:\users\kowalski\Moje Dokumenty\plik.py # macos/unix - /Users/marian/Downloads/plik.py import platform print("OS:",platform.system()) print("OS:",platform.architecture()) print("OS:",platform.processor()) print("OS:",platform.java_ver())
# coding=utf-8 import platform print platform.system() print platform.version() print platform.release() print platform.dist() print platform.uname() print platform.node() print platform.platform() print platform.machine() print platform.processor() print platform.architecture() print platform._sys_version() print platform.java_ver() print platform.python_version() print platform.python_implementation() print platform.python_version_tuple() print platform.python_branch() print platform.python_compiler() print platform.python_build() print platform.win32_ver() print platform.mac_ver() print platform.linux_distribution() print platform.popen('ifconfig','w')
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);
* License along with JyNI. If not, see <http://www.gnu.org/licenses/>. Created on 30.06.2013 @author: Stefan Richthofer ''' import sys import os import platform # This will vastly simplify once Jython 2.7.1 is out and we have # uname and mac_ver available in Jython: if os.name == 'java': systm = platform.java_ver()[-1][0].lower().replace(' ', '') if systm == 'macosx': ver = platform.java_ver()[-1][1] ver = ver[:ver.rfind('.')] buildf = '-'.join((systm, ver, 'intel')) else: buildf = '-'.join((systm, platform.uname()[-1])) else: systm = platform.uname()[0].lower() if systm == 'darwin': ver = platform.mac_ver()[0] ver = ver[:ver.rfind('.')] buildf = '-'.join(('macosx', ver, 'intel')) else: buildf = '-'.join((systm, platform.uname()[-1]))
'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': linuxdist, '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)
# OS agnostic OS_TYPE = platform.system() OS_RELEASE = platform.release() OS_VERSION = platform.version() # OS specific WINDOWS = LINUX = JAVA = MAC = None if OS_TYPE == "Windows": WINDOWS = platform.win32_ver() #sys.getwindowsversion() elif OS_TYPE == "Linux": LINUX = platform.linux_distribution() elif OS_TYPE == "Java": # Jython JAVA = platform.java_ver() elif OS_TYPE == "Darwin": # OSX MAC = platform.mac_ver() # Python PYTHON = sys.version PYTHON_TUPLE = sys.version_info # in case the try block fails, set all the tuples and values to something PYSIDE = "N/A" PYSIDE_TUPLE = ("N", "/", "A") QT = "N/A" QT_TUPLE = ("N", "/", "A")
def test_java_ver(self): res = platform.java_ver() if sys.platform == "java": self.assert_(all(res))
Created on 03.10.2015 @author: Stefan Richthofer ''' import sys #Include native ctypes: sys.path.append('/usr/lib/python2.7/lib-dynload') import ctypes import platform isMac = platform.java_ver()[-1][0] == 'Mac OS X' or platform.mac_ver()[0] != '' from ctypes import * # # print "Demo of ctypes with os.name: "+platform.os.name # print "" if isMac: libc = CDLL('libc.dylib') else: libc = CDLL('libc.so.6') class Bottles: def __init__(self, number): self._as_parameter_ = number # print libc
('architecture', platform.machine()), # (mac|i|tv)OS(X) version (e.g. 10.11.6) instead of darwin # kernel version. ('version', platform.mac_ver()[0]) ]) elif sys.platform == 'win32': _METADATA['os'] = SON([ ('type', platform.system()), # "Windows XP", "Windows 7", "Windows 10", etc. ('name', ' '.join((platform.system(), platform.release()))), ('architecture', platform.machine()), # Windows patch level (e.g. 5.1.2600-SP3) ('version', '-'.join(platform.win32_ver()[1:3])) ]) elif sys.platform.startswith('java'): _name, _ver, _arch = platform.java_ver()[-1] _METADATA['os'] = SON([ # Linux, Windows 7, Mac OS X, etc. ('type', _name), ('name', _name), # x86, x86_64, AMD64, etc. ('architecture', _arch), # Linux kernel version, OSX version, etc. ('version', _ver) ]) else: # Get potential alias (e.g. SunOS 5.11 becomes Solaris 2.11) _aliased = platform.system_alias( platform.system(), platform.release(), platform.version()) _METADATA['os'] = SON([ ('type', platform.system()),
class Benchmark(object): """ Defines benchmark suite and utility to save and render the results. """ scenarii = [ # Tiny boards { 'length': 3, 'height': 3, 'king': 2, 'rook': 1 }, { 'length': 4, 'height': 4, 'rook': 2, 'knight': 4 }, # n queens problems. { 'length': 1, 'height': 1, 'queen': 1 }, { 'length': 2, 'height': 2, 'queen': 2 }, { 'length': 3, 'height': 3, 'queen': 3 }, { 'length': 4, 'height': 4, 'queen': 4 }, { 'length': 5, 'height': 5, 'queen': 5 }, { 'length': 6, 'height': 6, 'queen': 6 }, { 'length': 7, 'height': 7, 'queen': 7 }, { 'length': 8, 'height': 8, 'queen': 8 }, # {'length': 9, 'height': 9, 'queen': 9}, # Big family. { 'length': 5, 'height': 5, 'king': 2, 'queen': 2, 'bishop': 2, 'knight': 1 }, { 'length': 6, 'height': 6, 'king': 2, 'queen': 2, 'bishop': 2, 'knight': 1 }, # {'length': 7, 'height': 7, # 'king': 2, 'queen': 2, 'bishop': 2, 'knight': 1}, ] # Data are going in a CSV file along this file. csv_filepath = path.join(path.dirname(__file__), 'benchmark.csv') # Gather software and hardware metadata. context = OrderedDict([ # Solver. ('chessboard', __version__), # Python interpreter. ('implementation', platform.python_implementation()), ('python', platform.python_version()), # Underlaying OS. ('system', platform.system()), ('osx', platform.mac_ver()[0]), ('linux', ' '.join(platform.linux_distribution()).strip()), ('windows', platform.win32_ver()[1]), ('java', platform.java_ver()[0]), # Hardware. ('architecture', platform.architecture()[0]), ('machine', platform.machine()) ]) # Sorted column IDs. column_ids = ['length', 'height'] + PIECE_LABELS.keys() + [ 'solutions', 'execution_time' ] + context.keys() def __init__(self): """ Initialize the result database. """ self.results = pandas.DataFrame(columns=self.column_ids) def load_csv(self): """ Load old benchmark results from CSV. """ self.results = self.results.append(pandas.read_csv(self.csv_filepath)) def add(self, new_results): """ Add new benchmark results. """ for result in new_results: result.update(self.context) self.results = self.results.append(result, ignore_index=True) def save_csv(self): """ Dump all results to CSV. """ # Sort results so we can start to see patterns right in the raw CSV. self.results.sort(columns=self.column_ids, inplace=True) # Gotcha: integers seems to be promoted to float64 because of # reindexation. See: http://pandas.pydata.org/pandas-docs/stable # /gotchas.html#na-type-promotions self.results.to_csv(self.csv_filepath, index=False) def nqueen_graph(self): """ Graph n-queens problem for the current version and context. """ # Filters out boards with pieces other than queens. nqueens = self.results for piece_label in set(PIECE_LABELS.keys()).difference(['queen']): nqueens = nqueens[nqueens[piece_label].map(pandas.isnull)] # Filters out non-square boards whose dimension are not aligned to the # number of queens. nqueens = nqueens[nqueens['length'] == nqueens['queen']] nqueens = nqueens[nqueens['height'] == nqueens['queen']] # Filters out results not obtained from this system. for label, value in self.context.items(): if not value: nqueens = nqueens[nqueens[label].map(pandas.isnull)] else: nqueens = nqueens[nqueens[label] == value] plot = seaborn.factorplot(x='queen', y='execution_time', data=nqueens.sort(columns='queen'), estimator=median, kind='bar', palette='BuGn_d', aspect=1.5) plot.set_xlabels('Number of queens') plot.set_ylabels('Solving time in seconds (log scale)') plot.fig.get_axes()[0].set_yscale('log') plot.savefig('nqueens-performances.png')
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',
__version_info__ = (1, 4, 1) __version__ = '.'.join(map(str, __version_info__)) import sys import os PY3 = sys.version_info[0] == 3 if PY3: unicode = str if sys.platform.startswith('java'): import platform os_name = platform.java_ver()[3][0] if os_name.startswith('Windows'): # "Windows XP", "Windows 7", etc. system = 'win32' elif os_name.startswith('Mac'): # "Mac OS X", etc. system = 'darwin' else: # "Linux", "SunOS", "FreeBSD", etc. # Setting this to "linux2" is not ideal, but only Windows or Mac # are actually checked for and the rest of the module expects # *sys.platform* style strings. system = 'linux2' else: system = sys.platform def user_data_dir(appname=None, appauthor=None, version=None, roaming=False):
import platform is_osx = platform.java_ver()[-1][0] == "Mac OS X" CTRL_CMD = "META_MASK" if is_osx else "CTRL_MASK"
def test_java_ver(self): res = platform.java_ver() if sys.platform == 'java': self.assertTrue(all(res))
* * You should have received a copy of the GNU Lesser General Public * License along with JyNI. If not, see <http://www.gnu.org/licenses/>. Created on 10.07.2015 @author: Stefan Richthofer ''' import sys import os import platform if os.name == 'java': systm = platform.java_ver()[-1][0].lower().replace(' ', '') if systm == 'macosx': ver = platform.java_ver()[-1][1] ver = ver[:5] # e.g."10.12.4" => "10.12" buildf = '-'.join((systm, ver, 'intel')) else: if systm.startswith('win'): systm = 'win' buildf = '-'.join((systm, os.uname()[-1])) else: systm = os.uname()[0].lower() if systm == 'darwin': ver = platform.mac_ver()[0] ver = ver[:5] # e.g."10.12.4" => "10.12" buildf = '-'.join(('macosx', ver, 'intel')) else:
def update_event(self, inp=-1): self.set_output_val( 0, platform.java_ver(self.input(0), self.input(1), self.input(2), self.input(3)))
# - XDG spec for Un*x: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html __version_info__ = (1, 4, 3) __version__ = '.'.join(map(str, __version_info__)) import sys import os PY3 = sys.version_info[0] == 3 if PY3: unicode = str if sys.platform.startswith('java'): import platform os_name = platform.java_ver()[3][0] if os_name.startswith('Windows'): # "Windows XP", "Windows 7", etc. system = 'win32' elif os_name.startswith('Mac'): # "Mac OS X", etc. system = 'darwin' else: # "Linux", "SunOS", "FreeBSD", etc. # Setting this to "linux2" is not ideal, but only Windows or Mac # are actually checked for and the rest of the module expects # *sys.platform* style strings. system = 'linux2' else: system = sys.platform def user_data_dir(appname=None, appauthor=None, version=None, roaming=False): r"""Return full path to the user-specific data dir for this application.
platform.python_version_tuple %s; platform.re %s; platform.release %s; platform.sys %s; platform.system %s; platform.system_alias %s; platform.uname %s; platform.version %s; platform.win32_ver %s; DJANGO django.version %s; """%( platform.architecture(), 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(),