Skip to content

Commit

Permalink
Added Path attribute support to Match nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
fireundubh committed Jun 23, 2021
1 parent c105cc3 commit cdc3b17
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pyro/PackageManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def _generate_include_paths(includes_node: etree.ElementBase, root_path: str, zi
attr_in: str = match_node.get(XmlAttributeName.IN).strip()
attr_no_recurse: bool = match_node.get(XmlAttributeName.NO_RECURSE) == 'True'
attr_exclude: str = match_node.get(XmlAttributeName.EXCLUDE).strip()
attr_path: str = match_node.get(XmlAttributeName.PATH).strip()

in_path: str = os.path.normpath(attr_in)

Expand All @@ -175,6 +176,7 @@ def _generate_include_paths(includes_node: etree.ElementBase, root_path: str, zi

yield from PackageManager._match(in_path, match_text,
exclude_pattern=attr_exclude,
user_path=attr_path,
no_recurse=attr_no_recurse)

def _fix_package_extension(self, package_name: str) -> str:
Expand Down
4 changes: 2 additions & 2 deletions pyro/PapyrusProject.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,10 @@ def _update_attributes(self, parent_node: etree.ElementBase) -> None:
elif tag in (XmlTagName.FOLDER, XmlTagName.INCLUDE, XmlTagName.MATCH):
if XmlAttributeName.NO_RECURSE not in node.attrib:
node.set(XmlAttributeName.NO_RECURSE, 'False')
if tag == XmlTagName.INCLUDE:
if tag in (XmlTagName.INCLUDE, XmlTagName.MATCH):
if XmlAttributeName.PATH not in node.attrib:
node.set(XmlAttributeName.PATH, '')
elif tag == XmlTagName.MATCH:
if tag == XmlTagName.MATCH:
if XmlAttributeName.IN not in node.attrib:
node.set(XmlAttributeName.IN, os.curdir)
if XmlAttributeName.EXCLUDE not in node.attrib:
Expand Down
1 change: 1 addition & 0 deletions pyro/PapyrusProject.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
<xs:extension base="recursablePath">
<xs:attribute name="In" type="xs:string" default=""/>
<xs:attribute name="Exclude" type="xs:string" default=""/>
<xs:attribute name="Path" type="xs:string" default=""/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
Expand Down

0 comments on commit cdc3b17

Please sign in to comment.