Command Line Interface pack-manager

A Handy little utility for keeping your cache of pack files up to date.

usage: pack-manager [-h] {cache,find-part,dump-parts,cache-part} ...
Sub-commands:
cache

Cache a group of PACK or PDSC files

usage: pack-manager cache [-h] [-e] [-d] [-b] [-v] [-vv] [--no-timeouts]
                          [--and] [--or] [--union] [--intersection]
                          [matches [matches ...]]
Positional arguments:
matches a bunch of things to search for in part names
Options:
-e=False, --everything=False
 download everything possible
-d=False, --descriptors=False
 download all descriptors
-b=False, --batch=False
 don’t ask for user input and assume download all
-v=False, --verbose=False
 Verbose diagnostic output
-vv=False, --very_verbose=False
 Very verbose diagnostic output
--no-timeouts=False
 Remove all timeouts and try to download unconditionally
--and=False combine search terms as if with an and
--or=True combine search terms as if with an or
--union=True combine search terms as if with a set union
--intersection=False
 combine search terms as if with a set intersection
find-part

Find a Part and it’s description within the cache

usage: pack-manager find-part [-h] [-l] [-v] [-vv] [--no-timeouts] [--and]
                              [--or] [--union] [--intersection]
                              matches [matches ...]
Positional arguments:
matches words to match to processors
Options:
-l=False, --long=False
 print out part details with part
-v=False, --verbose=False
 Verbose diagnostic output
-vv=False, --very_verbose=False
 Very verbose diagnostic output
--no-timeouts=False
 Remove all timeouts and try to download unconditionally
--and=False combine search terms as if with an and
--or=True combine search terms as if with an or
--union=True combine search terms as if with a set union
--intersection=False
 combine search terms as if with a set intersection
dump-parts

Create a directory with an index.json describing the part and all of their associated flashing algorithms.

usage: pack-manager dump-parts [-h] [-v] [-vv] [--no-timeouts] [--and] [--or]
                               [--union] [--intersection]
                               out parts [parts ...]
Positional arguments:
out directory to dump to
parts parts to dump
Options:
-v=False, --verbose=False
 Verbose diagnostic output
-vv=False, --very_verbose=False
 Very verbose diagnostic output
--no-timeouts=False
 Remove all timeouts and try to download unconditionally
--and=False combine search terms as if with an and
--or=True combine search terms as if with an or
--union=True combine search terms as if with a set union
--intersection=False
 combine search terms as if with a set intersection
cache-part

Cache PACK files associated with the parts matching the provided words

usage: pack-manager cache-part [-h] [-v] [-vv] [--no-timeouts] [--and] [--or]
                               [--union] [--intersection]
                               matches [matches ...]
Positional arguments:
matches words to match to devices
Options:
-v=False, --verbose=False
 Verbose diagnostic output
-vv=False, --very_verbose=False
 Very verbose diagnostic output
--no-timeouts=False
 Remove all timeouts and try to download unconditionally
--and=False combine search terms as if with an and
--or=True combine search terms as if with an or
--union=True combine search terms as if with a set union
--intersection=False
 combine search terms as if with a set intersection

Python Classes

class ArmPackManager.Cache(silent, no_timeouts)[source]

The Cache object is the only relevant API object at the moment

Constructing the Cache object does not imply any caching. A user of the API must explicitly call caching functions.

Parameters:
  • silent (bool) – A boolean that, when True, significantly reduces the printing of this Object
  • no_timeouts (bool) – A boolean that, when True, disables the default connection timeout and low speed timeout for downloading things.
cache_and_parse(url)[source]

A low level shortcut that Caches and Parses a PDSC file.

Parameters:url (str) – The URL of the PDSC file.
Returns:A parsed representation of the PDSC file.
Return type:BeautifulSoup
cache_descriptor_list(list)[source]

Cache a list of PDSC files.

Parameters:list ([str]) – URLs of PDSC files to cache.
cache_descriptors()[source]

Cache every PDSC file known.

Generates an index afterwards.

Note

This process may use 11MB of drive space and take upwards of 1 minute.

cache_everything()[source]

Cache every PACK and PDSC file known.

Generates an index afterwards.

Note

This process may use 4GB of drive space and take upwards of 10 minutes to complete.

cache_file(curl, url)[source]

Low level interface to caching a single file.

Parameters:
  • curl (curl.Curl) – The user is responsible for providing a curl.Curl object as the curl parameter.
  • url (str) – The URL to cache.
Return type:

None

cache_pack_list(list)[source]

Cache a list of PACK files, referenced by their PDSC URL

Parameters:list ([str]) – URLs of PDSC files to cache.
get_flash_algorthim_binary(device_name)[source]

Retrieve the flash algorithm file for a particular part.

Assumes that both the PDSC and the PACK file associated with that part are in the cache.

Parameters:device_name (str) – The exact name of a device
Returns:A file-like object that, when read, is the ELF file that describes the flashing algorithm
Return type:ZipExtFile
get_svd_file(device_name)[source]

Retrieve the flash algorithm file for a particular part.

Assumes that both the PDSC and the PACK file associated with that part are in the cache.

Parameters:device_name (str) – The exact name of a device
Returns:A file-like object that, when read, is the ELF file that describes the flashing algorithm
Return type:ZipExtFile
get_urls()[source]

Extract the URLs of all know PDSC files.

Will pull the index from the internet if it is not cached.

Returns:A list of all PDSC URLs
Return type:[str]
index

An index of most of the important data in all cached PDSC files.

Example:
>>> from ArmPackManager import Cache
>>> a = Cache()
>>> a.index["LPC1768"]
{u'algorithm': {u'RAMsize': u'0x0FE0',
        u'RAMstart': u'0x10000000',
        u'name': u'Flash/LPC_IAP_512.FLM',
        u'size': u'0x80000',
        u'start': u'0x00000000'},
 u'compile': [u'Device/Include/LPC17xx.h', u'LPC175x_6x'],
 u'debug': u'SVD/LPC176x5x.svd',
 u'pdsc_file': u'http://www.keil.com/pack/Keil.LPC1700_DFP.pdsc',
 u'memory': {u'IRAM1': {u'size': u'0x8000', u'start': u'0x10000000'},
             u'IRAM2': {u'size': u'0x8000', u'start': u'0x2007C000'},
             u'IROM1': {u'size': u'0x80000', u'start': u'0x00000000'}}}
pack_from_cache(url)[source]

Low level inteface for extracting a PACK file from the cache.

Assumes that the file specified is a PACK file and is in the cache.

Parameters:url (str) – The URL of a PACK file.
Returns:A parsed representation of the PACK file.
Return type:ZipFile
pdsc_from_cache(url)[source]

Low level inteface for extracting a PDSC file from the cache.

Assumes that the file specified is a PDSC file and is in the cache.

Parameters:url (str) – The URL of a PDSC file.
Returns:A parsed representation of the PDSC file.
Return type:BeautifulSoup
pdsc_to_pack(url)[source]

Find the URL of the specified pack file described by a PDSC.

The PDSC is assumed to be cached and is looked up in the cache by its URL.

Parameters:url (str) – The url used to look up the PDSC.
Returns:The url of the PACK file.
Return type:str