资源简介
直接从谷歌上下载下来的,需要的,不方便下载的,可以下载来用
代码片段和文件信息
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import logging
import urlparse
from sdk_update_common import Error
SOURCE_WHITELIST = [
‘http://localhost/‘ # For testing.
‘https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk‘
]
def IsSourceValid(url):
# E1101: Instance of ‘ParseResult‘ has no ‘scheme‘ member
# pylint: disable=E1101
given = urlparse.urlparse(url)
for allowed_url in SOURCE_WHITELIST:
allowed = urlparse.urlparse(allowed_url)
if (given.scheme == allowed.scheme and
given.hostname == allowed.hostname and
given.path.startswith(allowed.path)):
return True
return False
class Config(dict):
def __init__(self data=None):
dict.__init__(self)
if data:
self.update(data)
else:
self.sources = []
def LoadJson(self json_data):
try:
self.update(json.loads(json_data))
except Exception as e:
raise Error(‘Error reading json config:\n%s‘ % str(e))
def ToJson(self):
try:
return json.dumps(self sort_keys=False indent=2)
except Exception as e:
raise Error(‘Json encoding error writing config:\n%s‘ % e)
def __getattr__(self name):
if name in self:
return self[name]
else:
raise AttributeError(‘Config does not contain: %s‘ % name)
def __setattr__(self name value):
self[name] = value
def AddSource(self source):
if not IsSourceValid(source):
logging.warn(‘Only whitelisted sources are allowed. Ignoring \“%s\“.‘ % (
source))
return
if source in self.sources:
logging.info(‘Source \“%s\“ already in Config.‘ % (source))
return
self.sources.append(source)
def RemoveSource(self source):
if source not in self.sources:
logging.warn(‘Source \“%s\“ not in Config.‘ % (source))
return
self.sources.remove(source)
def RemoveAllSources(self):
if not self.sources:
logging.info(‘No sources to remove.‘)
return
self.sources = []
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 39269 2018-12-04 09:46 nacl_sdk.zip
文件 601 2015-02-10 10:02 nacl_sdk\naclsdk
文件 587 2015-02-10 10:02 nacl_sdk\naclsdk.bat
文件 567 2015-02-10 10:02 nacl_sdk\sdk_cache\naclsdk_manifest2.json
文件 4048 2015-02-10 10:02 nacl_sdk\sdk_tools\cacerts.txt
文件 431 2015-02-10 10:02 nacl_sdk\sdk_tools\command\command_common.py
文件 1162 2015-02-10 10:02 nacl_sdk\sdk_tools\command\info.py
文件 1736 2015-02-10 10:02 nacl_sdk\sdk_tools\command\list.py
文件 700 2015-02-10 10:02 nacl_sdk\sdk_tools\command\sources.py
文件 945 2015-02-10 10:02 nacl_sdk\sdk_tools\command\uninstall.py
文件 13911 2015-02-10 10:02 nacl_sdk\sdk_tools\command\update.py
文件 210 2015-02-10 10:02 nacl_sdk\sdk_tools\command\__init__.py
文件 2128 2015-02-10 10:02 nacl_sdk\sdk_tools\config.py
文件 13554 2015-02-10 10:02 nacl_sdk\sdk_tools\cygtar.py
文件 2697 2015-02-10 10:02 nacl_sdk\sdk_tools\download.py
文件 1484 2015-02-10 10:02 nacl_sdk\sdk_tools\LICENSE
文件 19959 2015-02-10 10:02 nacl_sdk\sdk_tools\manifest_util.py
文件 4382 2015-02-10 10:02 nacl_sdk\sdk_tools\sdk_update.py
文件 3249 2015-02-10 10:02 nacl_sdk\sdk_tools\sdk_update_common.py
文件 12425 2015-02-10 10:02 nacl_sdk\sdk_tools\sdk_update_main.py
文件 1222 2015-02-10 10:02 nacl_sdk\sdk_tools\third_party\fancy_urllib\README.chromium
文件 16699 2015-02-10 10:02 nacl_sdk\sdk_tools\third_party\fancy_urllib\__init__.py
文件 205 2015-02-10 10:02 nacl_sdk\sdk_tools\third_party\__init__.py
文件 191 2015-02-10 10:02 nacl_sdk\sdk_tools\__init__.py
- 上一篇:基于51单片机的电子秤设计
- 下一篇:微赞-超级任务1.3.3
评论
共有 条评论