From ea3dcdd168bebf603c591b286137f28194318287 Mon Sep 17 00:00:00 2001 From: Jorgen Stenarson Date: Thu, 15 Jul 2010 18:23:16 +0200 Subject: [PATCH 1/4] Fixes for bugs #357977 and #372568. --- MANIFEST.in | 8 ++++++++ pyreadline/__init__.py | 2 +- pyreadline/release.py | 8 +++++--- pyreadline/unicode_helper.py | 11 +++++++---- setup.py | 13 ++++++++++--- 5 files changed, 31 insertions(+), 11 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 8a8360f..ffa0645 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,9 @@ include pyreadline/configuration/pyreadlineconfig.ini + +graft doc +exclude doc/\#* +exclude doc/man/*.1 + +# docs subdirs we want to skip +prune doc/attic +prune doc/build diff --git a/pyreadline/__init__.py b/pyreadline/__init__.py index b32f480..9e265f0 100644 --- a/pyreadline/__init__.py +++ b/pyreadline/__init__.py @@ -6,7 +6,7 @@ # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software. #***************************************************************************** -import unicode_helper, logger, clipboard, lineeditor, modes +import unicode_helper, logger, clipboard, lineeditor, modes, console from rlmain import * import rlmain __all__ = [ 'parse_and_bind', diff --git a/pyreadline/release.py b/pyreadline/release.py index b49fbba..e74dae3 100644 --- a/pyreadline/release.py +++ b/pyreadline/release.py @@ -61,11 +61,13 @@ authors = {u'Jorgen' : (u'Jorgen Stenarson',u'jorgen.stenarson@bostream.nu'), url = u'http://ipython.scipy.org/moin/PyReadline/Intro' -download_url = u'' +download_url = u'https://launchpad.net/pyreadline/+download' -platforms = [u'Windows XP/2000/NT',u'Windows 95/98/ME'] +platforms = [u'Windows XP/2000/NT', + u'Windows 95/98/ME'] -keywords = [u'readline',u'pyreadline'] +keywords = [u'readline', + u'pyreadline'] classifiers = [u'Development Status :: 4 - Beta', u'Environment :: Console', diff --git a/pyreadline/unicode_helper.py b/pyreadline/unicode_helper.py index 9addbdd..bf171ab 100644 --- a/pyreadline/unicode_helper.py +++ b/pyreadline/unicode_helper.py @@ -9,10 +9,13 @@ import sys try: pyreadline_codepage = sys.stdout.encoding -except AttributeError: #This error occurs when pdb imports readline and doctest has replaced - #stdout with stdout collector - pyreadline_codepage = u"ascii" #assume ascii codepage - +except AttributeError: + # This error occurs when pdb imports readline and doctest has replaced + # stdout with stdout collector. We will assume ascii codepage + pyreadline_codepage = u"ascii" + +if pyreadline_codepage is None: + pyreadline_codepage = u"ascii" def ensure_unicode(text): u"""helper to ensure that text passed to WriteConsoleW is unicode""" diff --git a/setup.py b/setup.py index 065e60c..151c3be 100644 --- a/setup.py +++ b/setup.py @@ -19,6 +19,13 @@ if os.path.exists('MANIFEST'): os.remove('MANIFEST') from distutils.core import setup execfile('pyreadline/release.py') +try: + import sphinx + from sphinx.setup_command import BuildDoc + cmd_class ={'build_sphinx': BuildDoc} +except ImportError: + cmd_class = None + packages = ['pyreadline','pyreadline.clipboard','pyreadline.configuration', 'pyreadline.console','pyreadline.keysyms','pyreadline.lineeditor', 'pyreadline.modes','pyreadline.test', @@ -35,13 +42,13 @@ setup(name=name, license = license, classifiers = classifiers, url = url, -# download_url = download_url, + download_url = download_url, platforms = platforms, keywords = keywords, py_modules = ['readline'], packages = packages, package_data = {'pyreadline':['configuration/*']}, - data_files = [('share/doc/pyreadline', glob.glob("doc/*")), - ] + data_files = [], + cmdclass = cmd_class, ) From bccf027a4129feeba5157962d13d1a69f1ade4f3 Mon Sep 17 00:00:00 2001 From: Jorgen Stenarson Date: Thu, 15 Jul 2010 19:09:35 +0200 Subject: [PATCH 2/4] Setting version to 1.6 and adding build-doc.bat --- build-doc.bat | 14 ++++++++++++++ pyreadline/release.py | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 build-doc.bat diff --git a/build-doc.bat b/build-doc.bat new file mode 100644 index 0000000..1bcb636 --- /dev/null +++ b/build-doc.bat @@ -0,0 +1,14 @@ +SET VERSION=1.6 +python setup.py build_sphinx +python setup.py build_sphinx -b latex + +pushd build\sphinx\latex +pdflatex pyreadline.tex +pdflatex pyreadline.tex +pdflatex pyreadline.tex +popd + +mkdir dist +copy build\sphinx\latex\pyreadline.pdf dist\pyreadline-%VERSION%.pdf + +xcopy /S /I build\sphinx\html dist\pyreadline-htmldoc-%VERSION% diff --git a/pyreadline/release.py b/pyreadline/release.py index e74dae3..2565374 100644 --- a/pyreadline/release.py +++ b/pyreadline/release.py @@ -22,7 +22,7 @@ name = u'pyreadline' branch = u'' -version = u'1.6.svn' +version = u'1.6' revision = u'$Revision$' From 661f396303bc76529e705661161a6f70e90f2511 Mon Sep 17 00:00:00 2001 From: Jorgen Stenarson Date: Thu, 15 Jul 2010 19:52:53 +0200 Subject: [PATCH 3/4] Adding cleanup code to fix problem in python 2.7 --- pyreadline/logger.py | 20 ++++++++++++++------ pyreadline/rlmain.py | 6 +++++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/pyreadline/logger.py b/pyreadline/logger.py index d85ffb0..d7ef554 100644 --- a/pyreadline/logger.py +++ b/pyreadline/logger.py @@ -35,20 +35,24 @@ class SocketStream(object): def close(self): pass -socket_handler = logging.StreamHandler(SocketStream(host, port)) -socket_handler.setFormatter(formatter) +socket_handler = None root_logger.addHandler(NULLHandler()) - def start_socket_log(): + global socket_handler + socket_handler = logging.StreamHandler(SocketStream(host, port)) + socket_handler.setFormatter(formatter) root_logger.addHandler(socket_handler) def stop_socket_log(): - root_logger.removeHandler(socket_handler) + global socket_handler + if socket_handler: + root_logger.removeHandler(socket_handler) + socket_handler = None def start_file_log(filename): global file_handler - file_handler = logging.handlers.FileHandler(filename, "w") + file_handler = logging.FileHandler(filename, "w") root_logger.addHandler(file_handler) def stop_file_log(): @@ -58,7 +62,11 @@ def stop_file_log(): file_handler.close() file_handler = None +def stop_logging(): + log(u"STOPING LOG") + stop_file_log() + stop_socket_log() + def log(s): s = ensure_str(s) root_logger.debug(s) - diff --git a/pyreadline/rlmain.py b/pyreadline/rlmain.py index c47e1ac..9e3756e 100644 --- a/pyreadline/rlmain.py +++ b/pyreadline/rlmain.py @@ -520,7 +520,11 @@ class Readline(BaseReadline): event = c.getkeypress() except KeyboardInterrupt: event = self.handle_ctrl_c() - result = self.mode.process_keyevent(event.keyinfo) + try: + result = self.mode.process_keyevent(event.keyinfo) + except EOFError: + logger.stop_logging() + raise self._update_line() return result From 76080fa88590b693c0d96811551c8f2d5e7c12af Mon Sep 17 00:00:00 2001 From: Jorgen Stenarson Date: Thu, 15 Jul 2010 19:54:44 +0200 Subject: [PATCH 4/4] Fixing release.py for 1.6 --- pyreadline/release.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pyreadline/release.py b/pyreadline/release.py index 2565374..32d6531 100644 --- a/pyreadline/release.py +++ b/pyreadline/release.py @@ -35,21 +35,20 @@ it is based on the ctypes based UNC readline package by Gary Bishop. It is not complete. It has been tested for use with windows 2000 and windows xp. Features: - * NEW: keyboard text selection and copy/paste + * keyboard text selection and copy/paste * Shift-arrowkeys for text selection - * Control-c can be used for copy activate with allow_ctrl_c(True) is config file + * Control-c can be used for copy activate with allow_ctrl_c(True) in config file * Double tapping ctrl-c will raise a KeyboardInterrupt, use ctrl_c_tap_time_interval(x) where x is your preferred tap time window, default 0.3 s. * paste pastes first line of content on clipboard. * ipython_paste, pastes tab-separated data as list of lists or numpy array if all data is numeric * paste_mulitline_code pastes multi line code, removing any empty lines. - * Experimental support for ironpython. At this time Ironpython has to be patched for it to work. The latest development version is always available at the IPython subversion repository_. -.. _repository: http://ipython.scipy.org/svn/ipython/pyreadline/trunk#egg=pyreadline-dev +.. _repository: """ license = u'BSD' @@ -69,8 +68,15 @@ platforms = [u'Windows XP/2000/NT', keywords = [u'readline', u'pyreadline'] -classifiers = [u'Development Status :: 4 - Beta', +classifiers = [u'Development Status :: 5 - Production/Stable', u'Environment :: Console', - u'Operating System :: Microsoft :: Windows',] + u'Operating System :: Microsoft :: Windows', + u'License :: OSI Approved :: BSD License', + u'Programming Language :: Python :: 2.4', + u'Programming Language :: Python :: 2.5', + u'Programming Language :: Python :: 2.6', + u'Programming Language :: Python :: 2.7', + + ]