本文整理汇总了Python中softwarecenter.distro.get_distro函数的典型用法代码示例。如果您正苦于以下问题:Python get_distro函数的具体用法?Python get_distro怎么用?Python get_distro使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_distro函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, repo):
if repo:
repo_id = repo.get_property("repo-id")
if repo_id.endswith("-source"):
repo_id = repo_id[: -len("-source")]
self.component = "source"
elif repo_id.endswith("-debuginfo"):
repo_id = repo_id[: -len("-debuginfo")]
self.component = "debuginfo"
else:
self.component = "main"
if repo_id == "updates":
self.origin = get_distro().get_distro_channel_name()
self.archive = "stable"
elif repo_id == "updates-testing":
self.origin = get_distro().get_distro_channel_name()
self.archive = "testing"
elif repo_id.endswith("-updates-testing"):
self.origin = repo_id[: -len("-updates-testing")]
self.archive = "testing"
else:
self.origin = repo_id
self.archive = "stable"
self.trusted = True
self.label = repo.get_property("description")
else:
self.origin = "unknown"
self.archive = "unknown"
self.trusted = False
self.label = _("Unknown repository")
self.component = "main"
self.site = ""
开发者ID:pombredanne,项目名称:AppStream,代码行数:34,代码来源:packagekit.py
示例2: __init__
def __init__(self, repo):
if repo:
repo_id = repo.get_property('repo-id')
if repo_id.endswith('-source'):
repo_id = repo_id[:-len('-source')]
self.component = 'source'
elif repo_id.endswith('-debuginfo'):
repo_id = repo_id[:-len('-debuginfo')]
self.component = 'debuginfo'
else:
self.component = 'main'
if repo_id == 'updates':
self.origin = get_distro().get_distro_channel_name()
self.archive = 'stable'
elif repo_id == 'updates-testing':
self.origin = get_distro().get_distro_channel_name()
self.archive = 'testing'
elif repo_id.endswith('-updates-testing'):
self.origin = repo_id[:-len('-updates-testing')]
self.archive = 'testing'
else:
self.origin = repo_id
self.archive = 'stable'
self.trusted = True
self.label = repo.get_property('description')
else:
self.origin = 'unknown'
self.archive = 'unknown'
self.trusted = False
self.label = _("Unknown repository")
self.component = 'main'
self.site = ''
开发者ID:feiying,项目名称:AppStream,代码行数:34,代码来源:packagekit.py
示例3: test_new_no_sort_info_yet
def test_new_no_sort_info_yet(self):
# ensure that we don't show a empty "whats new" category
# see LP: #865985
from softwarecenter.testutils import get_test_db
db = get_test_db()
cache = db._aptcache
# simulate a fresh install with no catalogedtime info
del db._axi_values["catalogedtime"]
from softwarecenter.testutils import get_test_gtk3_icon_cache
icons = get_test_gtk3_icon_cache()
from softwarecenter.db.appfilter import AppFilter
apps_filter = AppFilter(db, cache)
from softwarecenter.distro import get_distro
from softwarecenter.ui.gtk3.views.catview_gtk import LobbyViewGtk
view = LobbyViewGtk(softwarecenter.paths.datadir,
softwarecenter.paths.APP_INSTALL_PATH,
cache, db, icons, get_distro(), apps_filter)
view.show()
# gui
win = Gtk.Window()
self.addCleanup(win.destroy)
win.set_size_request(800, 400)
scroll = Gtk.ScrolledWindow()
scroll.add(view)
scroll.show()
win.add(scroll)
win.show()
# test visibility
do_events()
self.assertFalse(view.whats_new_frame.get_property("visible"))
开发者ID:fossasia,项目名称:x-mario-center,代码行数:35,代码来源:test_catview.py
示例4: __init__
def __init__(self, datadir, db, icons):
gtk.TreeStore.__init__(self, AnimatedImage, str, int, gobject.TYPE_PYOBJECT)
self.icons = icons
self.datadir = datadir
self.backend = get_install_backend()
self.backend.connect("transactions-changed", self.on_transactions_changed)
self.backend.connect("channels-changed", self.on_channels_changed)
self.db = db
self.distro = get_distro()
# pending transactions
self._pending = 0
# setup the normal stuff
available_icon = self._get_icon("softwarecenter")
self.available_iter = self.append(None, [available_icon, _("Get Software"), self.ACTION_ITEM_AVAILABLE, None])
# do initial channel list update
self._update_channel_list()
icon = AnimatedImage(self.icons.load_icon("computer", self.ICON_SIZE, 0))
installed_iter = self.append(None, [icon, _("Installed Software"), self.ACTION_ITEM_INSTALLED, None])
icon = AnimatedImage(None)
self.append(None, [icon, "<span size='1'> </span>", self.ACTION_ITEM_SEPARATOR_1, None])
# kick off a background check for changes that may have been made
# in the channels list
glib.timeout_add(300, lambda: self._check_for_channel_updates(self.channels))
开发者ID:guadalinex-archive,项目名称:guadalinex-v8,代码行数:26,代码来源:viewswitcher.py
示例5: component
def component(self):
"""
get the component (main, universe, ..)
this uses the data from apt, if there is none it uses the
data from the app-install-data files
"""
# try apt first
if self._pkg:
for origin in self._pkg.candidate.origins:
if (origin.origin == get_distro().get_distro_channel_name() and
origin.trusted and origin.component):
return origin.component
# then xapian
elif self._doc:
comp = self._doc.get_value(XapianValues.ARCHIVE_SECTION)
return comp
# then apturl requests
else:
section_matches = re.findall(r'section=([a-z]+)',
self._app.request)
if section_matches:
valid_section_matches = []
for section_match in section_matches:
if (self._unavailable_component(
component_to_check=section_match) and
valid_section_matches.count(section_match) == 0):
valid_section_matches.append(section_match)
if valid_section_matches:
return ('&').join(valid_section_matches)
开发者ID:feiying,项目名称:AppStream,代码行数:30,代码来源:application.py
示例6: __init__
def __init__(self, channel_name, channel_origin, channel_component,
source_entry=None, installed_only=False,
channel_icon=None, channel_query=None,
channel_sort_mode=SortMethods.BY_ALPHABET):
"""
configure the software channel object based on channel name,
origin, and component (the latter for detecting the partner
channel)
"""
self._channel_name = channel_name
self._channel_origin = channel_origin
self._channel_component = channel_component
self._channel_color = None
self._channel_view_id = None
self.installed_only = installed_only
self._channel_sort_mode = channel_sort_mode
# distro specific stuff
self.distro = get_distro()
# configure the channel
self._channel_display_name = self._get_display_name_for_channel(channel_name, channel_component)
if channel_icon is None:
self._channel_icon = self._get_icon_for_channel(channel_name, channel_origin, channel_component)
else:
self._channel_icon = channel_icon
if channel_query is None:
self._channel_query = self._get_channel_query_for_channel(channel_name, channel_origin, channel_component)
else:
self._channel_query = channel_query
# a sources.list entry attached to the channel (this is currently
# only used for not-yet-enabled channels)
self._source_entry = source_entry
# when the channel needs to be added to the systems sources.list
self.needs_adding = False
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:33,代码来源:channel.py
示例7: __init__
def __init__(self, db, doc=None, application=None):
""" Create a new AppDetails object. It can be created from
a xapian.Document or from a db.application.Application object
"""
GObject.GObject.__init__(self)
if not doc and not application:
raise ValueError("Need either document or application")
self._db = db
self._db.connect("reopen", self._on_db_reopen)
self._cache = self._db._aptcache
self._distro = get_distro()
self._history = None
# import here (intead of global) to avoid dbus dependency
# in update-software-center (that imports application, but
# never uses AppDetails) LP: #620011
from softwarecenter.backend import get_install_backend
self._backend = get_install_backend()
# FIXME: why two error states ?
self._error = None
self._error_not_found = None
self._screenshot_list = None
# load application
self._app = application
if doc:
self._app = Application(self._db.get_appname(doc),
self._db.get_pkgname(doc),
"")
# sustitute for apturl
if self._app.request:
self._app.request = self._app.request.replace(
"$distro", self._distro.get_codename())
# load pkg cache
self._pkg = None
if (self._app.pkgname in self._cache and
self._cache[self._app.pkgname].candidate):
self._pkg = self._cache[self._app.pkgname]
# load xapian document
self._doc = doc
if not self._doc:
try:
self._doc = self._db.get_xapian_document(
self._app.appname, self._app.pkgname)
except IndexError:
# if there is no document and no apturl request,
# set error state
debfile_matches = re.findall(r'/', self._app.request)
channel_matches = re.findall(r'channel=[a-z,-]*',
self._app.request)
section_matches = re.findall(r'section=[a-z]*',
self._app.request)
if (not self._pkg and
not debfile_matches and
not channel_matches and
not section_matches):
self._error = _("Not found")
self._error_not_found = utf8(_(u"There isn\u2019t a software package called \u201c%s\u201D in your current software sources.")) % utf8(self.pkgname)
开发者ID:armikhael,项目名称:software-center,代码行数:60,代码来源:application.py
示例8: test_ping
def test_ping(host=None):
global NETWORK_STATE
import subprocess
# ping the screenshots provider
from softwarecenter.distro import get_distro
distro = get_distro()
host = urlparse(distro.SCREENSHOT_LARGE_URL)[1]
msg = ("Attempting one time ping of %s to test if internet "
"connectivity exists." % host)
logging.info(msg)
ping = subprocess.Popen(["ping", "-c", "1", host],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, error = ping.communicate()
res = ping.wait()
if res != 0:
NETWORK_STATE = NetState.NM_STATE_DISCONNECTED
msg = "Could not detect an internet connection\n%s" % error
else:
NETWORK_STATE = NetState.NM_STATE_CONNECTED_GLOBAL
msg = "Internet connection available!\n%s" % out
__WATCHER__.emit("changed", NETWORK_STATE)
logging.info("ping output: '%s'" % msg)
return NETWORK_STATE
开发者ID:pombredanne,项目名称:shop,代码行数:28,代码来源:netstatus.py
示例9: __init__
def __init__(self, db, cache):
self.distro = get_distro()
self.db = db
self.cache = cache
self.supported_only = False
self.installed_only = False
self.not_installed_only = False
self.only_packages_without_applications = False
开发者ID:guadalinex-archive,项目名称:guadalinex-v8,代码行数:8,代码来源:appview.py
示例10: __init__
def __init__(self):
super(PackagekitInfo, self).__init__()
self.client = packagekit.Client()
self.client.set_locale(make_locale_string())
self._cache = {} # temporary hack for decent testing
self._notfound_cache = []
self._repocache = {}
self.distro = get_distro()
开发者ID:pombredanne,项目名称:shop,代码行数:8,代码来源:packagekit.py
示例11: __init__
def __init__(self, db, backend, icons):
GObject.GObject.__init__(self)
self._globalise_instance()
self.db = db
self.backend = backend
self.distro = get_distro()
self.datadir = softwarecenter.paths.datadir
self.icons = icons
开发者ID:armikhael,项目名称:software-center,代码行数:8,代码来源:appmanager.py
示例12: test_distro_functions
def test_distro_functions(self):
distro = get_distro()
codename = distro.get_codename()
self.assertNotEqual(codename, None)
myname = distro.get_app_name()
self.assertTrue(len(myname) > 0)
arch = distro.get_architecture()
self.assertNotEqual(arch, None)
开发者ID:cs2c,项目名称:AppStream,代码行数:8,代码来源:test_distro.py
示例13: update_debline
def update_debline(cls, debline):
# Be careful to handle deblines with pockets.
source_entry = SourceEntry(debline)
distro_pocket = source_entry.dist.split('-')
distro_pocket[0] = get_distro().get_codename()
source_entry.dist = "-".join(distro_pocket)
return unicode(source_entry)
开发者ID:pombredanne,项目名称:shop,代码行数:8,代码来源:update.py
示例14: index
def index(self, document, pkg):
"""
Update the document with the information from this data source.
document is the document to update
pkg is the python-apt Package object for this package
"""
ver = pkg.candidate
# if there is no version or the AppName custom key is not
# found we can skip the pkg
if ver is None or not CustomKeys.APPNAME in ver.record:
return
# we want to index the following custom fields:
# XB-AppName,
# XB-Icon,
# XB-Screenshot-Url,
# XB-Thumbnail-Url,
# XB-Category
if CustomKeys.APPNAME in ver.record:
name = ver.record[CustomKeys.APPNAME]
self.indexer.set_document(document)
# add s-c values/terms for the name
document.add_term("AA"+name)
document.add_value(XapianValues.APPNAME, name)
for t in get_pkgname_terms(pkg.name):
document.add_term(t)
self.indexer.index_text_without_positions(
name, WEIGHT_DESKTOP_NAME)
# we pretend to be an application
document.add_term("AT" + "application")
# and we inject a custom component value to indicate "independent"
document.add_value(XapianValues.ARCHIVE_SECTION, "independent")
if CustomKeys.ICON in ver.record:
icon = ver.record[CustomKeys.ICON]
document.add_value(XapianValues.ICON, icon)
# calculate the url and add it (but only if there actually is
# a url)
try:
distro = get_distro()
if distro:
base_uri = ver.uri
# new python-apt returns None instead of StopIteration
if base_uri:
url = distro.get_downloadable_icon_url(base_uri, icon)
document.add_value(XapianValues.ICON_URL, url)
except StopIteration:
pass
if CustomKeys.SCREENSHOT_URLS in ver.record:
screenshot_url = ver.record[CustomKeys.SCREENSHOT_URLS]
document.add_value(XapianValues.SCREENSHOT_URLS, screenshot_url)
if CustomKeys.THUMBNAIL_URL in ver.record:
url = ver.record[CustomKeys.THUMBNAIL_URL]
document.add_value(XapianValues.THUMBNAIL_URL, url)
if CustomKeys.CATEGORY in ver.record:
categories_str = ver.record[CustomKeys.CATEGORY]
for cat in categories_str.split(";"):
if cat:
document.add_term("AC" + cat.lower())
开发者ID:pombredanne,项目名称:shop,代码行数:58,代码来源:software_center.py
示例15: setUp
def setUp(self):
from softwarecenter.backend import zeitgeist_logger
if not zeitgeist_logger.HAVE_MODULE:
self.skipTest("Zeitgeist module missing, impossible to test")
from zeitgeist import datamodel
self.distro = get_distro()
self.logger = ZeitgeistLogger(self.distro)
self.datamodel = datamodel
开发者ID:pombredanne,项目名称:shop,代码行数:9,代码来源:test_zeitgeist_logger.py
示例16: __init__
def __init__(self, db, cache):
xapian.MatchDecider.__init__(self)
self.distro = get_distro()
self.db = db
self.cache = cache
self.available_only = False
self.supported_only = global_filter.supported_only
self.installed_only = False
self.not_installed_only = False
self.restricted_list = False
开发者ID:thnguyn2,项目名称:ECE_527_MP,代码行数:10,代码来源:appfilter.py
示例17: __init__
def __init__(self, cache, db, distro, icons, datadir):
# parent
SoftwarePane.__init__(self, cache, db, distro, icons, datadir, show_ratings=False)
self.channel = None
self.apps_filter = None
self.search_terms = ""
self.current_appview_selection = None
self.distro = get_distro()
# UI
self._build_ui()
开发者ID:guadalinex-archive,项目名称:guadalinex-v8,代码行数:10,代码来源:channelpane.py
示例18: test_regression_lp1041004
def test_regression_lp1041004(self):
from softwarecenter.ui.gtk3.views import appdetailsview
db = get_test_db()
cache = get_test_pkg_info()
icons = get_test_gtk3_icon_cache()
distro = get_distro()
view = appdetailsview.AppDetailsView(db, distro, icons, cache)
cache.emit("query-total-size-on-install-done", "apt", 10, 10)
do_events_with_sleep()
self.assertEqual(view.totalsize_info.value_label.get_text(), "")
开发者ID:pombredanne,项目名称:shop,代码行数:10,代码来源:test_appdetailsview.py
示例19: __init__
def __init__(self, cache, db, distro, icons, datadir):
# parent
SoftwarePane.__init__(self, cache, db, distro, icons, datadir,
show_ratings=False)
self.channel = None
self.apps_filter = None
self.apps_search_term = ""
self.current_appview_selection = None
self.distro = get_distro()
self.pane_name = _("Software Channels")
开发者ID:cs2c,项目名称:AppStream,代码行数:10,代码来源:unused__channelpane.py
示例20: _apply_exceptions
def _apply_exceptions(self):
# for items from the agent, we use the full-size screenshot for
# the thumbnail and scale it for display, this is done because
# we no longer keep thumbnail versions of screenshots on the server
if (hasattr(self.sca_application, "screenshot_url") and
not hasattr(self.sca_application, "thumbnail_url")):
self.sca_application.thumbnail_url = \
self.sca_application.screenshot_url
if hasattr(self.sca_application, "description"):
comment, desc = self.sca_application.description.split("\n", 1)
self.sca_application.comment = comment.strip()
self.sca_application.description = desc.strip()
# debtags is send as a list, but we need it as a comma separated string
debtags = getattr(self.sca_application, "debtags", [])
self.sca_application.tags = ",".join(debtags)
# we only support a single video currently :/
urls = getattr(self.sca_application, "video_embedded_html_urls", None)
if urls:
self.sca_application.video_embedded_html_url = urls[0]
else:
self.sca_application.video_embedded_html_url = None
# XXX 2012-01-16 bug=917109
# We can remove these work-arounds once the above bug is fixed on
# the server. Until then, we fake a channel here and empty category
# to make the parser happy. Note: available_apps api call includes
# these already, it's just the apps with subscriptions_for_me which
# don't currently.
self.sca_application.channel = \
AVAILABLE_FOR_PURCHASE_MAGIC_CHANNEL_NAME
if not hasattr(self.sca_application, 'categories'):
self.sca_application.categories = ""
# detect if its for the partner channel and set the channel
# attribute appropriately so that the channel-adding magic works
if hasattr(self.sca_application, "archive_root"):
u = urlparse(self.sca_application.archive_root)
if u.scheme == "http" and u.netloc == "archive.canonical.com":
distroseries = get_distro().get_codename()
self.sca_application.channel = "%s-partner" % distroseries
if u.scheme == "http" and u.netloc == "extras.ubuntu.com":
self.sca_application.channel = "ubuntu-extras"
# support multiple screenshots
if hasattr(self.sca_application, "screenshot_urls"):
# ensure to html-quote "," as this is also our separator
s = ",".join([url.replace(",", "%2C")
for url in self.sca_application.screenshot_urls])
self.sca_application.screenshot_url = s
keywords = getattr(self.sca_application, 'keywords', self.NOT_DEFINED)
if keywords is self.NOT_DEFINED:
self.sca_application.keywords = ''
开发者ID:pombredanne,项目名称:shop,代码行数:55,代码来源:update.py
注:本文中的softwarecenter.distro.get_distro函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论