__init__.py revision 1292
49N/A# The contents of this file are subject to the terms of the 49N/A# Common Development and Distribution License (the "License"). 49N/A# You may not use this file except in compliance with the License. 49N/A# See the License for the specific language governing permissions 49N/A# and limitations under the License. 49N/A# When distributing Covered Code, include this CDDL HEADER in each 49N/A# If applicable, add the following below this CDDL HEADER, with the 49N/A# fields enclosed by brackets "[]" replaced with your own identifying 49N/A# information: Portions Copyright [yyyy] [name of copyright owner] 873N/A# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 49N/A# Use is subject to license terms. 49N/Apackage containing packaging action (file type) modules 49N/AThis package contains modules describing packaging actions, or file types. The 49N/Aactions are dynamically discovered, so that new modules can be placed in this 49N/Apackage directory and they'll just be picked up. The current package contents 49N/Acan be seen in the section "PACKAGE CONTENTS", below. 51N/AThis package has one data member: "types". This is a dictionary which maps the 51N/Aaction names to the classes that represent them. 51N/AThis package also has one function: "fromstr", which creates an action instance 51N/Abased on a str() representation of an action. 49N/A# All modules in this package (all python files except __init__.py with their 49N/A# extensions stripped off). 49N/A# A dictionary of all the types in this package, mapping to the classes that 49N/A # Pull the class objects out of nvlist, keeping only those that are 49N/A # actually defined in this package. 49N/A# Clean up after ourselves 873N/A """Base exception class for Action errors.""" 873N/A return _(
"unknown action type '%(type)s' in package " 873N/A "'%(fmri)s' in action '%(action)s'") % {
873N/A return _(
"unknown action type '%(type)s' in action " 873N/A return _(
"Malformed action in package '%(fmri)s' at " 873N/A "position: %(pos)d:\n %(action)s\n" 873N/A return _(
"Malformed action at position: %(pos)d:\n " 873N/A """Used to indicate that a file-related error occuring during action 873N/A """Used to indicate that attributes provided were invalid, or required 873N/A attributes were missing for an action.""" 873N/A return _(
"invalid action in package %(fmri)s: " 873N/A return _(
"invalid action, '%(action)s': %(error)s") % {
1292N/A """Create an attribute dict given a string w/ key=value pairs. 1292N/A Raises MalformedActionError if the attributes have syntactic problems. 873N/A """Create an action instance based on a str() representation of an 591N/A Raises UnknownActionError if the action type is unknown. 591N/A Raises MalformedActionError if the action has other syntactic problems. 279N/A """Create an action instance based on a sequence of "key=value" strings. 591N/A Raises MalformedActionError if the attribute strings are malformed. 305N/A # This is by far the common case-- an attribute with 305N/A # We're only here if the for: statement above throws a 591N/A # MalformedActionError. That can happen if split yields a 591N/A # single element, which is possible if e.g. an attribute lacks