mirror of
https://github.com/savoirfairelinux/jami-client-qt.git
synced 2026-01-04 02:52:52 +08:00
cleanup
→
base 64 → Base64
cancelled → canceled
{cannot, can't, couldn't} → unable to
inexistent → nonexistent
informations → information
not possible → impossible
retrieven → retrieved
SIP
try → attempt
URI
WebEngine
wish → want
Can this replace https://review.jami.net/c/jami-client-qt/+/27607 ?
Change-Id: I21e1615a0c6e2979f02f913093c503c03ab32c82
This commit is contained in:
@@ -139,14 +139,14 @@ def main():
|
||||
|
||||
if args.type in ["cpp", "both"]:
|
||||
if command_exists("clang-format-" + CFVERSION):
|
||||
CLANGFORMAT = "clang-format-" + CFVERSION
|
||||
CLANGFORMAT = "clang-format-" + CFVERSION
|
||||
elif command_exists("clang-format"):
|
||||
CLANGFORMAT = "clang-format"
|
||||
CLANGFORMAT = "clang-format"
|
||||
|
||||
if CLANGFORMAT is not None:
|
||||
print("Using source formatter: " + CLANGFORMAT)
|
||||
else:
|
||||
print("clang-format not found. can't format source files")
|
||||
print("clang-format not found, unable to format source files")
|
||||
|
||||
if args.qt is not None and args.type in ["qml", "both"]:
|
||||
global QMLFORMAT # pylint: disable=global-statement
|
||||
@@ -154,7 +154,7 @@ def main():
|
||||
if QMLFORMAT is not None:
|
||||
print("Using qmlformatter: " + QMLFORMAT)
|
||||
else:
|
||||
print("qmlformat not found, can't format QML files")
|
||||
print("qmlformat not found, unable to format QML files")
|
||||
|
||||
if args.install:
|
||||
if CLANGFORMAT is not None or QMLFORMAT is not None:
|
||||
@@ -171,10 +171,10 @@ def main():
|
||||
exit_if_no_files()
|
||||
else:
|
||||
if src_files and args.type in ["cpp", "both"] and CLANGFORMAT:
|
||||
print("Formatting source files...")
|
||||
print("Formatting source files…")
|
||||
clang_format_files(src_files)
|
||||
if qml_files and args.type in ["qml", "both"] and QMLFORMAT:
|
||||
print("Formatting QML files...")
|
||||
print("Formatting QML files…")
|
||||
qml_format_files(qml_files)
|
||||
|
||||
|
||||
|
||||
@@ -1,92 +1,92 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (C) 2022-2024 Savoir-faire Linux Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
# USA.
|
||||
|
||||
"""
|
||||
Generate qrc file for qml and related code files recursively within the source
|
||||
directory.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
# These paths should be relative to the working directory of the
|
||||
# script as set in the project CMakeLists, which should in turn be
|
||||
# where the resources.qrc will be located (currently 'src/app').
|
||||
app_src_dir = os.path.join('..', '..', 'src', 'app')
|
||||
resfile = os.path.join('qml.qrc')
|
||||
|
||||
|
||||
def path_contains_dir(filepath, dir_str):
|
||||
""" Return True if the given filepath contains the given directory. """
|
||||
# Split the filepath into its components
|
||||
path_components = os.path.normpath(filepath).split(os.sep)
|
||||
# Return True if the given directory is in the path
|
||||
return dir_str in path_components
|
||||
|
||||
|
||||
def posix_path(path):
|
||||
"""
|
||||
Force the use of POSIX path separators for the resource prefixes
|
||||
and paths (useful only if versioning the qml.qrc file).
|
||||
"""
|
||||
return path.replace(os.sep, '/')
|
||||
|
||||
|
||||
def gen_qml_qrc(with_webengine):
|
||||
""" Generate the qml.qrc file. """
|
||||
print("Generating qml.qrc file ...")
|
||||
with open(resfile, 'w', encoding='utf-8') as qrc:
|
||||
qrc.write('<RCC>\n')
|
||||
for root, _, files in os.walk(app_src_dir):
|
||||
# Skip the nowebengine directory if we can use webengine
|
||||
if with_webengine and path_contains_dir(root, 'nowebengine'):
|
||||
continue
|
||||
# Skip the webengine directory if we can't use webengine
|
||||
if not with_webengine and path_contains_dir(root, 'webengine'):
|
||||
continue
|
||||
filtered = [k for k in files if k.endswith('.qml') or
|
||||
k.endswith('.js') or k.endswith('.html') or
|
||||
k.endswith('.css') or k.endswith('.conf') or
|
||||
k == 'qmldir']
|
||||
# if there are no files of interest in this directory, skip it
|
||||
if not filtered:
|
||||
continue
|
||||
# For now, get the relative resource prefix for this directory,
|
||||
# remove the leading slash, and add it as a comment to the line.
|
||||
# Ideally, we should use the actual resource prefix instead of /,
|
||||
# but this will require some refactoring of the QML code.
|
||||
prefix = root.split(app_src_dir)[-1][1:]
|
||||
qrc.write(
|
||||
f'\t<qresource prefix="/"> <!--{posix_path(prefix)}-->\n')
|
||||
for file in filtered:
|
||||
relpath = os.path.relpath(
|
||||
os.path.join(root, file), app_src_dir)
|
||||
qrc.write(f'\t\t<file>{posix_path(relpath)}</file>\n')
|
||||
qrc.write('\t</qresource>\n')
|
||||
qrc.write('</RCC>')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# We can't use webengine if we're building for macOS app store
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--with-webengine', action='store_true',
|
||||
default=False, help='Include webengine resources')
|
||||
args = parser.parse_args()
|
||||
gen_qml_qrc(args.with_webengine)
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (C) 2022-2024 Savoir-faire Linux Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
# USA.
|
||||
|
||||
"""
|
||||
Generate qrc file for qml and related code files recursively within the source
|
||||
directory.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
# These paths should be relative to the working directory of the
|
||||
# script as set in the project CMakeLists, which should in turn be
|
||||
# where the resources.qrc will be located (currently 'src/app').
|
||||
app_src_dir = os.path.join('..', '..', 'src', 'app')
|
||||
resfile = os.path.join('qml.qrc')
|
||||
|
||||
|
||||
def path_contains_dir(filepath, dir_str):
|
||||
""" Return True if the given filepath contains the given directory. """
|
||||
# Split the filepath into its components
|
||||
path_components = os.path.normpath(filepath).split(os.sep)
|
||||
# Return True if the given directory is in the path
|
||||
return dir_str in path_components
|
||||
|
||||
|
||||
def posix_path(path):
|
||||
"""
|
||||
Force the use of POSIX path separators for the resource prefixes
|
||||
and paths (useful only if versioning the qml.qrc file).
|
||||
"""
|
||||
return path.replace(os.sep, '/')
|
||||
|
||||
|
||||
def gen_qml_qrc(with_webengine):
|
||||
""" Generate the qml.qrc file. """
|
||||
print("Generating qml.qrc file…")
|
||||
with open(resfile, 'w', encoding='utf-8') as qrc:
|
||||
qrc.write('<RCC>\n')
|
||||
for root, _, files in os.walk(app_src_dir):
|
||||
# Skip the nowebengine directory if we can use WebEngine
|
||||
if with_webengine and path_contains_dir(root, 'nowebengine'):
|
||||
continue
|
||||
# Skip the webengine directory if WebEngine is unable to be used
|
||||
if not with_webengine and path_contains_dir(root, 'webengine'):
|
||||
continue
|
||||
filtered = [k for k in files if k.endswith('.qml') or
|
||||
k.endswith('.js') or k.endswith('.html') or
|
||||
k.endswith('.css') or k.endswith('.conf') or
|
||||
k == 'qmldir']
|
||||
# if there are no files of interest in this directory, skip it
|
||||
if not filtered:
|
||||
continue
|
||||
# For now, get the relative resource prefix for this directory,
|
||||
# remove the leading slash, and add it as a comment to the line.
|
||||
# Ideally, we should use the actual resource prefix instead of /,
|
||||
# but this will require some refactoring of the QML code.
|
||||
prefix = root.split(app_src_dir)[-1][1:]
|
||||
qrc.write(
|
||||
f'\t<qresource prefix="/"> <!--{posix_path(prefix)}-->\n')
|
||||
for file in filtered:
|
||||
relpath = os.path.relpath(
|
||||
os.path.join(root, file), app_src_dir)
|
||||
qrc.write(f'\t\t<file>{posix_path(relpath)}</file>\n')
|
||||
qrc.write('\t</qresource>\n')
|
||||
qrc.write('</RCC>')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# WebEngine is unable to be used if building for macOS App Store
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--with-webengine', action='store_true',
|
||||
default=False, help='Include WebEngine resources')
|
||||
args = parser.parse_args()
|
||||
gen_qml_qrc(args.with_webengine)
|
||||
|
||||
@@ -64,7 +64,7 @@ def gen_resources_qrc(with_webengine):
|
||||
qrc.write('<RCC>\n')
|
||||
qml.write('pragma Singleton\nimport QtQuick\nQtObject {\n')
|
||||
for root, _, files in os.walk(resdir):
|
||||
# Skip the webengine directory if we can't use webengine
|
||||
# Skip the WebEngine directory if WebEngine is unable to used
|
||||
if not with_webengine and path_contains_dir(root, 'webengine'):
|
||||
continue
|
||||
prefix = root.rsplit(os.sep, 1)[-1]
|
||||
@@ -90,10 +90,10 @@ def gen_resources_qrc(with_webengine):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# We can't use webengine if we're building for macOS app store
|
||||
# WebEngine is unable to be used if building for macOS App Store
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--with-webengine', action='store_true',
|
||||
default=False, help='Include webengine resources')
|
||||
default=False, help='Include WebEngine resources')
|
||||
args = parser.parse_args()
|
||||
gen_resources_qrc(args.with_webengine)
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
##
|
||||
## Copyright (C) 2016-2024 Savoir-faire Linux Inc.
|
||||
##
|
||||
## Author: Edric Milaret <edric.ladent-milaret@savoirfairelinux.com>
|
||||
## Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 3 of the License, or
|
||||
@@ -26,9 +23,9 @@ import shutil
|
||||
|
||||
print("== Updating from sources")
|
||||
if os.system("lupdate jami.pro -no-obsolete"):
|
||||
print("trying with 'lupdate-qt5'")
|
||||
print("Attempting with 'lupdate-qt5'")
|
||||
if os.system("lupdate-qt5 jami.pro -no-obsolete"):
|
||||
raise RuntimeError("unable to find any suitable lupdate Qt tool on this system. Stopping")
|
||||
raise RuntimeError("Unable to find any suitable lupdate Qt tool on this system. Stopping…")
|
||||
|
||||
print("== Pushing sources")
|
||||
os.system("tx push -s")
|
||||
|
||||
Reference in New Issue
Block a user