ó # yRc@sddlZddlZddlmZmZmZdefd„ƒYZdefd„ƒYZdefd„ƒYZ d e fd „ƒYZ dS( 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 „Z e 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(tselfR R R RRR((s9/usr/lib/python2.7/site-packages/javapackages/artifact.pyt__init__7s c Cs7djd|jd|jd|jd|jd|jƒS(Nu{gid}:{aid}:{ext}:{cls}:{ver}tgidtaidtexttclstver(tformatR R 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Ítd jd 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( RRR R R RRRtstr(Rt versionedRR#((s9/usr/lib/python2.7/site-packages/javapackages/artifact.pyt get_rpm_strJs(        tartifactcCsct|ƒ}xPdD]H}t||ƒrt||ƒrt||ƒ}t||ƒ|_qqW|S(sH Return XML Element node representation of the Artifact R R R 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.pyt get_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 R R RRRt*i˙˙˙˙sAll parts of artifact are emptysWildcard used in artifactsBackreference used in artifact(s artifactIdsgroupIds extensionsversions classifiers namespace(R0tFalsetretcompileR)tfindtmatchR( Rt allow_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 R R RRR(s artifactIdsgroupIds extensionsversions classifiers namespace(R R 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ƒ||!s