check in a copy of the arm-pack-manager index and use it

pull/3067/head
Jimmy Brisson 2016-10-18 13:56:17 -05:00
parent 7bcc63b202
commit 167ed2bc12
4 changed files with 10 additions and 7 deletions

View File

@ -16,6 +16,10 @@ from zipfile import ZipFile
RootPackURL = "http://www.keil.com/pack/index.idx" RootPackURL = "http://www.keil.com/pack/index.idx"
LocalPackDir = dirname(__file__)
LocalPackIndex = join(LocalPackDir, "index.json")
LocalPackAliases = join(LocalPackDir, "aliases.json")
protocol_matcher = compile("\w*://") protocol_matcher = compile("\w*://")
def strip_protocol(url) : def strip_protocol(url) :
@ -339,7 +343,8 @@ class Cache () :
with open(join(save_data_path('arm-pack-manager'), "index.json")) as i : with open(join(save_data_path('arm-pack-manager'), "index.json")) as i :
self._index = load(i) self._index = load(i)
except IOError : except IOError :
self.generate_index() with open(LocalPackIndex) as i :
self._index = load(i)
return self._index return self._index
@property @property
def aliases(self) : def aliases(self) :
@ -369,7 +374,8 @@ class Cache () :
with open(join(save_data_path('arm-pack-manager'), "aliases.json")) as i : with open(join(save_data_path('arm-pack-manager'), "aliases.json")) as i :
self._aliases = load(i) self._aliases = load(i)
except IOError : except IOError :
self.generate_aliases() with open(LocalPackAliases) as i :
self._aliases = load(i)
return self._aliases return self._aliases
def cache_everything(self) : def cache_everything(self) :

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6,8 +6,6 @@ import ntpath
import re import re
import json import json
from xdg.BaseDirectory import save_data_path
from tools.arm_pack_manager import Cache from tools.arm_pack_manager import Cache
from tools.targets import TARGET_MAP from tools.targets import TARGET_MAP
from tools.export.exporters import Exporter, TargetNotSupportedException from tools.export.exporters import Exporter, TargetNotSupportedException
@ -34,9 +32,6 @@ class DeviceCMSIS():
Encapsulates target information retrieved by arm-pack-manager""" Encapsulates target information retrieved by arm-pack-manager"""
def __init__(self, target): def __init__(self, target):
cache = Cache(True, False) cache = Cache(True, False)
data_path = join(save_data_path('arm-pack-manager'), "index.json")
if not exists(data_path) or not self.check_version(data_path):
cache.cache_descriptors()
t = TARGET_MAP[target] t = TARGET_MAP[target]
self.core = t.core self.core = t.core