diff --git a/gajim/common/storage/archive.py b/gajim/common/storage/archive.py index 6332d9065c9909ef4cc437bd966501ad6bf6d11e..2b0bd4ea92bf08bcaa61a9fe0a81ebdd77c6a2a4 100644 --- a/gajim/common/storage/archive.py +++ b/gajim/common/storage/archive.py @@ -177,8 +177,8 @@ def init(self, **kwargs: Any) -> None: self._con.row_factory = self._namedtuple_factory - self._con.create_function("like", 1, self._like) - self._con.create_function("get_timeout", 0, self._get_timeout) + self._con.create_function('like', 1, self._like) + self._con.create_function('get_timeout', 0, self._get_timeout) self._get_jid_ids_from_db() @@ -188,7 +188,7 @@ def _namedtuple_factory(self, assert cursor.description is not None fields = [col[0] for col in cursor.description] - Row = namedtuple("Row", fields) # type: ignore + Row = namedtuple('Row', fields) # type: ignore named_row = Row(*row) if 'additional_data' in fields: _dict = json.loads(named_row.additional_data or '{}') @@ -259,9 +259,9 @@ def _migrate(self) -> None: @staticmethod def _get_timeout() -> int: - """ + ''' returns the timeout in epoch - """ + ''' timeout = app.settings.get('restore_timeout') now = int(time.time()) @@ -275,9 +275,9 @@ def _like(search_str: str) -> str: @timeit def _get_jid_ids_from_db(self) -> None: - """ + ''' Load all jid/jid_id tuples into a dict for faster access - """ + ''' rows = self._con.execute( 'SELECT jid_id, jid, type FROM jids').fetchall() for row in rows: @@ -310,7 +310,7 @@ def get_jid_id(self, kind: Optional[KindConstant] = None, type_: Optional[JIDConstant] = None ) -> int: - """ + ''' Get the jid id from a jid. In case the jid id is not found create a new one. @@ -321,7 +321,7 @@ def get_jid_id(self, :param type_: The JIDConstant return the jid id - """ + ''' if kind in (KindConstant.GC_MSG, KindConstant.GCSTATUS): type_ = JIDConstant.ROOM_TYPE @@ -354,9 +354,9 @@ def get_jid_id(self, @staticmethod def convert_show_values_to_db_api_values(show: Optional[str] ) -> Optional[ShowConstant]: - """ + ''' Convert from string style to constant ints for db - """ + ''' if show == 'online': return ShowConstant.ONLINE @@ -384,7 +384,7 @@ def get_conversation_before_after(self, timestamp: float, n_lines: int ) -> list[ConversationRow]: - """ + ''' Load n_lines lines of conversation with jid before or after timestamp :param account: The account @@ -396,7 +396,7 @@ def get_conversation_before_after(self, :param timestamp: timestamp returns a list of namedtuples - """ + ''' jids = [jid] account_id = self.get_account_id(account) kinds = map(str, [KindConstant.ERROR, @@ -431,7 +431,7 @@ def get_last_conversation_line(self, account: str, jid: JID ) -> LastConversationRow: - """ + ''' Load the last line of a conversation with jid for account. Loads messages, but no status messages or error messages. @@ -440,7 +440,7 @@ def get_last_conversation_line(self, :param jid: The jid for which we request the conversation returns a list of namedtuples - """ + ''' jids = [jid] account_id = self.get_account_id(account) @@ -468,7 +468,7 @@ def get_conversation_around(self, timestamp: float ) -> tuple[list[ConversationRow], list[ConversationRow]]: - """ + ''' Load all lines of conversation with jid around a specific timestamp :param account: The account @@ -478,7 +478,7 @@ def get_conversation_around(self, :param timestamp: Timestamp around which to fetch messages returns a list of namedtuples - """ + ''' jids = [jid] account_id = self.get_account_id(account) kinds = map(str, [KindConstant.ERROR]) @@ -526,7 +526,7 @@ def get_conversation_between(self, jid: str, before: float, after: float) -> list[ConversationRow]: - """ + ''' Load all lines of conversation with jid between two timestamps :param account: The account @@ -538,7 +538,7 @@ def get_conversation_between(self, :param after: earliest timestamp returns a list of namedtuples - """ + ''' jids = [jid] account_id = self.get_account_id(account) kinds = map(str, [KindConstant.ERROR]) @@ -570,7 +570,7 @@ def search_log(self, before: Optional[datetime.datetime] = None, after: Optional[datetime.datetime] = None ) -> Iterator[SearchLogRow]: - """ + ''' Search the conversation log for messages containing the `query` string. The search can either span the complete log for the given @@ -590,7 +590,7 @@ def search_log(self, :param after: A datetime.datetime instance or None returns a list of namedtuples - """ + ''' jids = [jid] kinds = map(str, [KindConstant.STATUS, @@ -654,7 +654,7 @@ def search_all_logs(self, before: Optional[datetime.datetime] = None, after: Optional[datetime.datetime] = None ) -> Iterator[SearchLogRow]: - """ + ''' Search all conversation logs for messages containing the `query` string. @@ -667,7 +667,7 @@ def search_all_logs(self, :param after: A datetime.datetime instance or None returns a list of namedtuples - """ + ''' account_ids = self.get_active_account_ids() kinds = map(str, [KindConstant.STATUS, KindConstant.GCSTATUS]) @@ -726,9 +726,9 @@ def get_days_with_history(self, year: int, month: int ) -> list[HistoryDayRow]: - """ + ''' Get days in month where messages for 'jid' exist - """ + ''' jids = [jid] account_id = self.get_account_id(account) kinds = map(str, [KindConstant.STATUS, @@ -740,7 +740,7 @@ def get_days_with_history(self, delta = datetime.timedelta( days=days, hours=23, minutes=59, seconds=59, microseconds=999999) - sql = """ + sql = ''' SELECT DISTINCT CAST(strftime('%d', time, 'unixepoch', 'localtime') AS INTEGER) AS day FROM logs NATURAL JOIN jids WHERE jid IN ({jids}) @@ -748,7 +748,7 @@ def get_days_with_history(self, AND time BETWEEN ? AND ? AND kind NOT IN ({kinds}) ORDER BY time - """.format(jids=', '.join('?' * len(jids)), + '''.format(jids=', '.join('?' * len(jids)), account_id=account_id, kinds=', '.join(kinds)) @@ -762,9 +762,9 @@ def get_last_history_timestamp(self, account: str, jid: str ) -> Optional[float]: - """ + ''' Get the timestamp of the last message we received for the jid - """ + ''' jids = [jid] account_id = self.get_account_id(account) kinds = map(str, [KindConstant.STATUS, @@ -788,9 +788,9 @@ def get_first_history_timestamp(self, account: str, jid: str ) -> Optional[float]: - """ + ''' Get the timestamp of the first message we received for the jid - """ + ''' jids = [jid] account_id = self.get_account_id(account) kinds = map(str, [KindConstant.STATUS, @@ -815,10 +815,10 @@ def date_has_history(self, jid: str, date: datetime.datetime ) -> Optional[float]: - """ + ''' Get a single timestamp of a message for 'jid' in time range of one day - """ + ''' jids = [jid] account_id = self.get_account_id(account) delta = datetime.timedelta( @@ -844,9 +844,9 @@ def get_first_message_meta_for_date(self, jid: str, date: datetime.datetime ) -> Optional[MessageMetaRow]: - """ + ''' Load meta data for the first message of a specific date - """ + ''' jids = [jid] account_id = self.get_account_id(account) @@ -876,7 +876,7 @@ def deduplicate_muc_message(self, timestamp: float, message_id: str ) -> bool: - """ + ''' Check if a message is already in the `logs` table :param account: The account @@ -888,7 +888,7 @@ def deduplicate_muc_message(self, :param timestamp: The timestamp in UTC epoch :param message_id: The message-id - """ + ''' # Add 60 seconds around the timestamp start_time = timestamp - 60 @@ -929,7 +929,7 @@ def find_stanza_id(self, origin_id: Optional[str] = None, groupchat: bool = False ) -> bool: - """ + ''' Checks if a stanza-id is already in the `logs` table :param account: The account @@ -944,7 +944,7 @@ def find_stanza_id(self, :param groupchat: stanza-id is from a groupchat return True if the stanza-id was found - """ + ''' ids: list[str] = [] if stanza_id is not None: ids.append(stanza_id) @@ -1122,7 +1122,7 @@ def insert_jid(self, kind: Optional[KindConstant] = None, type_: JIDConstant = JIDConstant.NORMAL_TYPE ) -> int: - """ + ''' Insert a new jid into the `jids` table. This is an alias of get_jid_id() for better readablility. @@ -1131,7 +1131,7 @@ def insert_jid(self, :param kind: A KindConstant :param type_: A JIDConstant - """ + ''' return self.get_jid_id(jid, kind, type_) @timeit @@ -1142,7 +1142,7 @@ def insert_into_logs(self, kind: KindConstant, **kwargs: Any ) -> int: - """ + ''' Insert a new message into the `logs` table :param jid: The jid as string @@ -1156,7 +1156,7 @@ def insert_into_logs(self, :param kwargs: Every additional named argument must correspond to a field in the `logs` table - """ + ''' jid_id = self.get_jid_id(jid, kind=kind) account_id = self.get_account_id(account) @@ -1193,7 +1193,7 @@ def set_message_error(self, message_id: str, error: str ) -> None: - """ + ''' Update the corresponding message with the error :param account_jid: The jid of the account @@ -1204,7 +1204,7 @@ def set_message_error(self, :param error: The error stanza as string - """ + ''' account_id = self.get_jid_id(account_jid) try: @@ -1227,7 +1227,7 @@ def set_marker(self, message_id: str, state: str ) -> None: - """ + ''' Update the marker state of the corresponding message :param account_jid: The jid of the account @@ -1238,7 +1238,7 @@ def set_marker(self, :param state: The state, 'received' or 'displayed' - """ + ''' if state not in ('received', 'displayed'): raise ValueError('Invalid marker state') @@ -1260,19 +1260,19 @@ def set_marker(self, @timeit def get_archive_infos(self, jid: str) -> Optional[LastArchiveMessageRow]: - """ + ''' Get the archive infos :param jid: The jid that belongs to the avatar - """ + ''' jid_id = self.get_jid_id(jid, type_=JIDConstant.ROOM_TYPE) sql = '''SELECT * FROM last_archive_message WHERE jid_id = ?''' return self._con.execute(sql, (jid_id,)).fetchone() @timeit def set_archive_infos(self, jid: str, **kwargs: Any) -> None: - """ + ''' Set archive infos :param jid: The jid that belongs to the avatar @@ -1288,7 +1288,7 @@ def set_archive_infos(self, jid: str, **kwargs: Any) -> None: :param sync_threshold: The max days that we request from a MUC archive - """ + ''' jid_id = self.get_jid_id(jid) exists = self.get_archive_infos(jid) if not exists: @@ -1316,12 +1316,12 @@ def set_archive_infos(self, jid: str, **kwargs: Any) -> None: @timeit def reset_archive_infos(self, jid: str) -> None: - """ + ''' Set archive infos :param jid: The jid of the archive - """ + ''' jid_id = self.get_jid_id(jid) sql = '''UPDATE last_archive_message SET last_mam_id = NULL, oldest_mam_timestamp = NULL, @@ -1366,10 +1366,10 @@ def get_messages_for_export(self, yield result def remove_history(self, account: str, jid: JID) -> None: - """ + ''' Remove history for a specific chat. If it's a group chat, remove last MAM ID as well. - """ + ''' account_id = self.get_account_id(account) try: jid_id = self.get_jid_id(jid) @@ -1383,9 +1383,9 @@ def remove_history(self, account: str, jid: JID) -> None: log.info('Removed history for: %s', jid) def remove_all_history(self) -> None: - """ + ''' Remove all messages for all accounts - """ + ''' statements = [ 'DELETE FROM logs', 'DELETE FROM jids', @@ -1395,9 +1395,9 @@ def remove_all_history(self) -> None: log.info('Removed all chat history') def cleanup_chat_history(self) -> None: - """ + ''' Remove messages from account where messages are older than max_age - """ + ''' for account in app.settings.get_accounts(): max_age = app.settings.get_account_setting( account, 'chat_history_max_age') diff --git a/gajim/dev/ipython_view.py b/gajim/dev/ipython_view.py index 42b9890cabcaa4f7bf0d613007ebfb259e6d3811..1904a37e0e20ec798f48728eb39f772192f58ccc 100644 --- a/gajim/dev/ipython_view.py +++ b/gajim/dev/ipython_view.py @@ -43,7 +43,7 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -""" +''' Provides IPython console widget @author: Eitan Isaacson @@ -54,7 +54,7 @@ All rights reserved. This program and the accompanying materials are made available under the terms of the BSD which accompanies this distribution, and is available at U{http://www.opensource.org/licenses/bsd-license.php} -""" +''' import re import sys @@ -87,7 +87,7 @@ def write_output_prompt(self): class IterableIPShell: - """ + ''' Create an IPython instance. Does not start a blocking event loop, instead allow single iterations. This allows embedding in GTK without blockage @@ -102,10 +102,10 @@ class IterableIPShell: @type history_level: integer @ivar complete_sep: Separation delimiters for completion function. @type complete_sep: _sre.SRE_Pattern - """ + ''' def __init__(self, argv=None, user_ns=None, user_global_ns=None, cin=None, cout=None, cerr=None, input_func=None): - """ + ''' @param argv: Command line options for IPython @type argv: list @param user_ns: User namespace. @@ -120,7 +120,7 @@ def __init__(self, argv=None, user_ns=None, user_global_ns=None, cin=None, @type cerr: IO stream @param input_func: Replacement for builtin raw_input() @type input_func: function - """ + ''' if argv is None: argv = [] @@ -138,7 +138,7 @@ def __init__(self, argv=None, user_ns=None, user_global_ns=None, cin=None, from traitlets.config.loader import Config cfg = Config() - cfg.InteractiveShell.colors = "Linux" + cfg.InteractiveShell.colors = 'Linux' # InteractiveShell's __init__ gets a reference of stdout and stderr # so we save the standard here to revert it after init @@ -178,9 +178,9 @@ def __update_namespace(self): self.IP.user_ns.update({k: v}) def execute(self): - """ + ''' Execute the current line provided by the shell object - """ + ''' self.history_level = 0 orig_stdout = sys.stdout sys.stdout = IPython.utils.io.stdout @@ -237,37 +237,37 @@ def generatePrompt(self, is_continuation): ''' # TODO: Update to IPython 5.x and later - prompt = "In [%d]: " % self.IP.execution_count + prompt = 'In [%d]: ' % self.IP.execution_count return prompt def historyBack(self): - """ + ''' Provide one history command back @return: The command string. @rtype: string - """ + ''' self.history_level -= 1 return self._getHistory() def historyForward(self): - """ + ''' Provide one history command forward @return: The command string. @rtype: string - """ + ''' self.history_level += 1 return self._getHistory() def _getHistory(self): - """ + ''' Get the command string of the current history level @return: Historic command string. @rtype: string - """ + ''' try: rv = self.IP.user_ns['In'][self.history_level].strip('\n') except IndexError: @@ -276,16 +276,16 @@ def _getHistory(self): return rv def updateNamespace(self, ns_dict): - """ + ''' Add the current dictionary to the shell namespace @param ns_dict: A dictionary of symbol-values. @type ns_dict: dictionary - """ + ''' self.IP.user_ns.update(ns_dict) def complete(self, line): - """ + ''' Returns an auto completed line and/or possibilities for completion @param line: Given line so far. @@ -294,7 +294,7 @@ def complete(self, line): @return: Line completed as for as possible, and possible further completions. @rtype: tuple - """ + ''' split_line = self.complete_sep.split(line) if split_line[-1]: possibilities = self.IP.complete(split_line[-1]) @@ -331,7 +331,7 @@ def _commonPrefix(str1, str2): class ConsoleView(Gtk.TextView): - """ + ''' Specialized text view for console-like workflow @cvar ANSI_COLORS: Mapping of terminal colors to X11 names. @@ -345,7 +345,7 @@ class ConsoleView(Gtk.TextView): @type mark: Gtk.TextMark @ivar line_start: Start of command line mark. @type line_start: Gtk.TextMark - """ + ''' ANSI_COLORS = {'0;30': 'Black', '0;31': 'Red', '0;32': 'Green', '0;33': 'Brown', @@ -357,9 +357,9 @@ class ConsoleView(Gtk.TextView): '1;36': 'LightCyan', '1;37': 'White'} def __init__(self): - """ + ''' Initialize console view - """ + ''' GObject.GObject.__init__(self) self.override_font(Pango.FontDescription('Mono')) self.set_cursor_visible(True) @@ -396,14 +396,14 @@ def write(self, text, editable=False): GLib.idle_add(self._write5, text, editable) def _write5(self, text, editable=False): - """ + ''' Write given text to buffer @param text: Text to append. @type text: list of (token: string) @param editable: If true, added text is editable. @type editable: boolean - """ + ''' start_mark = self.text_buffer.create_mark( None, self.text_buffer.get_end_iter(), True) @@ -420,14 +420,14 @@ def _write5(self, text, editable=False): self.scroll_mark_onscreen(self.mark) def _write(self, text, editable=False): - """ + ''' Write given text to buffer @param text: Text to append. @type text: string @param editable: If true, added text is editable. @type editable: boolean - """ + ''' if isinstance(text, list): self._write5(text, editable) return @@ -457,12 +457,12 @@ def showPrompt(self, prompt): GLib.idle_add(self._showPrompt, prompt) def _showPrompt(self, prompt): - """ + ''' Print prompt at start of line @param prompt: Prompt to print. @type prompt: string - """ + ''' self._write(prompt) self.text_buffer.move_mark(self.line_start, self.text_buffer.get_end_iter()) @@ -471,12 +471,12 @@ def changeLine(self, text): GLib.idle_add(self._changeLine, text) def _changeLine(self, text): - """ + ''' Replace currently entered command line with given text @param text: Text to use as replacement. @type text: string - """ + ''' iter_ = self.text_buffer.get_iter_at_mark(self.line_start) iter_.forward_to_line_end() self.text_buffer.delete( @@ -484,12 +484,12 @@ def _changeLine(self, text): self._write(text, True) def getCurrentLine(self): - """ + ''' Get text in current command line @return: Text of current command line. @rtype: string - """ + ''' rv = self.text_buffer.get_slice( self.text_buffer.get_iter_at_mark(self.line_start), self.text_buffer.get_end_iter(), False) @@ -499,12 +499,12 @@ def showReturned(self, text): GLib.idle_add(self._showReturned, text) def _showReturned(self, text): - """ + ''' Show returned text from last command and print new prompt @param text: Text to show. @type text: string - """ + ''' iter_ = self.text_buffer.get_iter_at_mark(self.line_start) iter_.forward_to_line_end() self.text_buffer.apply_tag_by_name( @@ -524,7 +524,7 @@ def _showReturned(self, text): self.text_buffer.insert_at_cursor(indentation) def onKeyPress(self, _widget, event): - """ + ''' Key press callback used for correcting behavior for console-like interfaces. For example 'home' should go to prompt, not to beginning of line @@ -536,7 +536,7 @@ def onKeyPress(self, _widget, event): @return: Return True if event should not trickle. @rtype: boolean - """ + ''' insert_mark = self.text_buffer.get_insert() insert_iter = self.text_buffer.get_iter_at_mark(insert_mark) selection_mark = self.text_buffer.get_selection_bound() @@ -570,9 +570,9 @@ def onKeyPress(self, _widget, event): return self.onKeyPressExtend(event) def onKeyPressExtend(self, event): - """ + ''' For some reason we can't extend onKeyPress directly (bug #500900) - """ + ''' class IPythonView(ConsoleView, IterableIPShell): @@ -581,9 +581,9 @@ class IPythonView(ConsoleView, IterableIPShell): a GTK IPython console. ''' def __init__(self): - """ + ''' Initialize. Redirect I/O to console - """ + ''' ConsoleView.__init__(self) self.cout = StringIO() IterableIPShell.__init__(self, cout=self.cout, cerr=self.cout, @@ -604,7 +604,7 @@ def prompt_for_code(self): return self.raw_input(self) def raw_input(self, _prompt=''): - """ + ''' Custom raw_input() replacement. Gets current line from console buffer @param prompt: Prompt to print. Here for compatibility as replacement. @@ -612,14 +612,14 @@ def raw_input(self, _prompt=''): @return: The current command line text. @rtype: string - """ + ''' if self.interrupt: self.interrupt = False raise KeyboardInterrupt return self.getCurrentLine() def onKeyPressExtend(self, event): - """ + ''' Key press callback with plenty of shell goodness, like history, autocompletions, etc @@ -630,7 +630,7 @@ def onKeyPressExtend(self, event): @return: True if event should not trickle. @rtype: boolean - """ + ''' if (event.get_state() & Gdk.ModifierType.CONTROL_MASK and event.keyval == 99): self.interrupt = True @@ -659,9 +659,9 @@ def onKeyPressExtend(self, event): return True def _processLine(self): - """ + ''' Process current command line - """ + ''' self.history_pos = 0 self.execute() rv = self.cout.getvalue() diff --git a/win/misc/create-launcher.py b/win/misc/create-launcher.py index d18ee19aa460a86cfaae7db5626a3ade41edfcb1..f5e8d322520f6f583de7e105a2c5b3298cf69a7f 100644 --- a/win/misc/create-launcher.py +++ b/win/misc/create-launcher.py @@ -7,10 +7,10 @@ # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -"""Creates simple Python .exe launchers for gui and cli apps +# Creates simple Python .exe launchers for gui and cli apps +# +# ./create-launcher.py "1.4.0" <target-dir> -./create-launcher.py "1.4.0" <target-dir> -""" import os import sys @@ -22,26 +22,26 @@ def build_resource(rc_path: str, out_path: str) -> None: - """Raises subprocess.CalledProcessError""" + '''Raises subprocess.CalledProcessError''' def is_64bit(): - return struct.calcsize("P") == 8 + return struct.calcsize('P') == 8 subprocess.check_call( - ["windres", "-O", "coff", "-F", - "pe-x86-64" if is_64bit() else "pe-i386", rc_path, - "-o", out_path]) + ['windres', '-O', 'coff', '-F', + 'pe-x86-64' if is_64bit() else 'pe-i386', rc_path, + '-o', out_path]) def get_build_args() -> list[str]: python_name = os.path.splitext(os.path.basename(sys.executable))[0] python_config = os.path.join( - os.path.dirname(sys.executable), python_name + "-config") + os.path.dirname(sys.executable), python_name + '-config') cflags = subprocess.check_output( - ["sh", python_config, "--cflags"]).strip() + ['sh', python_config, '--cflags']).strip() libs = subprocess.check_output( - ["sh", python_config, "--libs"]).strip() + ['sh', python_config, '--libs']).strip() cflags = os.fsdecode(cflags) libs = os.fsdecode(libs) @@ -53,16 +53,16 @@ def build_exe(source_path: str, is_gui: bool, out_path: str) -> None: - args = ["gcc", "-s"] + args = ['gcc', '-s'] if is_gui: - args.append("-mwindows") - args.extend(["-o", out_path, source_path, resource_path]) + args.append('-mwindows') + args.extend(['-o', out_path, source_path, resource_path]) args.extend(get_build_args()) subprocess.check_call(args) def get_launcher_code(debug: bool) -> str: - template = """\ + template = '''\ #include "Python.h" #define WIN32_LEAN_AND_MEAN #include <windows.h> @@ -102,7 +102,7 @@ def get_launcher_code(debug: bool) -> str: Py_Finalize(); return result; } - """ % int(debug) + ''' % int(debug) return template @@ -115,7 +115,7 @@ def get_resouce_code(filename: str, product_version: str, company_name: str) -> str: - template = """\ + template = '''\ 1 ICON "%(icon_path)s" 1 VERSIONINFO FILEVERSION %(file_version_list)s @@ -141,22 +141,22 @@ def get_resouce_code(filename: str, VALUE "Translation", 0x409, 1252 END END -""" +''' def to_ver_list(v: str) -> str: - v = v.split("-")[0] - return ",".join(map(str, (list(map(int, v.split("."))) + [0] * 4)[:4])) + v = v.split('-')[0] + return ','.join(map(str, (list(map(int, v.split('.'))) + [0] * 4)[:4])) file_version_list = to_ver_list(file_version) product_version_list = to_ver_list(product_version) return template % { - "icon_path": icon_path, "file_version_list": file_version_list, - "product_version_list": product_version_list, - "file_version": file_version, "product_version": product_version, - "company_name": company_name, "filename": filename, - "internal_name": os.path.splitext(filename)[0], - "product_name": product_name, "file_desc": file_desc, + 'icon_path': icon_path, 'file_version_list': file_version_list, + 'product_version_list': product_version_list, + 'file_version': file_version, 'product_version': product_version, + 'company_name': company_name, 'filename': filename, + 'internal_name': os.path.splitext(filename)[0], + 'product_name': product_name, 'file_desc': file_desc, } @@ -178,16 +178,16 @@ def build_launcher(out_path: str, temp = tempfile.mkdtemp() try: os.chdir(temp) - with open("launcher.c", "w") as h: + with open('launcher.c', 'w') as h: h.write(get_launcher_code(debug)) - shutil.copyfile(src_ico, "launcher.ico") - with open("launcher.rc", "w") as h: + shutil.copyfile(src_ico, 'launcher.ico') + with open('launcher.rc', 'w') as h: h.write(get_resouce_code( os.path.basename(target), file_version, file_desc, - "launcher.ico", product_name, product_version, company_name)) + 'launcher.ico', product_name, product_version, company_name)) - build_resource("launcher.rc", "launcher.res") - build_exe("launcher.c", "launcher.res", is_gui, target) + build_resource('launcher.rc', 'launcher.res') + build_exe('launcher.c', 'launcher.res', is_gui, target) finally: os.chdir(dir_) shutil.rmtree(temp) @@ -199,17 +199,17 @@ def main() -> None: version = argv[1] target = argv[2] - company_name = "Gajim" + company_name = 'Gajim' misc = os.path.dirname(os.path.realpath(__file__)) build_launcher( - os.path.join(target, "Gajim.exe"), - os.path.join(misc, "gajim.ico"), "Gajim", "Gajim", + os.path.join(target, 'Gajim.exe'), + os.path.join(misc, 'gajim.ico'), 'Gajim', 'Gajim', version, company_name, True) build_launcher( - os.path.join(target, "Gajim-Debug.exe"), - os.path.join(misc, "gajim.ico"), "Gajim", "Gajim", + os.path.join(target, 'Gajim-Debug.exe'), + os.path.join(misc, 'gajim.ico'), 'Gajim', 'Gajim', version, company_name, False, debug=True) # build_launcher( @@ -218,5 +218,5 @@ def main() -> None: # version, company_name, 'history_manager.py', True) -if __name__ == "__main__": +if __name__ == '__main__': main()