Hello community, here is the log from the commit of package python-ipdb for openSUSE:Factory checked in at 2020-03-04 09:47:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-ipdb (Old) and /work/SRC/openSUSE:Factory/.python-ipdb.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-ipdb" Wed Mar 4 09:47:16 2020 rev:6 rq:781246 version:0.13.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-ipdb/python-ipdb.changes 2020-01-03 17:37:56.155324973 +0100 +++ /work/SRC/openSUSE:Factory/.python-ipdb.new.26092/python-ipdb.changes 2020-03-04 09:47:32.822184615 +0100 @@ -1,0 +2,10 @@ +Tue Mar 3 14:35:47 UTC 2020 - Todd R <[email protected]> + +- Update to 0.13.2 + * Remove leftover debug code +- Update to 0.13.1 + * Fix when no configuration file +- Update to 0.13.0 + * Add option to set context via environment variable or configuration file. + +------------------------------------------------------------------- Old: ---- ipdb-0.12.3.tar.gz New: ---- ipdb-0.13.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-ipdb.spec ++++++ --- /var/tmp/diff_new_pack.mXyxzo/_old 2020-03-04 09:47:33.662185119 +0100 +++ /var/tmp/diff_new_pack.mXyxzo/_new 2020-03-04 09:47:33.666185121 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-ipdb # -# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-ipdb -Version: 0.12.3 +Version: 0.13.2 Release: 0 Summary: IPython-enabled pdb License: BSD-3-Clause ++++++ ipdb-0.12.3.tar.gz -> ipdb-0.13.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipdb-0.12.3/HISTORY.txt new/ipdb-0.13.2/HISTORY.txt --- old/ipdb-0.12.3/HISTORY.txt 2019-12-03 12:30:30.000000000 +0100 +++ new/ipdb-0.13.2/HISTORY.txt 2020-03-03 12:20:50.000000000 +0100 @@ -1,6 +1,27 @@ Changelog ========= +0.13.2 (2020-03-03) +------------------- + +- Remove leftover debug code + [gotcha] + + +0.13.1 (2020-02-28) +------------------- + +- Fix when no configuration file + [gotcha] + + +0.13.0 (2020-02-28) +------------------- + +- Add option to set context via environment variable or configuration file. + [alexandrebarbaruiva] + + 0.12.3 (2019-12-03) ------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipdb-0.12.3/PKG-INFO new/ipdb-0.13.2/PKG-INFO --- old/ipdb-0.12.3/PKG-INFO 2019-12-03 12:30:31.000000000 +0100 +++ new/ipdb-0.13.2/PKG-INFO 2020-03-03 12:20:51.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: ipdb -Version: 0.12.3 +Version: 0.13.2 Summary: IPython-enabled pdb Home-page: https://github.com/gotcha/ipdb Author: Godefroid Chapelle @@ -29,11 +29,18 @@ ipdb.set_trace() ipdb.set_trace(context=5) # will show five lines of code # instead of the default three lines + # or you can set it via IPDB_CONTEXT_SIZE env variable + # or setup.cfg file ipdb.pm() ipdb.run('x[0] = 3') result = ipdb.runcall(function, arg0, arg1, kwarg='foo') result = ipdb.runeval('f(1,2) - 3') + It's possible to set up context using a `.ipdb` file on your home folder or `setup.cfg` + on your project folder. You can also set your file location via env var `$IPDB_CONFIG`. + Your environment variable has priority over the home configuration file, + which in turn has priority over the setup config file. + The post-mortem function, ``ipdb.pm()``, is equivalent to the magic function ``%debug``. @@ -86,7 +93,7 @@ However, all strategies tried until 0.9.4 have proven brittle. If you use ``nose`` or another tool that fiddles with ``stdout``, you should - explicitely ask for ``stdout`` fiddling by using ``ipdb`` like this + explicitly ask for ``stdout`` fiddling by using ``ipdb`` like this .. code-block:: python @@ -137,6 +144,27 @@ Changelog ========= + 0.13.2 (2020-03-03) + ------------------- + + - Remove leftover debug code + [gotcha] + + + 0.13.1 (2020-02-28) + ------------------- + + - Fix when no configuration file + [gotcha] + + + 0.13.0 (2020-02-28) + ------------------- + + - Add option to set context via environment variable or configuration file. + [alexandrebarbaruiva] + + 0.12.3 (2019-12-03) ------------------- @@ -408,6 +436,9 @@ Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 Classifier: Operating System :: MacOS :: MacOS X Classifier: Operating System :: POSIX :: Linux Classifier: Operating System :: Microsoft :: Windows diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipdb-0.12.3/README.rst new/ipdb-0.13.2/README.rst --- old/ipdb-0.12.3/README.rst 2019-12-03 12:30:30.000000000 +0100 +++ new/ipdb-0.13.2/README.rst 2020-03-03 12:20:50.000000000 +0100 @@ -21,11 +21,18 @@ ipdb.set_trace() ipdb.set_trace(context=5) # will show five lines of code # instead of the default three lines + # or you can set it via IPDB_CONTEXT_SIZE env variable + # or setup.cfg file ipdb.pm() ipdb.run('x[0] = 3') result = ipdb.runcall(function, arg0, arg1, kwarg='foo') result = ipdb.runeval('f(1,2) - 3') +It's possible to set up context using a `.ipdb` file on your home folder or `setup.cfg` +on your project folder. You can also set your file location via env var `$IPDB_CONFIG`. +Your environment variable has priority over the home configuration file, +which in turn has priority over the setup config file. + The post-mortem function, ``ipdb.pm()``, is equivalent to the magic function ``%debug``. @@ -78,7 +85,7 @@ However, all strategies tried until 0.9.4 have proven brittle. If you use ``nose`` or another tool that fiddles with ``stdout``, you should -explicitely ask for ``stdout`` fiddling by using ``ipdb`` like this +explicitly ask for ``stdout`` fiddling by using ``ipdb`` like this .. code-block:: python diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipdb-0.12.3/ipdb/__main__.py new/ipdb-0.13.2/ipdb/__main__.py --- old/ipdb-0.12.3/ipdb/__main__.py 2019-12-03 12:30:30.000000000 +0100 +++ new/ipdb-0.13.2/ipdb/__main__.py 2020-03-03 12:20:50.000000000 +0100 @@ -10,12 +10,16 @@ from contextlib import contextmanager -__version__ = '0.12.3' +__version__ = '0.13.2' from IPython import get_ipython from IPython.core.debugger import BdbQuit_excepthook from IPython.terminal.ipapp import TerminalIPythonApp from IPython.terminal.embed import InteractiveShellEmbed +try: + import configparser +except: + import ConfigParser as configparser shell = get_ipython() @@ -60,8 +64,12 @@ sys.excepthook = BdbQuit_excepthook -def set_trace(frame=None, context=3): +def set_trace(frame=None, context=None): wrap_sys_excepthook() + if not context: + context = os.environ.get( + "IPDB_CONTEXT_SIZE", get_context_from_config() + ) if frame is None: frame = sys._getframe().f_back p = _init_pdb(context).set_trace(frame) @@ -69,6 +77,105 @@ p.shell.restore_sys_module_state() +def get_context_from_config(): + try: + parser = get_config() + return parser.getint("ipdb", "context") + except (configparser.NoSectionError, configparser.NoOptionError): + return 3 + except ValueError: + value = parser.get("ipdb", "context") + raise ValueError( + "In %s, context value [%s] cannot be converted into an integer." + % (parser.filepath, value) + ) + + +class ConfigFile(object): + """ + Filehandle wrapper that adds a "[ipdb]" section to the start of a config + file so that users don't actually have to manually add a [ipdb] section. + Works with configparser versions from both Python 2 and 3 + """ + + def __init__(self, filepath): + self.first = True + with open(filepath) as f: + self.lines = f.readlines() + + # Python 2.7 (Older dot versions) + def readline(self): + try: + return self.__next__() + except StopIteration: + return '' + + # Python 2.7 (Newer dot versions) + def next(self): + return self.__next__() + + # Python 3 + def __iter__(self): + return self + + def __next__(self): + if self.first: + self.first = False + return "[ipdb]\n" + if self.lines: + return self.lines.pop(0) + raise StopIteration + + +def get_config(): + """ + Get ipdb config file settings. + All available config files are read. If settings are in multiple configs, + the last value encountered wins. Values specified on the command-line take + precedence over all config file settings. + Returns: A ConfigParser object. + """ + parser = configparser.ConfigParser() + + filepaths = [] + + # Low priority goes first in the list + for cfg_file in ("setup.cfg", ".ipdb"): + cwd_filepath = os.path.join(os.getcwd(), cfg_file) + if os.path.isfile(cwd_filepath): + filepaths.append(cwd_filepath) + + # Medium priority (whenever user wants to set a specific path to config file) + home = os.getenv("HOME") + if home: + default_filepath = os.path.join(home, ".ipdb") + if os.path.isfile(default_filepath): + filepaths.append(default_filepath) + + # High priority (default files) + env_filepath = os.getenv("IPDB_CONFIG") + if env_filepath and os.path.isfile(env_filepath): + filepaths.append(env_filepath) + + if filepaths: + # Python 3 has parser.read_file(iterator) while Python2 has + # parser.readfp(obj_with_readline) + try: + read_func = parser.read_file + except AttributeError: + read_func = parser.readfp + for filepath in filepaths: + parser.filepath = filepath + # Users are expected to put an [ipdb] section + # only if they use setup.cfg + if filepath.endswith('setup.cfg'): + with open(filepath) as f: + read_func(f) + else: + read_func(ConfigFile(filepath)) + return parser + + def post_mortem(tb=None): wrap_sys_excepthook() p = _init_pdb() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipdb-0.12.3/ipdb.egg-info/PKG-INFO new/ipdb-0.13.2/ipdb.egg-info/PKG-INFO --- old/ipdb-0.12.3/ipdb.egg-info/PKG-INFO 2019-12-03 12:30:30.000000000 +0100 +++ new/ipdb-0.13.2/ipdb.egg-info/PKG-INFO 2020-03-03 12:20:51.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: ipdb -Version: 0.12.3 +Version: 0.13.2 Summary: IPython-enabled pdb Home-page: https://github.com/gotcha/ipdb Author: Godefroid Chapelle @@ -29,11 +29,18 @@ ipdb.set_trace() ipdb.set_trace(context=5) # will show five lines of code # instead of the default three lines + # or you can set it via IPDB_CONTEXT_SIZE env variable + # or setup.cfg file ipdb.pm() ipdb.run('x[0] = 3') result = ipdb.runcall(function, arg0, arg1, kwarg='foo') result = ipdb.runeval('f(1,2) - 3') + It's possible to set up context using a `.ipdb` file on your home folder or `setup.cfg` + on your project folder. You can also set your file location via env var `$IPDB_CONFIG`. + Your environment variable has priority over the home configuration file, + which in turn has priority over the setup config file. + The post-mortem function, ``ipdb.pm()``, is equivalent to the magic function ``%debug``. @@ -86,7 +93,7 @@ However, all strategies tried until 0.9.4 have proven brittle. If you use ``nose`` or another tool that fiddles with ``stdout``, you should - explicitely ask for ``stdout`` fiddling by using ``ipdb`` like this + explicitly ask for ``stdout`` fiddling by using ``ipdb`` like this .. code-block:: python @@ -137,6 +144,27 @@ Changelog ========= + 0.13.2 (2020-03-03) + ------------------- + + - Remove leftover debug code + [gotcha] + + + 0.13.1 (2020-02-28) + ------------------- + + - Fix when no configuration file + [gotcha] + + + 0.13.0 (2020-02-28) + ------------------- + + - Add option to set context via environment variable or configuration file. + [alexandrebarbaruiva] + + 0.12.3 (2019-12-03) ------------------- @@ -408,6 +436,9 @@ Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 Classifier: Operating System :: MacOS :: MacOS X Classifier: Operating System :: POSIX :: Linux Classifier: Operating System :: Microsoft :: Windows diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipdb-0.12.3/ipdb.egg-info/SOURCES.txt new/ipdb-0.13.2/ipdb.egg-info/SOURCES.txt --- old/ipdb-0.12.3/ipdb.egg-info/SOURCES.txt 2019-12-03 12:30:31.000000000 +0100 +++ new/ipdb-0.13.2/ipdb.egg-info/SOURCES.txt 2020-03-03 12:20:51.000000000 +0100 @@ -17,4 +17,5 @@ ipdb.egg-info/top_level.txt ipdb.egg-info/zip-safe tests/__init__.py +tests/test_config.py tests/test_import.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipdb-0.12.3/setup.py new/ipdb-0.13.2/setup.py --- old/ipdb-0.12.3/setup.py 2019-12-03 12:30:30.000000000 +0100 +++ new/ipdb-0.13.2/setup.py 2020-03-03 12:20:50.000000000 +0100 @@ -33,6 +33,9 @@ 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'Operating System :: MacOS :: MacOS X', 'Operating System :: POSIX :: Linux', 'Operating System :: Microsoft :: Windows', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipdb-0.12.3/tests/test_config.py new/ipdb-0.13.2/tests/test_config.py --- old/ipdb-0.12.3/tests/test_config.py 1970-01-01 01:00:00.000000000 +0100 +++ new/ipdb-0.13.2/tests/test_config.py 2020-03-03 12:20:50.000000000 +0100 @@ -0,0 +1,233 @@ +# Copyright (c) 2012-2016 Marc Abramowitz and ipdb development team +# +# This file is part of ipdb. +# Redistributable under the revised BSD license +# https://opensource.org/licenses/BSD-3-Clause + +try: + import configparser +except: + import ConfigParser as configparser +import unittest +import os +import tempfile +import shutil +from ipdb.__main__ import get_config + + +class ModifiedEnvironment(object): + """ + I am a context manager that sets up environment variables for a test case. + """ + + def __init__(self, **kwargs): + self.prev = {} + self.excur = kwargs + for k in kwargs: + self.prev[k] = os.getenv(k) + + def __enter__(self): + self.update_environment(self.excur) + + def __exit__(self, type, value, traceback): + self.update_environment(self.prev) + + def update_environment(self, d): + for k in d: + if d[k] is None: + if k in os.environ: + del os.environ[k] + else: + os.environ[k] = d[k] + + +class ConfigTest(unittest.TestCase): + """ + All variations of config file parsing works as expected. + """ + + def _write_file(self, path, lines): + f = open(path, "w") + f.writelines([x + "\n" for x in lines]) + f.close() + + def setUp(self): + """ + Create all temporary config files for testing + """ + self.tmpd = tempfile.mkdtemp() + self.addCleanup(shutil.rmtree, self.tmpd) + # Set CWD to known empty directory so we don't pick up some other .ipdb + # file from the CWD tests are actually run from. + save_cwd = os.getcwd() + self.addCleanup(os.chdir, save_cwd) + cwd_dir = os.path.join(self.tmpd, "cwd") + os.mkdir(cwd_dir) + os.chdir(cwd_dir) + # This represents the $HOME config file, and doubles for the current + # working directory config file if we set CWD to self.tmpd + self.default_filename = os.path.join(self.tmpd, ".ipdb") + self.default_context = 10 + self._write_file( + self.default_filename, + [ + "# this is a test config file for ipdb", + "context = {}".format(str(self.default_context)), + ], + ) + self.env_filename = os.path.join(self.tmpd, "ipdb.env") + self.env_context = 20 + self._write_file( + self.env_filename, + [ + "# this is a test config file for ipdb", + "context = {}".format(str(self.env_context)), + ], + ) + self.setup_filename = os.path.join(cwd_dir, "setup.cfg") + self.setup_context = 25 + self._write_file( + self.setup_filename, + [ + "[ipdb]", + "context = {}".format(str(self.setup_context)), + ], + ) + + def test_env_nodef_nosetup(self): + """ + Setup: $IPDB_CONFIG is set, $HOME/.ipdb does not exist, + setup.cfg does not exist + Result: load $IPDB_CONFIG + """ + os.unlink(self.default_filename) + os.remove(self.setup_filename) + with ModifiedEnvironment(IPDB_CONFIG=self.env_filename, + HOME=self.tmpd): + cfg = get_config() + self.assertEqual(["ipdb"], cfg.sections()) + self.assertEqual(self.env_context, cfg.getint("ipdb", "context")) + self.assertRaises(configparser.NoOptionError, cfg.getboolean, "ipdb", "version") + + def test_noenv_def_nosetup(self): + """ + Setup: $IPDB_CONFIG unset, $HOME/.ipdb exists, + setup.cfg does not exist + Result: load $HOME/.ipdb + """ + os.unlink(self.env_filename) + os.remove(self.setup_filename) + with ModifiedEnvironment(IPDB_CONFIG=None, HOME=self.tmpd): + cfg = get_config() + self.assertEqual(["ipdb"], cfg.sections()) + self.assertEqual(self.default_context, cfg.getint("ipdb", "context")) + self.assertRaises(configparser.NoOptionError, cfg.get, "ipdb", "version") + + def test_noenv_nodef_nosetup(self): + """ + Setup: $IPDB_CONFIG unset, $HOME/.ipdb does not + exist, setup.cfg does not exist + Result: load nothing + """ + os.unlink(self.env_filename) + os.unlink(self.default_filename) + os.remove(self.setup_filename) + with ModifiedEnvironment(IPDB_CONFIG=None, HOME=self.tmpd): + cfg = get_config() + self.assertEqual([], cfg.sections()) + + def test_env_cwd(self): + """ + Setup: $IPDB_CONFIG is set, .ipdb in local dir, + setup.cfg does not exist + Result: load .ipdb + """ + os.chdir(self.tmpd) # setUp is already set to restore us to our pre-testing cwd + os.remove(self.setup_filename) + with ModifiedEnvironment(IPDB_CONFIG=self.env_filename, + HOME=self.tmpd): + cfg = get_config() + self.assertEqual(["ipdb"], cfg.sections()) + self.assertEqual(self.env_context, cfg.getint("ipdb", "context")) + self.assertRaises(configparser.NoOptionError, cfg.get, "ipdb", "version") + + def test_env_def_nosetup(self): + """ + Setup: $IPDB_CONFIG is set, $HOME/.ipdb exists, + setup.cfg does not exist + Result: load $IPDB_CONFIG + """ + os.remove(self.setup_filename) + with ModifiedEnvironment(IPDB_CONFIG=self.env_filename, + HOME=self.tmpd): + cfg = get_config() + self.assertEqual(["ipdb"], cfg.sections()) + self.assertEqual(self.env_context, cfg.getint("ipdb", "context")) + self.assertRaises(configparser.NoOptionError, cfg.get, "ipdb", "version") + + def test_noenv_def_setup(self): + """ + Setup: $IPDB_CONFIG unset, $HOME/.ipdb exists, + setup.cfg exists + Result: load $HOME/.ipdb + """ + os.unlink(self.env_filename) + with ModifiedEnvironment(IPDB_CONFIG=None, HOME=self.tmpd): + cfg = get_config() + self.assertEqual(["ipdb"], cfg.sections()) + self.assertEqual(self.default_context, cfg.getint("ipdb", "context")) + self.assertRaises(configparser.NoOptionError, cfg.getboolean, "ipdb", "version") + + def test_noenv_nodef_setup(self): + """ + Setup: $IPDB_CONFIG unset, $HOME/.ipdb does not exist, + setup.cfg exists + Result: load setup + """ + os.unlink(self.env_filename) + os.unlink(self.default_filename) + with ModifiedEnvironment(IPDB_CONFIG=None, HOME=self.tmpd): + cfg = get_config() + self.assertEqual(["ipdb"], cfg.sections()) + self.assertEqual(self.setup_context, cfg.getint("ipdb", "context")) + self.assertRaises(configparser.NoOptionError, cfg.get, "ipdb", "version") + + def test_env_def_setup(self): + """ + Setup: $IPDB_CONFIG is set, $HOME/.ipdb exists, + setup.cfg exists + Result: load $IPDB_CONFIG + """ + with ModifiedEnvironment(IPDB_CONFIG=self.env_filename, + HOME=self.tmpd): + cfg = get_config() + self.assertEqual(["ipdb"], cfg.sections()) + self.assertEqual(self.env_context, cfg.getint("ipdb", "context")) + self.assertRaises(configparser.NoOptionError, cfg.get, "ipdb", "version") + + def test_env_nodef_setup(self): + """ + Setup: $IPDB_CONFIG is set, $HOME/.ipdb does not + exist, setup.cfg exists + Result: load $IPDB_CONFIG + """ + os.unlink(self.default_filename) + with ModifiedEnvironment(IPDB_CONFIG=self.env_filename, + HOME=self.tmpd): + cfg = get_config() + self.assertEqual(["ipdb"], cfg.sections()) + self.assertEqual(self.env_context, cfg.getint("ipdb", "context")) + self.assertRaises(configparser.NoOptionError, cfg.getboolean, "ipdb", "version") + + def test_noenv_def_setup(self): + """ + Setup: $IPDB_CONFIG unset, $HOME/.ipdb exists, + setup.cfg exists + Result: load $HOME/.ipdb + """ + os.unlink(self.env_filename) + with ModifiedEnvironment(IPDB_CONFIG=None, HOME=self.tmpd): + cfg = get_config() + self.assertEqual(["ipdb"], cfg.sections()) + self.assertEqual(self.default_context, cfg.getint("ipdb", "context")) + self.assertRaises(configparser.NoOptionError, cfg.get, "ipdb", "version")
