当前位置: 首页>>代码示例>>Python>>正文


Python System.getProperty方法代码示例

本文整理汇总了Python中java.lang.System.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Python System.getProperty方法的具体用法?Python System.getProperty怎么用?Python System.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.lang.System的用法示例。


在下文中一共展示了System.getProperty方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: unversioned_sys_platform

# 需要导入模块: from java.lang import System [as 别名]
# 或者: from java.lang.System import getProperty [as 别名]
def unversioned_sys_platform():
	s=sys.platform
	if s.startswith('java'):
		from java.lang import System
		s=System.getProperty('os.name')
		if s=='Mac OS X':
			return'darwin'
		elif s.startswith('Windows '):
			return'win32'
		elif s=='OS/2':
			return'os2'
		elif s=='HP-UX':
			return'hp-ux'
		elif s in('SunOS','Solaris'):
			return'sunos'
		else:s=s.lower()
	if s=='powerpc':
		return'darwin'
	if s=='win32'or s=='os2':
		return s
	return re.split('\d+$',s)[0] 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:23,代码来源:Utils.py

示例2: unversioned_sys_platform

# 需要导入模块: from java.lang import System [as 别名]
# 或者: from java.lang.System import getProperty [as 别名]
def unversioned_sys_platform():
	s=sys.platform
	if s.startswith('java'):
		from java.lang import System
		s=System.getProperty('os.name')
		if s=='Mac OS X':
			return'darwin'
		elif s.startswith('Windows '):
			return'win32'
		elif s=='OS/2':
			return'os2'
		elif s=='HP-UX':
			return'hp-ux'
		elif s in('SunOS','Solaris'):
			return'sunos'
		else:s=s.lower()
	if s=='powerpc':
		return'darwin'
	if s=='win32'or s=='os2':
		return s
	if s=='cli'and os.name=='nt':
		return'win32'
	return re.split('\d+$',s)[0] 
开发者ID:KTH,项目名称:royal-chaos,代码行数:25,代码来源:Utils.py

示例3: test_catch

# 需要导入模块: from java.lang import System [as 别名]
# 或者: from java.lang.System import getProperty [as 别名]
def test_catch(self):
        from java.lang import Integer
        from java.lang import RuntimeException, IllegalArgumentException, NumberFormatException
        with self.assertRaises(NumberFormatException):      # Actual class
            Integer.parseInt("hello")
        with self.assertRaises(IllegalArgumentException):   # Parent class
            Integer.parseInt("hello")
        with self.assertRaises(RuntimeException):           # Grandparent class
            Integer.parseInt("hello")

        from java.lang import System
        from java.io import IOException
        try:
            System.getProperty("")
        except IOException:                                 # Unrelated class
            self.fail()
        except NumberFormatException:                       # Child class
            self.fail()
        except IllegalArgumentException:                    # Actual class
            pass 
开发者ID:chaquo,项目名称:chaquopy,代码行数:22,代码来源:test_exception.py

示例4: _extract_certs_from_keystore_file

# 需要导入模块: from java.lang import System [as 别名]
# 或者: from java.lang.System import getProperty [as 别名]
def _extract_certs_from_keystore_file(f, password):
    keystore = KeyStore.getInstance(KeyStore.getDefaultType())
    if password is None:
        password = System.getProperty('javax.net.ssl.trustStorePassword')
        if password is None:  # default java keystore password is changeit
            password = 'changeit'
    elif not isinstance(password, str):
        password = []

    keystore.load(BufferedInputStream(f), password)
    certs = []

    alias_iter = keystore.aliases()
    while alias_iter.hasMoreElements():
        alias = alias_iter.nextElement()
        certs.append(keystore.getCertificate(alias))

    return certs 
开发者ID:Acmesec,项目名称:CTFCrackTools-V2,代码行数:20,代码来源:_sslcerts.py

示例5: _java_getprop

# 需要导入模块: from java.lang import System [as 别名]
# 或者: from java.lang.System import getProperty [as 别名]
def _java_getprop(name,default):

    from java.lang import System
    try:
        value = System.getProperty(name)
        if value is None:
            return default
        return value
    except AttributeError:
        return default 
开发者ID:war-and-code,项目名称:jawfish,代码行数:12,代码来源:platform.py

示例6: _java_getprop

# 需要导入模块: from java.lang import System [as 别名]
# 或者: from java.lang.System import getProperty [as 别名]
def _java_getprop(name, default):

    from java.lang import System
    try:
        value = System.getProperty(name)
        if value is None:
            return default
        return value
    except AttributeError:
        return default 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:12,代码来源:platform.py

