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


Python util.is_windows函数代码示例

本文整理汇总了Python中quodlibet.util.is_windows函数的典型用法代码示例。如果您正苦于以下问题:Python is_windows函数的具体用法?Python is_windows怎么用?Python is_windows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _init_python

def _init_python():
    if PY2 or is_release():
        MinVersions.PYTHON2.check(sys.version_info)
    else:
        # for non release builds we allow Python3
        MinVersions.PYTHON3.check(sys.version_info)

    if is_osx():
        # We build our own openssl on OSX and need to make sure that
        # our own ca file is used in all cases as the non-system openssl
        # doesn't use the system certs
        install_urllib2_ca_file()

    if is_windows():
        # Not really needed on Windows as pygi-aio seems to work fine, but
        # wine doesn't have certs which we use for testing.
        install_urllib2_ca_file()

    if is_windows() and os.sep != "\\":
        # In the MSYS2 console MSYSTEM is set, which breaks os.sep/os.path.sep
        # If you hit this do a "setup.py clean -all" to get rid of the
        # bytecode cache then start things with "MSYSTEM= ..."
        raise AssertionError("MSYSTEM is set (%r)" % environ.get("MSYSTEM"))

    if is_windows():
        # gdbm is broken under msys2, this makes shelve use another backend
        sys.modules["gdbm"] = None
        sys.modules["_gdbm"] = None

    logging.getLogger().addHandler(PrintHandler())
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:30,代码来源:_init.py

示例2: test_constrains

    def test_constrains(self):
        if is_py2exe():
            self.assertEqual(is_py2exe_console(), not is_py2exe_window())
            self.assertTrue(is_windows())

        if is_windows():
            self.assertFalse(is_osx())

        if is_osx():
            self.assertFalse(is_windows())
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:10,代码来源:test_util_environment.py

示例3: find_audio_sink

def find_audio_sink():
    """Get the best audio sink available.

    Returns (element, description) or raises PlayerError.
    """

    if is_windows():
        sinks = [
            "directsoundsink",
            "autoaudiosink",
        ]
    elif is_linux() and pulse_is_running():
        sinks = [
            "pulsesink",
        ]
    else:
        sinks = [
            "autoaudiosink",  # plugins-good
            "pulsesink",  # plugins-good
            "alsasink",  # plugins-base
        ]

    for name in sinks:
        element = Gst.ElementFactory.make(name, None)
        if element is not None:
            return (element, name)
    else:
        details = " (%s)" % ", ".join(sinks) if sinks else ""
        raise PlayerError(_("No GStreamer audio sink found") + details)
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:29,代码来源:util.py

示例4: _get_chooser

def _get_chooser(accept_label, cancel_label):
    """
    Args:
        accept_label (str)
        cancel_label (str)
    Returns:
        Gtk.FileChooser
    """

    if hasattr(Gtk, "FileChooserNative"):
        FileChooser = Gtk.FileChooserNative
    else:
        FileChooser = Gtk.FileChooserDialog

    # https://github.com/quodlibet/quodlibet/issues/2406
    if is_windows() and gtk_version < (3, 22, 16):
        FileChooser = Gtk.FileChooserDialog

    chooser = FileChooser()

    if hasattr(chooser, "set_accept_label"):
        chooser.set_accept_label(accept_label)
    else:
        chooser.add_button(accept_label, Gtk.ResponseType.ACCEPT)
        chooser.set_default_response(Gtk.ResponseType.ACCEPT)

    if hasattr(chooser, "set_cancel_label"):
        chooser.set_cancel_label(cancel_label)
    else:
        chooser.add_button(cancel_label, Gtk.ResponseType.CANCEL)

    return chooser
开发者ID:zsau,项目名称:quodlibet,代码行数:32,代码来源:chooser.py

示例5: test_all

 def test_all(self):
     self.assertTrue(isinstance(is_unity(), bool))
     self.assertTrue(isinstance(is_windows(), bool))
     self.assertTrue(isinstance(is_osx(), bool))
     self.assertTrue(isinstance(is_py2exe(), bool))
     self.assertTrue(isinstance(is_py2exe_console(), bool))
     self.assertTrue(isinstance(is_py2exe_window(), bool))
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:7,代码来源:test_util_environment.py

示例6: create_pool

def create_pool():
    if is_wine() or(PY3 and is_windows()):
        # ProcessPoolExecutor is broken under wine, and under py3+msys2
        # https://github.com/Alexpux/MINGW-packages/issues/837
        return ThreadPoolExecutor(1)
    else:
        return ProcessPoolExecutor(None)
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:7,代码来源:test_pep8.py

示例7: test_basic

 def test_basic(self):
     if is_windows():
         res = split_scan_dirs(u":Z:\\foo:C:/windows:")
         self.assertEquals(res, [u"Z:\\foo", u"C:/windows"])
     else:
         res = split_scan_dirs(":%s:%s:" % (STANDARD_PATH, OTHER_PATH))
         self.assertEquals(res, [STANDARD_PATH, OTHER_PATH])
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:7,代码来源:test_util_library.py

示例8: test_parse

    def test_parse(self):
        if is_windows():
            return

        data = (b'file:///foo/bar\nfile:///home/user\n'
                b'file:///home/user/Downloads Downloads\n')
        paths = parse_gtk_bookmarks(data)
        assert all(isinstance(p, fsnative) for p in paths)
开发者ID:LudoBike,项目名称:quodlibet,代码行数:8,代码来源:test_qltk_filesel.py

示例9: set_scan_dirs

