diff contrib/packaging/hgpackaging/wix.py @ 45644:439ce34d81e6

packaging: normalize - to _ in WiX Id values - 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. Differential Revision: https://phab.mercurial-scm.org/D9147
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 04 Oct 2020 22:17:52 -0700
parents 9ade217b550d
children d270b9b797a7
line wrap: on
line diff
--- a/contrib/packaging/hgpackaging/wix.py	Sat Oct 03 14:44:11 2020 -0700
+++ b/contrib/packaging/hgpackaging/wix.py	Sun Oct 04 22:17:52 2020 -0700
@@ -165,7 +165,9 @@
         if dir_name == '.':
             parent_directory_id = 'INSTALLDIR'
         else:
-            parent_directory_id = 'hg.dir.%s' % dir_name.replace('/', '.')
+            parent_directory_id = 'hg.dir.%s' % dir_name.replace(
+                '/', '.'
+            ).replace('-', '_')
 
         fragment = doc.createElement('Fragment')
         directory_ref = doc.createElement('DirectoryRef')
@@ -178,7 +180,9 @@
                 and '/' not in 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
             else:
                 if not possible_child.startswith('%s/' % dir_name):
@@ -189,7 +193,7 @@
 
                 child_directory_id = 'hg.dir.%s' % possible_child.replace(
                     '/', '.'
-                )
+                ).replace('-', '_')
 
             directory = doc.createElement('Directory')
             directory.setAttribute('Id', child_directory_id)