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/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/__init__.py b/pyreadline/__init__.py index 05a5622..8e7b9c8 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 import release - diff --git a/pyreadline/logger.py b/pyreadline/logger.py index e0aeb7d..81e3dc4 100644 --- a/pyreadline/logger.py +++ b/pyreadline/logger.py @@ -36,16 +36,20 @@ class SocketStream(object): def close(self): pass -socket_handler = logging.StreamHandler(SocketStream(host, port)) -socket_handler.setFormatter(formatter) +socket_handler = None pyreadline_logger.addHandler(NULLHandler()) - def start_socket_log(): + global socket_handler + socket_handler = logging.StreamHandler(SocketStream(host, port)) + socket_handler.setFormatter(formatter) pyreadline_logger.addHandler(socket_handler) def stop_socket_log(): - pyreadline_logger.removeHandler(socket_handler) + global socket_handler + if socket_handler: + pyreadline_logger.removeHandler(socket_handler) + socket_handler = None def start_file_log(filename): global file_handler @@ -59,7 +63,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) pyreadline_logger.debug(s) - diff --git a/pyreadline/release.py b/pyreadline/release.py index b49fbba..cc137ac 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.7' revision = u'$Revision$' @@ -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' @@ -61,14 +60,23 @@ 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', +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', + + ] diff --git a/pyreadline/rlmain.py b/pyreadline/rlmain.py index 64a01ce..db494a8 100644 --- a/pyreadline/rlmain.py +++ b/pyreadline/rlmain.py @@ -534,7 +534,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 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, )