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


Python Tools.getOsName方法代码示例

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


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

示例1: endSetup

# 需要导入模块: from libs import Tools [as 别名]
# 或者: from libs.Tools import getOsName [as 别名]
    def endSetup(self):
        # get pio version
        executable = os.path.join(self.env_bin_dir, 'pio')
        cmd = ['\"' + executable + '\"', '--version']
        out = childProcess(cmd)

        pio_version = match(r"\w+\W \w+ (.+)", out[1]).group(1)
        self.Preferences.set('pio_version', pio_version)

        # save env paths
        env_path = [self.env_bin_dir]
        self.saveEnvPaths(env_path)

        # copy menu
        sys_os = Tools.getOsName()
        preset_path = Paths.getPresetPath()
        plg_path = Paths.getPluginPath()
        dst = os.path.join(plg_path, 'Settings-Default', 'Main.sublime-menu')

        if(sys_os == 'windows'):
            src_path = os.path.join(preset_path, 'Main.sublime-menu.windows')
            copy(src_path, dst)
        elif(sys_os == 'osx'):
            src_path = os.path.join(preset_path, 'Main.sublime-menu.osx')
            copy(src_path, dst)
        else:
            src_path = os.path.join(preset_path, 'Main.sublime-menu.linux')
            copy(src_path, dst)

        # creating files (menu, completions, syntax)
        generateFiles()
开发者ID:ikthap,项目名称:Deviot,代码行数:33,代码来源:Install.py

示例2: listRootPath

# 需要导入模块: from libs import Tools [as 别名]
# 或者: from libs.Tools import getOsName [as 别名]
def listRootPath():
    root_list = []
    os_name = Tools.getOsName()
    if os_name == 'windows':
        root_list = listWinVolume()
    else:
        home_path = os.getenv('HOME')
        root_list = [home_path, ROOT_PATH]
    return root_list
开发者ID:dattasaurabh82,项目名称:Deviot,代码行数:11,代码来源:Paths.py

示例3: getEnvBinDir

# 需要导入模块: from libs import Tools [as 别名]
# 或者: from libs.Tools import getOsName [as 别名]
def getEnvBinDir():
    env_dir = getEnvDir()
    env_bin_dir = os.path.join(
        env_dir, 'Scripts' if 'windows' in Tools.getOsName() else 'bin')

    try:
        os.makedirs(env_bin_dir)
    except OSError as exc:
        if exc.errno != errno.EEXIST:
            raise exc
        pass

    return env_bin_dir
开发者ID:dattasaurabh82,项目名称:Deviot,代码行数:15,代码来源:Paths.py

示例4: listSerialPorts

# 需要导入模块: from libs import Tools [as 别名]
# 或者: from libs.Tools import getOsName [as 别名]
def listSerialPorts():
    """
    List all the serial ports availables in the diffents O.S
    """
    os_name = Tools.getOsName()
    if os_name == "windows":
        serial_ports = listWinSerialPorts()
    elif os_name == 'osx':
        serial_ports = listOsxSerialPorts()
    else:
        serial_ports = listLinuxSerialPorts()
    serial_ports.sort()
    return serial_ports
开发者ID:BadgerAAV,项目名称:Deviot,代码行数:15,代码来源:Serial.py

示例5: endSetup

# 需要导入模块: from libs import Tools [as 别名]
# 或者: from libs.Tools import getOsName [as 别名]
    def endSetup(self):
        try:
            from .PlatformioCLI import generateFiles
        except:
            from libs.PlatformioCLI import generateFiles

        # save env paths
        if(self.os != 'osx'):
            env_path = [self.env_bin_dir]
            self.saveEnvPaths(env_path)

        # get pio version
        if(self.os == 'osx'):
            executable = os.path.join(self.env_bin_dir, 'python')
            cmd = ['"%s"' % (executable), '-m', 'platformio', '--version']
        else:
            executable = os.path.join(self.env_bin_dir, 'pio')
            cmd = ['"%s"' % (executable), '--version']
        out = childProcess(cmd)

        pio_version = match(r"\w+\W \w+ (.+)", out[1]).group(1)
        self.Preferences.set('pio_version', pio_version)

        # copy menu
        sys_os = Tools.getOsName()
        preset_path = Paths.getPresetPath()
        plg_path = Paths.getPluginPath()
        dst = os.path.join(plg_path, 'Settings-Default', 'Main.sublime-menu')

        if(sys_os == 'windows'):
            if(platform.release() == '7'):
                src_path = os.path.join(preset_path, 'Main.sublime-menu.w7')
            else:    
                src_path = os.path.join(preset_path, 'Main.sublime-menu.windows')
            copy(src_path, dst)
        elif(sys_os == 'osx'):
            src_path = os.path.join(preset_path, 'Main.sublime-menu.osx')
            copy(src_path, dst)
        else:
            src_path = os.path.join(preset_path, 'Main.sublime-menu.linux')
            copy(src_path, dst)

        # creating files (menu, completions, syntax)
        sublime.set_timeout(generateFiles, 0)

        self.Preferences.set('protected', True)
        self.Preferences.set('enable_menu', True)
开发者ID:ashgan-dev,项目名称:Deviot,代码行数:49,代码来源:Install.py

示例6: __init__

# 需要导入模块: from libs import Tools [as 别名]
# 或者: from libs.Tools import getOsName [as 别名]
    def __init__(self):
        self.Preferences = Preferences()
        self.base_dir = Paths.getDeviotUserPath()
        self.env_dir = Paths.getEnvDir()
        self.env_bin_dir = Paths.getEnvBinDir()
        self.cache_dir = Paths.getCacheDir()
        self.env_file = Paths.getEnvFile()
        self.cached_file = False
        self.os = Tools.getOsName()

        # console
        window = sublime.active_window()
        console_name = 'Deviot|Pio_Install' + str(time.time())
        console = Messages.Console(window, name=console_name)

        # Queue for the user console
        self.message_queue = Messages.MessageQueue(console)
开发者ID:platformio,项目名称:Deviot,代码行数:19,代码来源:Install.py

示例7: getTempPath

# 需要导入模块: from libs import Tools [as 别名]
# 或者: from libs.Tools import getOsName [as 别名]
def getTempPath(file_name=False):
    tmp_path = '/tmp'
    os_name = Tools.getOsName()
    if os_name == 'windows':
        tmp_path = os.environ['tmp']

    tmp_path = os.path.join(tmp_path, 'Deviot')

    if(file_name):
        tmp_path = os.path.join(tmp_path, file_name)

    try:
        os.makedirs(tmp_path)
    except OSError as exc:
        if exc.errno != errno.EEXIST:
            raise exc
        pass

    return tmp_path
开发者ID:dattasaurabh82,项目名称:Deviot,代码行数:21,代码来源:Paths.py

示例8: SerialListener

# 需要导入模块: from libs import Tools [as 别名]
# 或者: from libs.Tools import getOsName [as 别名]
import time
import glob
import threading

try:
    from . import Tools
    from . import pyserial
    from . import Messages
    from .Preferences import Preferences
except:
    from libs import Tools
    from libs import pyserial
    from libs import Messages
    from libs.Preferences import Preferences

if Tools.getOsName() == 'windows':
    if Tools.getPythonVersion() < 3:
        import _winreg as winreg
    else:
        import winreg


@Tools.singleton
class SerialListener(object):
    """
    Constantly checks if a port has been connected or disconnected
    """

    def __init__(self, func=None):
        self.func = func
        self.serial_list = []
开发者ID:BadgerAAV,项目名称:Deviot,代码行数:33,代码来源:Serial.py


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