示例7: getuser

# 需要导入模块: from java.lang import System [as 别名]
# 或者: from java.lang.System import getProperty [as 别名]
def getuser():
    return System.getProperty("user.name") 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:4,代码来源:javapath.py

示例8: gethome

# 需要导入模块: from java.lang import System [as 别名]
# 或者: from java.lang.System import getProperty [as 别名]
def gethome():
    return System.getProperty("user.home")


# normpath() from Python 1.5.2, with Java appropriate generalizations

# Normalize a path, e.g. A//B, A/./B and A/foo/../B all become A/B.
# It should be understood that this may change the meaning of the path
# if it contains symbolic links! 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:11,代码来源:javapath.py

示例9: _java_getprop

# 需要导入模块: from java.lang import System [as 别名]
# 或者: from java.lang.System import getProperty [as 别名]
def _java_getprop(name,default):

    try:
        return newString(System.getProperty(name))
    except:
        return default 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:8,代码来源:platform.py

示例10: test_unquoted

# 需要导入模块: from java.lang import System [as 别名]
# 或者: from java.lang.System import getProperty [as 别名]
def test_unquoted(self):
        # for the build bot, try to specify a real java home
        javaHome = System.getProperty('java.home', 'C:\\Program Files\\Java\\someJava')
        self.assertOutput(javaHome=javaHome) 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:6,代码来源:test_bat_jy.py

示例11: value

# 需要导入模块: from java.lang import System [as 别名]
# 或者: from java.lang.System import getProperty [as 别名]
def value(self, value):
        def repl(sub):
            from java.lang import System
            return System.getProperty(sub.group(1), sub.group(1))
        value = self.re_var.sub(repl, value)
        return value 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:8,代码来源:runner.py

示例12: _filepicker

# 需要导入模块: from java.lang import System [as 别名]
# 或者: from java.lang.System import getProperty [as 别名]
def _filepicker(self):
        """
        Run the filepicker and return if approved

        :return: boolean, true if approved
        """
        fileChooser = JFileChooser()
        fileChooser.setCurrentDirectory(File(System.getProperty("user.home")))
        result = fileChooser.showOpenDialog(self.this)
        isApproveOption = result == JFileChooser.APPROVE_OPTION
        if isApproveOption:
            selectedFile = fileChooser.getSelectedFile()
            self._omnibar.setText(selectedFile.getAbsolutePath())
        return isApproveOption 
开发者ID:doyensec,项目名称:inql,代码行数:16,代码来源:tab.py

示例13: _java_getprop

# 需要导入模块: from java.lang import System [as 别名]
# 或者: from java.lang.System import getProperty [as 别名]
def _java_getprop(name,default):

    try:
        value = System.getProperty(name)
        if value is None:
            return default
        return newString(value)
    except AttributeError:
        return default 
开发者ID:Acmesec,项目名称:CTFCrackTools-V2,代码行数:11,代码来源:platform.py

示例14: get_default_verify_paths

# 需要导入模块: from java.lang import System [as 别名]
# 或者: from java.lang.System import getProperty [as 别名]
def get_default_verify_paths():
    """Return paths to default cafile and capath.
    """
    cafile, capath = None, None
    default_cert_dir_env = os.environ.get('SSL_CERT_DIR', None)
    default_cert_file_env = os.environ.get('SSL_CERT_FILE', None)

    java_cert_file = System.getProperty('javax.net.ssl.trustStore')

    if java_cert_file is not None and os.path.isfile(java_cert_file):
        cafile = java_cert_file
    else:
        if default_cert_dir_env is not None:
            capath = default_cert_dir_env if os.path.isdir(default_cert_dir_env) else None
        if default_cert_file_env is not None:
            cafile = default_cert_file_env if os.path.isfile(default_cert_file_env) else None

        if cafile is None:
            # http://docs.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html
            java_home = System.getProperty('java.home')
            for _path in ('lib/security/jssecacerts', 'lib/security/cacerts'):
                java_cert_file = os.path.join(java_home, _path)
                if os.path.isfile(java_cert_file):
                    cafile = java_cert_file
                    capath = os.path.dirname(cafile)

    return DefaultVerifyPaths(cafile if os.path.isfile(cafile) else None,
                              capath if capath and os.path.isdir(capath) else None,
                              'SSL_CERT_FILE', default_cert_file_env,
                              'SSL_CERT_DIR', default_cert_dir_env) 
开发者ID:Acmesec,项目名称:CTFCrackTools-V2,代码行数:32,代码来源:ssl.py


注:本文中的java.lang.System.getProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。