Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue #809: revision-date parsed wrong if >1 @ in path
If `bin/pyang` is given a path to a YANG file which contains more than one '@' character (e.g. if there's an '@' in a parent directory), the `re_filename` regexp will detect the revision-date as being everything from the first instances of the '@' char in the path, to the yang/tin suffix(es). This fails to match the expected 'YYYY-MM-DD' date format that the revision-date in the filename should take and `pyang` fails. This commit fixes `re_filename` regexp so that it disregards all characters in the filepath before the last directory separator (based on the value of `os.sep`) in the string.
- Loading branch information
Showing
3 changed files
with
22 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test: | ||
pyang -Werror project@2022-04-07/project@2022-04-07.yang |
13 changes: 13 additions & 0 deletions
13
test/test_issues/test_i809/project@2022-04-07/project@2022-04-07.yang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module project { | ||
yang-version 1; | ||
namespace "urn:at-char-in-path:project:1"; | ||
prefix p; | ||
|
||
description "'@' char in parent dir of file confuses the revision date parsing"; | ||
|
||
revision 2022-04-07; | ||
|
||
leaf foo { | ||
type string; | ||
} | ||
} |