ok

Mini Shell

Direktori : /lib/python2.7/site-packages/javapackages/
Upload File :
Current File : //lib/python2.7/site-packages/javapackages/artifact.pyo

�
#
yRc@s�ddlZddlZddlmZmZmZdefd��YZdefd��YZdefd��YZ	d	e
fd
��YZdS(i����N(tElementt
SubElementttostringtArtifactExceptioncBseZRS((t__name__t
__module__(((s9/usr/lib/python2.7/site-packages/javapackages/artifact.pyR&stArtifactFormatExceptioncBseZRS((RR(((s9/usr/lib/python2.7/site-packages/javapackages/artifact.pyR)stArtifactValidationExceptioncBseZRS((RR(((s9/usr/lib/python2.7/site-packages/javapackages/artifact.pyR,stArtifactcBs�eZdZddddd�Zd�Zd�Zed�Zdd�Zdd�Z	e
e
e
d	�Zed
��Z
edd��Zedd��ZRS(
s�
    Simplified representation of Maven artifact for purpose of packaging

    Package consists mostly of simple properties and string formatting and
    loading functions to prevent code duplication elsewhere
    tcCs^|j�|_|j�|_|j�|_|j�|_|j�|_|j�|_dS(N(tstriptgroupIdt
artifactIdt	extensiont
classifiertversiont	namespace(tselfRRR
RRR((s9/usr/lib/python2.7/site-packages/javapackages/artifact.pyt__init__7scCs7djd|jd|jd|jd|jd|j�S(Nu{gid}:{aid}:{ext}:{cls}:{ver}tgidtaidtexttclstver(tformatRRR
RR(R((s9/usr/lib/python2.7/site-packages/javapackages/artifact.pyt__unicode__@s
			cCst|�jtj��S(N(tunicodetencodetsystgetfilesystemencoding(R((s9/usr/lib/python2.7/site-packages/javapackages/artifact.pyt__str__GscCsd}|jr|jd}ndjd|jd|j�}|jrb|djd|j�}n|jr�|js�|d}n|d	jd
|j�}n|r�|js�tdjdt|����n|d
jd|j�}n|js�|jr|d}ndjd|d|�S(s6Return representation of artifact as used in RPM dependencies

        versioned -- return artifact string including version

        Example outputs:
        mvn(commons-logging:commons-logging)
        mvn(commons-logging:commons-logging:1.2) # versioned
        mvn(commons-logging:commons-logging:war:)
        mvn(commons-logging:commons-logging:war:1.2) # versioned
        mvn(commons-logging:commons-logging:war:test-jar:)
        mvn(commons-logging:commons-logging:war:test-jar:1.3) # versioned
        maven31-mvn(commons-logging:commons-logging)
        tmvns-mvns{gid}:{aid}RRs:{ext}Rt:s:{clas}tclassCCannot create versioned string from artifact without version: {art}tarts:{ver}Rs{namespace}({mvnstr})Rtmvnstr(	RRRRR
RRRtstr(Rt	versionedRR#((s9/usr/lib/python2.7/site-packages/javapackages/artifact.pytget_rpm_strJs(				
	
tartifactcCsct|�}xPdD]H}t||�rt||�rt||�}t||�|_qqW|S(sH
        Return XML Element node representation of the Artifact
        RRR
RRR(s
artifactIdsgroupIds	extensionsversions
classifiers	namespace(RthasattrtgetattrRttext(Rtroottkeytitem((s9/usr/lib/python2.7/site-packages/javapackages/artifact.pytget_xml_elementss
cCs|j|�}t|dt�S(sL
        Return XML formatted string representation of the Artifact
        tpretty_print(R.RtTrue(RR+((s9/usr/lib/python2.7/site-packages/javapackages/artifact.pytget_xml_str�sc
Cs�t}t}t}tjd�}xnd
D]f}t||�}	|	sIq(n|	rXt}n|	jd�d	krvt}n|j|	�r(t}q(q(W|r�|r�td
��n|r�|r�td��n|r�|r�td��ntS(s�
        Function to validate current state of artifact with regards to
        wildcards, empty parts and backreference usage
        s@\d+RRR
RRRt*i����sAll parts of artifact are emptysWildcard used in artifactsBackreference used in artifact(s
artifactIdsgroupIds	extensionsversions
classifiers	namespace(R0tFalsetretcompileR)tfindtmatchR(
Rtallow_emptytallow_wildcardst
allow_backreft	all_emptyt
wildcard_usedtbackref_usedt
backref_reR,tval((s9/usr/lib/python2.7/site-packages/javapackages/artifact.pytvalidate�s,
		



cCsm||j|j|j|j|j|j�}x9dD]1}t||�s4t||t||��q4q4W|S(s�
        Merge two artifacts into one. Information missing in dominant artifact will
        be copied from recessive artifact. Returns new merged artifact
        RRR
RRR(s
artifactIdsgroupIds	extensionsversions
classifiers	namespace(RRR
RRRR)tsetattr(Rtdominantt	recessivetretR,((s9/usr/lib/python2.7/site-packages/javapackages/artifact.pytmerge_artifacts�s
 cCsidd6dd6dd6dd6dd6}xR|D]J}|jd|�}|d
k	r0|jd
k	r0|jj�||<q0q0W|ds�|dr�td��n|s�|jd	�}|d
k	r�|jj�}q�d}n||d|d|d|d|d|�S(s}
        Create Artifact from xml.etree.ElementTree.Element as contained
        within pom.xml or a dependency map.
        R	RRR
RRs./sIEmpty groupId or artifactId encountered. This is a bug, please report it!s./namespaceN(R6tNoneR*R
R(RtxmlnodeRtpartsR,tnode((s9/usr/lib/python2.7/site-packages/javapackages/artifact.pytfrom_xml_element�s&


	c	Cs�|jd�}t|�dkr<tdjd|���nt|�dkritdjd|���n|d}|d}t|�d	kr�|dnd
}t|�dkr�|dnd
}t|�dkr�|dnd
}|||||||�S(
s�
        Create Artifact from Maven-style definition

        The string should be in the format of:
           groupId:artifactId[:extension[:classifier]][:version]

        Where last part is always considered to be version unless empty
        R isHArtifact string '{mvnstr}' does not contain ':' character. Can not parseR#isBArtifact string '{mvnstr}' contains too many colons. Can not parseiiiR	ii����(tsplittlenRR(	RR#RttupRRR
RR((s9/usr/lib/python2.7/site-packages/javapackages/artifact.pytfrom_mvn_str�s


"""(RRt__doc__RRRR3R&R.R1R0R@tclassmethodRERJRN(((s9/usr/lib/python2.7/site-packages/javapackages/artifact.pyR/s		)
 (R4Rt
lxml.etreeRRRt	ExceptionRRRtobjectR(((s9/usr/lib/python2.7/site-packages/javapackages/artifact.pyt<module>!s

Zerion Mini Shell 1.0