Version in base suite: 4.2.1+dfsg1-3 Base version: spyder_4.2.1+dfsg1-3 Target version: spyder_4.2.1+dfsg1-3+deb11u1 Base file: /srv/ftp-master.debian.org/ftp/pool/main/s/spyder/spyder_4.2.1+dfsg1-3.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/s/spyder/spyder_4.2.1+dfsg1-3+deb11u1.dsc changelog | 6 patches/Prevent-double-saving-when-running-a-file.patch | 183 ++++++++++++++++ patches/series | 1 3 files changed, 190 insertions(+) diff -Nru spyder-4.2.1+dfsg1/debian/changelog spyder-4.2.1+dfsg1/debian/changelog --- spyder-4.2.1+dfsg1/debian/changelog 2021-02-21 09:28:17.000000000 +0000 +++ spyder-4.2.1+dfsg1/debian/changelog 2023-01-09 19:58:36.000000000 +0000 @@ -1,3 +1,9 @@ +spyder (4.2.1+dfsg1-3+deb11u1) bullseye; urgency=medium + + * Fix duplicate-code-on-save bug (closes: #989660) + + -- Julian Gilbey Mon, 09 Jan 2023 19:58:36 +0000 + spyder (4.2.1+dfsg1-3) unstable; urgency=medium * Missed one dependency (python3-setuptools) in the last upload, and diff -Nru spyder-4.2.1+dfsg1/debian/patches/Prevent-double-saving-when-running-a-file.patch spyder-4.2.1+dfsg1/debian/patches/Prevent-double-saving-when-running-a-file.patch --- spyder-4.2.1+dfsg1/debian/patches/Prevent-double-saving-when-running-a-file.patch 1970-01-01 00:00:00.000000000 +0000 +++ spyder-4.2.1+dfsg1/debian/patches/Prevent-double-saving-when-running-a-file.patch 2023-01-09 19:58:36.000000000 +0000 @@ -0,0 +1,183 @@ +From: Edgar Andrés Margffoy Tuay +Subject: Prevent double saving when running a file + This patch has had the line-endings converted to make it compatible +Origin: upstream, https://github.com/spyder-ide/spyder/pull/14759 +Applied-Upstream: https://github.com/spyder-ide/spyder/commit/9325d0d7be1a88602b8092d35be309edc876aa38 +Bug: https://github.com/spyder-ide/spyder/issues/14653 +Bug-Debian: http://bugs.debian.org/989660 +Last-Update: 2022-04-13 + +--- + spyder/plugins/editor/plugin.py | 130 ++++++++++++------------ + spyder/plugins/editor/widgets/editor.py | 4 +- + 2 files changed, 69 insertions(+), 65 deletions(-) + +diff --git a/spyder/plugins/editor/plugin.py b/spyder/plugins/editor/plugin.py +index 1faec3c82..8034714a0 100644 +--- a/spyder/plugins/editor/plugin.py ++++ b/spyder/plugins/editor/plugin.py +@@ -2567,72 +2567,72 @@ def edit_run_configurations(self): + def run_file(self, debug=False): + """Run script inside current interpreter or in a new one""" + editorstack = self.get_current_editorstack() +- if editorstack.save(save_new_files=False): +- editor = self.get_current_editor() +- fname = osp.abspath(self.get_current_filename()) +- +- # Get fname's dirname before we escape the single and double +- # quotes. Fixes spyder-ide/spyder#6771. +- dirname = osp.dirname(fname) + +- # Escape single and double quotes in fname and dirname. +- # Fixes spyder-ide/spyder#2158. +- fname = fname.replace("'", r"\'").replace('"', r'\"') +- dirname = dirname.replace("'", r"\'").replace('"', r'\"') ++ editor = self.get_current_editor() ++ fname = osp.abspath(self.get_current_filename()) + +- runconf = get_run_configuration(fname) +- if runconf is None: +- dialog = RunConfigOneDialog(self) +- dialog.size_change.connect(lambda s: self.set_dialog_size(s)) +- if self.dialog_size is not None: +- dialog.resize(self.dialog_size) +- dialog.setup(fname) +- if CONF.get('run', 'open_at_least_once', +- not running_under_pytest()): +- # Open Run Config dialog at least once: the first time +- # a script is ever run in Spyder, so that the user may +- # see it at least once and be conscious that it exists +- show_dlg = True +- CONF.set('run', 'open_at_least_once', False) +- else: +- # Open Run Config dialog only +- # if ALWAYS_OPEN_FIRST_RUN_OPTION option is enabled +- show_dlg = CONF.get('run', ALWAYS_OPEN_FIRST_RUN_OPTION) +- if show_dlg and not dialog.exec_(): +- return +- runconf = dialog.get_configuration() +- +- args = runconf.get_arguments() +- python_args = runconf.get_python_arguments() +- interact = runconf.interact +- post_mortem = runconf.post_mortem +- current = runconf.current +- systerm = runconf.systerm +- clear_namespace = runconf.clear_namespace +- console_namespace = runconf.console_namespace +- +- if runconf.file_dir: +- wdir = dirname +- elif runconf.cw_dir: +- wdir = '' +- elif osp.isdir(runconf.dir): +- wdir = runconf.dir ++ # Get fname's dirname before we escape the single and double ++ # quotes. Fixes spyder-ide/spyder#6771. ++ dirname = osp.dirname(fname) ++ ++ # Escape single and double quotes in fname and dirname. ++ # Fixes spyder-ide/spyder#2158. ++ fname = fname.replace("'", r"\'").replace('"', r'\"') ++ dirname = dirname.replace("'", r"\'").replace('"', r'\"') ++ ++ runconf = get_run_configuration(fname) ++ if runconf is None: ++ dialog = RunConfigOneDialog(self) ++ dialog.size_change.connect(lambda s: self.set_dialog_size(s)) ++ if self.dialog_size is not None: ++ dialog.resize(self.dialog_size) ++ dialog.setup(fname) ++ if CONF.get('run', 'open_at_least_once', ++ not running_under_pytest()): ++ # Open Run Config dialog at least once: the first time ++ # a script is ever run in Spyder, so that the user may ++ # see it at least once and be conscious that it exists ++ show_dlg = True ++ CONF.set('run', 'open_at_least_once', False) + else: +- wdir = '' +- +- python = True # Note: in the future, it may be useful to run +- # something in a terminal instead of a Python interp. +- self.__last_ec_exec = (fname, wdir, args, interact, debug, +- python, python_args, current, systerm, +- post_mortem, clear_namespace, +- console_namespace) +- self.re_run_file(save_new_files=False) +- if not interact and not debug: +- # If external console dockwidget is hidden, it will be +- # raised in top-level and so focus will be given to the +- # current external shell automatically +- # (see SpyderPluginWidget.visibility_changed method) +- editor.setFocus() ++ # Open Run Config dialog only ++ # if ALWAYS_OPEN_FIRST_RUN_OPTION option is enabled ++ show_dlg = CONF.get('run', ALWAYS_OPEN_FIRST_RUN_OPTION) ++ if show_dlg and not dialog.exec_(): ++ return ++ runconf = dialog.get_configuration() ++ ++ args = runconf.get_arguments() ++ python_args = runconf.get_python_arguments() ++ interact = runconf.interact ++ post_mortem = runconf.post_mortem ++ current = runconf.current ++ systerm = runconf.systerm ++ clear_namespace = runconf.clear_namespace ++ console_namespace = runconf.console_namespace ++ ++ if runconf.file_dir: ++ wdir = dirname ++ elif runconf.cw_dir: ++ wdir = '' ++ elif osp.isdir(runconf.dir): ++ wdir = runconf.dir ++ else: ++ wdir = '' ++ ++ python = True # Note: in the future, it may be useful to run ++ # something in a terminal instead of a Python interp. ++ self.__last_ec_exec = (fname, wdir, args, interact, debug, ++ python, python_args, current, systerm, ++ post_mortem, clear_namespace, ++ console_namespace) ++ self.re_run_file(save_new_files=False) ++ if not interact and not debug: ++ # If external console dockwidget is hidden, it will be ++ # raised in top-level and so focus will be given to the ++ # current external shell automatically ++ # (see SpyderPluginWidget.visibility_changed method) ++ editor.setFocus() + + def set_dialog_size(self, size): + self.dialog_size = size +@@ -2650,7 +2650,9 @@ def debug_file(self): + def re_run_file(self, save_new_files=True): + """Re-run last script""" + if self.get_option('save_all_before_run'): +- self.save_all(save_new_files=save_new_files) ++ all_saved = self.save_all(save_new_files=save_new_files) ++ if not all_saved: ++ return + if self.__last_ec_exec is None: + return + (fname, wdir, args, interact, debug, +diff --git a/spyder/plugins/editor/widgets/editor.py b/spyder/plugins/editor/widgets/editor.py +index cfcbca478..3c5d61e75 100644 +--- a/spyder/plugins/editor/widgets/editor.py ++++ b/spyder/plugins/editor/widgets/editor.py +@@ -2265,9 +2265,11 @@ def save_all(self, save_new_files=True): + + Iterate through self.data and call save() on any modified files. + """ ++ all_saved = True + for index in range(self.get_stack_count()): + if self.data[index].editor.document().isModified(): +- self.save(index, save_new_files=save_new_files) ++ all_saved &= self.save(index, save_new_files=save_new_files) ++ return all_saved + + #------ Update UI + def start_stop_analysis_timer(self): + diff -Nru spyder-4.2.1+dfsg1/debian/patches/series spyder-4.2.1+dfsg1/debian/patches/series --- spyder-4.2.1+dfsg1/debian/patches/series 2021-02-21 09:28:17.000000000 +0000 +++ spyder-4.2.1+dfsg1/debian/patches/series 2023-01-09 19:58:36.000000000 +0000 @@ -4,3 +4,4 @@ 0004-Removed-pylint-dependency.patch 0005-fix-implicit-int-conversion.patch 0006-quieten-dependency-warning +Prevent-double-saving-when-running-a-file.patch