- is not a valid identifier character in WiX Ids. So let's
normalize accordingly.
I discovered this issue after a subsequent change which introduces
a directory with a - in its name.
| Alphare | |
| pulkit |
| hg-reviewers |
normalize accordingly.
I discovered this issue after a subsequent change which introduces
a directory with a - in its name.
| No Linters Available |
| No Unit Test Coverage |
| Path | Packages | |||
|---|---|---|---|---|
| M | contrib/packaging/hgpackaging/wix.py (10 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| ecd78cd3a1eb | dc391cac0c8a | Gregory Szorc | Oct 5 2020, 1:17 AM |
| # Each directory is composed of a <DirectoryRef> pointing to its parent | # Each directory is composed of a <DirectoryRef> pointing to its parent | ||||
| # and defines child <Directory>'s and a <Component> with all the files. | # and defines child <Directory>'s and a <Component> with all the files. | ||||
| for dir_name, entries in sorted(manifest.items()): | for dir_name, entries in sorted(manifest.items()): | ||||
| # The directory id is derived from the path. But the root directory | # The directory id is derived from the path. But the root directory | ||||
| # is special. | # is special. | ||||
| if dir_name == '.': | if dir_name == '.': | ||||
| parent_directory_id = 'INSTALLDIR' | parent_directory_id = 'INSTALLDIR' | ||||
| else: | else: | ||||
| parent_directory_id = 'hg.dir.%s' % dir_name.replace('/', '.') | parent_directory_id = 'hg.dir.%s' % dir_name.replace( | ||||
| '/', '.' | |||||
| ).replace('-', '_') | |||||
| fragment = doc.createElement('Fragment') | fragment = doc.createElement('Fragment') | ||||
| directory_ref = doc.createElement('DirectoryRef') | directory_ref = doc.createElement('DirectoryRef') | ||||
| directory_ref.setAttribute('Id', parent_directory_id) | directory_ref.setAttribute('Id', parent_directory_id) | ||||
| # Add <Directory> entries for immediate children directories. | # Add <Directory> entries for immediate children directories. | ||||
| for possible_child in sorted(manifest.keys()): | for possible_child in sorted(manifest.keys()): | ||||
| if ( | if ( | ||||
| dir_name == '.' | dir_name == '.' | ||||
| and '/' not in possible_child | and '/' not in possible_child | ||||
| and possible_child != '.' | and possible_child != '.' | ||||
| ): | ): | ||||
| child_directory_id = 'hg.dir.%s' % possible_child | child_directory_id = ('hg.dir.%s' % possible_child).replace( | ||||
| '-', '_' | |||||
| ) | |||||
| name = possible_child | name = possible_child | ||||
| else: | else: | ||||
| if not possible_child.startswith('%s/' % dir_name): | if not possible_child.startswith('%s/' % dir_name): | ||||
| continue | continue | ||||
| name = possible_child[len(dir_name) + 1 :] | name = possible_child[len(dir_name) + 1 :] | ||||
| if '/' in name: | if '/' in name: | ||||
| continue | continue | ||||
| child_directory_id = 'hg.dir.%s' % possible_child.replace( | child_directory_id = 'hg.dir.%s' % possible_child.replace( | ||||
| '/', '.' | '/', '.' | ||||
| ) | ).replace('-', '_') | ||||
| directory = doc.createElement('Directory') | directory = doc.createElement('Directory') | ||||
| directory.setAttribute('Id', child_directory_id) | directory.setAttribute('Id', child_directory_id) | ||||
| directory.setAttribute('Name', name) | directory.setAttribute('Name', name) | ||||
| directory_ref.appendChild(directory) | directory_ref.appendChild(directory) | ||||
| # Add <Component>s for files in this directory. | # Add <Component>s for files in this directory. | ||||
| for rel, source_path in sorted(entries.items()): | for rel, source_path in sorted(entries.items()): | ||||