Skip to content

Commit

Permalink
Merge pull request #200 from miurahr/topic-qt6-url
Browse files Browse the repository at this point in the history
Update list command to work for Qt6
  • Loading branch information
miurahr authored Jan 27, 2021
2 parents 8e6d508 + eddd4d5 commit 2181bdc
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 27 deletions.
52 changes: 33 additions & 19 deletions aqt/archives.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,32 @@ def __init__(self, version, os_name, target, base, timeout=(5, 5)):

def _get_archives(self):
qt_ver_num = self.version.replace(".", "")

self.qt_ver_base = self.version[0:1]
# Get packages index
archive_path = "{0}{1}{2}/qt5_{3}/".format(self.os_name, '_x86/' if self.os_name == 'windows' else '_x64/',
self.target, qt_ver_num)
update_xml_url = "{0}{1}Updates.xml".format(self.base, archive_path)
r = requests.get(update_xml_url, timeout=self.timeout)
self.update_xml = ElementTree.fromstring(r.text)
for packageupdate in self.update_xml.iter("PackageUpdate"):
name = packageupdate.find("Name").text
if packageupdate.find("DownloadableArchives").text is not None:
package_desc = packageupdate.findtext("Description")
display_name = packageupdate.findtext("DisplayName")
virtual_str = packageupdate.findtext("Virtual")
if virtual_str is None or virtual_str == 'false':
virtual = False
else:
virtual = True
self.archives.append(ListInfo(name, display_name, package_desc, virtual))
if self.qt_ver_base == "6" and self.target == 'android':
arch_ext = ['_armv7/', '_x86/', '_x86_64/', '_arm64_v8a/']
elif self.qt_ver_base == '5' and int(qt_ver_num) >= 5130 and self.target == 'desktop':
arch_ext = ['/', '_wasm/']
else:
arch_ext = ['/']
for ext in arch_ext:
archive_path = "{0}{1}{2}/qt{3}_{4}{5}".format(self.os_name,
'_x86/' if self.os_name == 'windows' else '_x64/',
self.target, self.qt_ver_base, qt_ver_num, ext)
update_xml_url = "{0}{1}Updates.xml".format(self.base, archive_path)
r = requests.get(update_xml_url, timeout=self.timeout)
self.update_xml = ElementTree.fromstring(r.text)
for packageupdate in self.update_xml.iter("PackageUpdate"):
name = packageupdate.find("Name").text
if packageupdate.find("DownloadableArchives").text is not None:
package_desc = packageupdate.findtext("Description")
display_name = packageupdate.findtext("DisplayName")
virtual_str = packageupdate.findtext("Virtual")
if virtual_str == 'true':
virtual = True
else:
virtual = False
self.archives.append(ListInfo(name, display_name, package_desc, virtual))
if len(self.archives) == 0:
self.logger.error("Error while parsing package information!")
exit(1)
Expand Down Expand Up @@ -147,10 +155,16 @@ def __init__(self, os_name, target, version, arch, base, subarchives=None,

def _get_archives(self, qt_ver_num):
# Get packages index
archive_path = "{0}{1}{2}/qt{3}_{4}{5}".format(self.os_name,
if self.arch == 'wasm_32':
arch_ext = '_wasm'
elif self.arch.startswith("android_") and qt_ver_num[0:1] == '6':
arch_ext = '{}'.format(self.arch[7:])
else:
arch_ext = ''
archive_path = "{0}{1}{2}/qt{3}_{4}{5}/".format(self.os_name,
'_x86/' if self.os_name == 'windows' else '_x64/',
self.target, self.qt_ver_base, qt_ver_num,
'_wasm/' if self.arch == 'wasm_32' else '/')
arch_ext)
update_xml_url = "{0}{1}Updates.xml".format(self.base, archive_path)
archive_url = "{0}{1}".format(self.base, archive_path)
target_packages = []
Expand Down
19 changes: 11 additions & 8 deletions aqt/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,20 +299,23 @@ def run_tool(self, args):

def run_list(self, args):
self.show_aqt_version()
qt_version = args.qt_version
host = args.host
target = args.target
try:
pl = PackagesList(args.qt_version, args.host, args.target, BASE_URL)
pl = PackagesList(qt_version, host, target, BASE_URL)
except requests.exceptions.ConnectionError:
pl = PackagesList(args.qt_version, args.host, args.target, random.choice(FALLBACK_URLS))
pl = PackagesList(qt_version, host, target, random.choice(FALLBACK_URLS))
print('List Qt packages in %s for %s' % (args.qt_version, args.host))
table = Texttable()
table.set_deco(Texttable.HEADER)
table.set_cols_dtype(['t', 't'])
table.set_cols_align(["l", "l"])
table.header(["target type", "arch"])
table.set_cols_dtype(['t', 't', 't'])
table.set_cols_align(['l', 'l', 'l'])
table.header(['target', 'arch', 'description'])
for entry in pl.get_list():
if not entry.virtual:
name_list = entry.name.split('.')
table.add_row([entry.display_name, name_list[-1]])
if qt_version[0:1] == '6' or not entry.virtual:
archid = entry.name.split('.')[-1]
table.add_row([entry.display_name, archid, entry.desc])
print(table.draw())

def show_help(self, args):
Expand Down

0 comments on commit 2181bdc

Please sign in to comment.