Sh3ll
OdayForums


Server : Apache
System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64
User : nobody ( 99)
PHP Version : 8.1.23
Disable Function : NONE
Directory :  /lib/python2.7/site-packages/javapackages/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python2.7/site-packages/javapackages/xmvn_config.pyo
�
]|OVc@s�ddlZddlZddlZddlZddlmZddlZddlZddlj	Z
ddlmZmZm
Z
ddlmZdefd��YZdefd��YZdS(	i����N(tStringIO(tElementTreetElementt
SubElement(tArtifactValidationExceptiontXMvnConfigExceptioncBseZRS((t__name__t
__module__(((s</usr/lib/python2.7/site-packages/javapackages/xmvn_config.pyR.st
XMvnConfigcBs�eZdZejjdd�Zejjdd�ZdZd�Z	d�Z
d�Zdd	�Zd
�Z
d�Zddd�Zd
�Zd�Zd�Zd�Zd�Zed�Zd�ZRS(s0
    Class for modifying XMvn configuration
    s.xmvnsjavapackages-rule-indexsconfig.ds)http://fedorahosted.org/xmvn/CONFIG/0.6.0cCs�d|_ytjtjd�Wntk
r3nXy5ttj�� }t|j	��d|_
WdQXWn7tk
r�}|jtj
kr�d|_
q�|�nXdS(Ns�<?xml version='1.0' encoding='utf-8'?>
<configuration xmlns="http://fedorahosted.org/xmvn/CONFIG/0.6.0">
{content}
</configuration>
i�i(ttemplateXMLtostmakedirsRt
CONFIG_DIRtOSErrortopent
INDEX_PATHtinttreadtindextIOErrorterrnotENOENT(tselfRte((s</usr/lib/python2.7/site-packages/javapackages/xmvn_config.pyt__init__:s	
#cCsEttjd��-}|jt|j��|jd|_WdQXdS(Ntwi(RRRtwritetstrR(RR((s</usr/lib/python2.7/site-packages/javapackages/xmvn_config.pyt
__write_indexPscCs+djd|j�}tjjtj|�S(Ns#javapackages-config-{index:05d}.xmlR(tformatRR
tpathtjoinRR(Rtfname((s</usr/lib/python2.7/site-packages/javapackages/xmvn_config.pyt__get_current_configUstcCs^|j�t�}|j|jjd|��tj|j��}|jtj	d��|S(Ntcontents[XMvn configuration file generated by javapackages.xmvn_config  (part of javapackages-tools)(
t_XMvnConfig__write_indexRRR	RtETt
fromstringtgetvaluetappendtComment(RR#txmlbuftroot((s</usr/lib/python2.7/site-packages/javapackages/xmvn_config.pyt
__init_xmlZs
	c
CsNt�}t�}|j|�|j|dtdddddt�|j�S(Ntxml_declarationtencodingsutf-8tmethodtxmltpretty_print(RRt_setrootRtTrueR'(RtelemR*tet((s</usr/lib/python2.7/site-packages/javapackages/xmvn_config.pyt__prettify_elementfs		
cCs>|j|�}tj|dd��}|j|�WdQXdS(Nsw+sutf-8(t_XMvnConfig__prettify_elementtcodecsRR(RRR+txmlstrtfout((s</usr/lib/python2.7/site-packages/javapackages/xmvn_config.pyt__write_xmlrsc	Cs�|std��n|j�}|j�}t||�}t||�}|}|rit||�}nt|t�r�||_n=t|t�r�x+|D]}|j|�q�Wn
|j|�|j	||�dS(Ns#Provide content as keyword argument(
t	Exceptiont_XMvnConfig__get_current_configt_XMvnConfig__init_xmlRt
isinstancet
basestringttexttlistR(t_XMvnConfig__write_xml(	Rtlevel1tlevel2tlevel3R#tconfpathR+t
cont_levelR4((s</usr/lib/python2.7/site-packages/javapackages/xmvn_config.pyt__add_configxs 

cCs^tjd�}g|j|�D]}t|�^q}|rZtd�|j|�D��SdS(sI
        Return maximum number of backreference used in string s
        s@(\d+)css|]}t|�VqdS(N(R(t.0tx((s</usr/lib/python2.7/site-packages/javapackages/xmvn_config.pys	<genexpr>�si(tretcompiletfindallRtmax(Rtst
backref_reRKtbackref_nos((s</usr/lib/python2.7/site-packages/javapackages/xmvn_config.pyt__count_backreferences�s
(cCs=|jd�}|jd�}||kr9td��n|S(sC
        Return number of wildcard groups used in string s
        t{t}sWNumber of opening and closing parenthesis for groups of wildcard matching is different.(tcountR<(RRPtlefttright((s</usr/lib/python2.7/site-packages/javapackages/xmvn_config.pyt__count_wildcard_groups�s
c	Cs�|jdt�|j|j��}|jdd�}|g}td�}xm|D]e}|jdtdt�|j|j��}||kr�td��n|j|jdd��qSW|j|�|j	d	d
d|�dS(
s�
        Adds alias artifacts for given main artifact

        artifact -- main Artifact for which aliases are being provided
        aliases -- list of alternate Artifact representations
        t
allow_backrefR+tartifactGlobtaliasestallow_emptytallow_wildcardss8Number of backrefenreces is higher than wildcard groups.taliastartifactManagementtruleR#N(
tvalidatetFalset"_XMvnConfig__count_wildcard_groupstget_rpm_strtget_xml_elementRt!_XMvnConfig__count_backreferencesRR(t_XMvnConfig__add_config(	RtartifactR\twild_groupstmaintelemstaelemR_tbackrefs((s</usr/lib/python2.7/site-packages/javapackages/xmvn_config.pytadd_aliases�s	

c
Cs�|jdt�|j|j|j��}|jdd�}|g}td�}xP|D]H}|j|�}||kr�td��nt	|d�}	||	_
qYW|j|�|jddd	|�d
S(s�
        Change where on filesystem given artifact is installed

        artifact -- Artifact to be modified
        versions -- list of compat versions for given artifact
        RZR+R[tversionss8Number of backrefenreces is higher than wildcard groups.tversionR`RaR#N(
RbRcRdReRqRfRRgRRRAR(Rh(
RRiRpRjRkRltvelemRqRntve((s</usr/lib/python2.7/site-packages/javapackages/xmvn_config.pytadd_compat_versions�s	


c
Cs|jdt�|j|j��}|jdd�}|g}td�}g|D]}tjj|�sS|^qSs�t	d��nxP|D]H}|j
|�}||kr�td��nt|d�}	||	_
q�W|j|�|jdd	d
|�dS(s�
        Change where on filesystem given artifact is installed

        artifact -- Artifact to be modified
        paths -- list of paths for given artifact
        RZR+R[tfiless"At least one path must be relatives8Number of backrefenreces is higher than wildcard groups.tfileR`RaR#N(RbRcRdReRfRR
RtisabsRRgRRRAR(Rh(
RRitpathsRjRkRltfelemRRntpe((s</usr/lib/python2.7/site-packages/javapackages/xmvn_config.pytadd_file_mapping�s	+


c
Cs�|jdt�|j|j��}|jdd�}|j|�}||kratd��n|g}|r�td�}d|_|j	|�ntd�}	||	_|j	|	�|j
dd	d
|�dS(s�
        Change which package given artifact belongs to

        artifact -- Artifact to be modified
        package -- subpackage name where artifact belongs
        RZR+R[s8Number of backrefenreces is higher than wildcard groups.toptionalttruet
targetPackageR`RaR#N(RbRcRdReRfRgRRRAR(Rh(
RRitpackageR|RjRkRnRltoptttarget((s</usr/lib/python2.7/site-packages/javapackages/xmvn_config.pytadd_package_mapping�s			
cCs�|jd�}|j�}|j�}|}x|D]}t||�}q4WyLdj|�}tj|�}	|	j|_x|	D]}
|j|
�q�WWn#t	j
jk
r�td��nX|j
||�dS(s�
        Add custom configuration option

        optionstr -- XPath-like expression for specifying XMvn configuration
                     option location with '/' used as delimiter

                     example: buildSettings/compilerSource
        content -- XML content to be added to specified node. Can be just text, XML node or multiple nodes.

                   examples:
                   someText
                   <someNode>someText</someNode><someOtherNode/>
        t/s<root>{0}</root>s)content is not valid content for XML nodeN(tsplitR=R>RRR%R&RAR(tlxmltetreetXMLSyntaxErrorR<RC(Rt	optionstrR#t
node_namesRGR+tpartnodetinsertedtcontentRoottelement((s</usr/lib/python2.7/site-packages/javapackages/xmvn_config.pytadd_custom_options

N(RRt__doc__R
RRRRtXMLNSRR$R=R>R7RCtNoneRhRgRdRoRtR{RcR�R�(((s</usr/lib/python2.7/site-packages/javapackages/xmvn_config.pyR1s$						
				(R8R
RRLRtxml.dom.minidomR0R�t
lxml.etreeR�R%RRRtjavapackages.artifactRR<RtobjectR(((s</usr/lib/python2.7/site-packages/javapackages/xmvn_config.pyt<module>!s

ZeroDay Forums Mini