def set_scan_dirs(dirs):
    """Saves a list of fs paths which should be scanned

    Args:
        list
    """

    assert all(isinstance(d, fsnative) for d in dirs)

    if is_windows():
        joined = fsnative(u":").join(dirs)
    else:
        joined = join_escape(dirs, fsnative(u":"))
    config.setbytes("settings", "scan", fsn2bytes(joined, "utf-8"))
开发者ID:piotrdrag,项目名称:quodlibet,代码行数:14,代码来源:library.py

示例10: init_devices

def init_devices():
    global devices

    load_pyc = util.is_windows() or util.is_osx()
    modules = load_dir_modules(dirname(__file__),
                               package=__package__,
                               load_compiled=load_pyc)

    for mod in modules:
        try:
            devices.extend(mod.devices)
        except AttributeError:
            print_w("%r doesn't contain any devices." % mod.__name__)

    devices.sort()
开发者ID:virtuald,项目名称:quodlibet,代码行数:15,代码来源:__init__.py

示例11: split_scan_dirs

def split_scan_dirs(joined_paths):
    """Returns a list of paths

    Args:
        joined_paths (fsnative)
    Return:
        list
    """

    assert isinstance(joined_paths, fsnative)

    if is_windows():
        # we used to separate this config with ":", so this is tricky
        return list(filter(None, re.findall(r"[a-zA-Z]:[\\/][^:]*", joined_paths)))
    else:
        return list(filter(None, split_escape(joined_paths, ":")))
开发者ID:piotrdrag,项目名称:quodlibet,代码行数:16,代码来源:library.py

示例12: _py3_to_py2

def _py3_to_py2(items):
    is_win = is_windows()

    new_list = []
    for i in items:
        inst = dict.__new__(i.__class__)
        for key, value in i.items():
            if key in ("~filename", "~mountpoint") and not is_win:
                value = fsn2bytes(value, None)
            try:
                key = key.encode("ascii")
            except UnicodeEncodeError:
                pass
            dict.__setitem__(inst, key, value)
        new_list.append(inst)
    return new_list
开发者ID:zsau,项目名称:quodlibet,代码行数:16,代码来源:_serialize.py

示例13: _init_python

def _init_python():
    if PY2 or is_release():
        MinVersions.PYTHON2.check(sys.version_info)
    else:
        # for non release builds we allow Python3
        MinVersions.PYTHON3.check(sys.version_info)

    if is_osx():
        # We build our own openssl on OSX and need to make sure that
        # our own ca file is used in all cases as the non-system openssl
        # doesn't use the system certs
        util.install_urllib2_ca_file()

    if is_windows():
        # Not really needed on Windows as pygi-aio seems to work fine, but
        # wine doesn't have certs which we use for testing.
        util.install_urllib2_ca_file()
开发者ID:gbtami,项目名称:quodlibet,代码行数:17,代码来源:__init__.py

示例14: init

def init():
    """Import all browsers from this package and from the user directory.

    After this is called the global `browers` list will contain all
    classes sorted by priority.

    Can be called multiple times.
    """

    global browsers, default

    # ignore double init (for the test suite)
    if browsers:
        return

    this_dir = os.path.dirname(__file__)
    load_pyc = util.is_windows() or util.is_osx()
    modules = load_dir_modules(this_dir,
                               package=__package__,
                               load_compiled=load_pyc)

    user_dir = os.path.join(quodlibet.get_user_dir(), "browsers")
    if os.path.isdir(user_dir):
        modules += load_dir_modules(user_dir,
                                    package="quodlibet.fake.browsers",
                                    load_compiled=load_pyc)

    for browser in modules:
        try:
            browsers.extend(browser.browsers)
        except AttributeError:
            print_w("%r doesn't contain any browsers." % browser.__name__)

    def is_browser(Kind):
        return isinstance(Kind, type) and issubclass(Kind, Browser)
    browsers = filter(is_browser, browsers)

    if not browsers:
        raise SystemExit("No browsers found!")

    browsers.sort(key=lambda Kind: Kind.priority)

    try:
        default = get("SearchBar")
    except ValueError:
        raise SystemExit("Default browser not found!")
开发者ID:Tjorriemorrie,项目名称:quodlibet,代码行数:46,代码来源:__init__.py

示例15: init

def init():
    """Load/Import all formats.

    Before this is called loading a file and unpickling will not work.
    """

    global mimes, loaders, types

    MinVersions.MUTAGEN.check(mutagen.version)

    base = util.get_module_dir()
    load_pyc = util.is_windows() or util.is_osx()
    formats = load_dir_modules(base,
                               package=__package__,
                               load_compiled=load_pyc)

    module_names = []
    for format in formats:
        name = format.__name__

        for ext in format.extensions:
            loaders[ext] = format.loader

        types.update(format.types)

        if format.extensions:
            for type_ in format.types:
                mimes.update(type_.mimes)
            module_names.append(name.split(".")[-1])

        # Migrate pre-0.16 library, which was using an undocumented "feature".
        sys.modules[name.replace(".", "/")] = format
        # Migrate old layout
        if name.startswith("quodlibet."):
            sys.modules[name.split(".", 1)[1]] = format

    # This can be used for the quodlibet.desktop file
    desktop_mime_types = "MimeType=" + \
        ";".join(sorted({m.split(";")[0] for m in mimes})) + ";"
    print_d(desktop_mime_types)

    s = ", ".join(sorted(module_names))
    print_d("Supported formats: %s" % s)

    if not loaders:
        raise SystemExit("No formats found!")
开发者ID:LudoBike,项目名称:quodlibet,代码行数:46,代码来源:_misc.py


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