diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2021-02-28 13:28:37 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-02-28 13:30:00 +0200 |
commit | 8d6c12de41c037a5b26840bf227757ccb8a2342e (patch) | |
tree | c2e5a49e357e95ce2bd06d37f338963d298d123b | |
parent | 704dcf5ebdda481779c982d31533b36f75046c3b (diff) | |
download | meson-msifix.zip meson-msifix.tar.gz meson-msifix.tar.bz2 |
Require Windows 10 or newer for the MSI package. [skip ci]msifix
-rw-r--r-- | packaging/createmsi.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/packaging/createmsi.py b/packaging/createmsi.py index e7c81bb..9ecf109 100644 --- a/packaging/createmsi.py +++ b/packaging/createmsi.py @@ -31,6 +31,9 @@ import xml.etree.ElementTree as ET sys.path.append(os.getcwd()) from mesonbuild import coredata +# Elementtree does not support CDATA. So hack it. +WINVER_CHECK = '<![CDATA[Installed OR (VersionNT >= 1000)]]>' + def gen_guid(): ''' Generate guid @@ -193,6 +196,8 @@ class PackageGenerator: 'Codepage': '1252', 'Version': self.version, }) + condition = ET.SubElement(product, 'Condition', {'Message': 'This application is only supported on Windows Vista, Windows Server 2008, or higher.'}) + condition.text = 'X'*len(WINVER_CHECK) package = ET.SubElement(product, 'Package', { 'Id': '*', @@ -271,6 +276,12 @@ class PackageGenerator: doc = xml.dom.minidom.parse(self.main_xml) with open(self.main_xml, 'w') as open_file: open_file.write(doc.toprettyxml()) + # One last fix, add CDATA. + with open(self.main_xml, 'r') as open_file: + data = open_file.read() + data = data.replace('X'*len(WINVER_CHECK), WINVER_CHECK) + with open(self.main_xml, 'w') as open_file: + open_file.write(data) def build_features(self, top_feature, staging_dir): ''' |