Skip to content

Commit

Permalink
integrate fernandos 0.8.3 release changes to original trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
Ville M. Vainio committed May 29, 2008
2 parents 0d5bf35 + 6b03667 commit cabe846
Show file tree
Hide file tree
Showing 22 changed files with 156 additions and 1,336 deletions.
18 changes: 13 additions & 5 deletions IPython/Magic.py
Expand Up @@ -3140,16 +3140,17 @@ def magic_pycat(self, parameter_s=''):
screen_lines=self.shell.rc.screen_length)

def magic_cpaste(self, parameter_s=''):
"""Allows you to paste & execute a pre-formatted code block from clipboard
"""Allows you to paste & execute a pre-formatted code block from clipboard.
You must terminate the block with '--' (two minus-signs) alone on the
line. You can also provide your own sentinel with '%paste -s %%' ('%%'
is the new sentinel for this operation)
The block is dedented prior to execution to enable execution of method
definitions. '>' and '+' characters at the beginning of a line are
ignored, to allow pasting directly from e-mails, diff files and doctests.
The executed block is also assigned to variable named 'pasted_block' for
ignored, to allow pasting directly from e-mails, diff files and
doctests (the '...' continuation prompt is also stripped). The
executed block is also assigned to variable named 'pasted_block' for
later editing with '%edit pasted_block'.
You can also pass a variable name as an argument, e.g. '%cpaste foo'.
Expand All @@ -3166,8 +3167,15 @@ def magic_cpaste(self, parameter_s=''):
par = args.strip()
sentinel = opts.get('s','--')

strip_from_start = [re.compile(e) for e in
[r'^\s*(\s?>)+',r'^\s*In \[\d+\]:',r'^\++']]
# Regular expressions that declare text we strip from the input:
strip_re = [r'^\s*In \[\d+\]:', # IPython input prompt
r'^\s*(\s?>)+', # Python input prompt
r'^\s*\.{3,}', # Continuation prompts
r'^\++',
]

strip_from_start = map(re.compile,strip_re)

from IPython import iplib
lines = []
print "Pasting code; enter '%s' alone on the line to stop." % sentinel
Expand Down
2 changes: 1 addition & 1 deletion IPython/Release.py
Expand Up @@ -22,7 +22,7 @@
# because bdist_rpm does not accept dashes (an RPM) convention, and
# bdist_deb does not accept underscores (a Debian convention).

revision = '117'
revision = '85'
branch = 'ipython'

if branch == 'ipython':
Expand Down
6 changes: 3 additions & 3 deletions IPython/ultraTB.py
Expand Up @@ -377,8 +377,8 @@ def __init__(self,color_scheme = 'NoColor'):

def __call__(self, etype, value, elist):
Term.cout.flush()
Term.cerr.flush()
print >> Term.cerr, self.text(etype,value,elist)
Term.cerr.flush()

def text(self,etype, value, elist,context=5):
"""Return a color formatted string with the traceback info."""
Expand Down Expand Up @@ -855,8 +855,8 @@ def handler(self, info=None):
(etype, evalue, etb) = info or sys.exc_info()
self.tb = etb
Term.cout.flush()
Term.cerr.flush()
print >> Term.cerr, self.text(etype, evalue, etb)
Term.cerr.flush()

# Changed so an instance can just be called as VerboseTB_inst() and print
# out the right info on its own.
Expand Down Expand Up @@ -977,13 +977,13 @@ def __call__(self,etype=None,evalue=None,etb=None,
if out is None:
out = Term.cerr
Term.cout.flush()
out.flush()
if tb_offset is not None:
tb_offset, self.tb_offset = self.tb_offset, tb_offset
print >> out, self.text(etype, evalue, etb)
self.tb_offset = tb_offset
else:
print >> out, self.text(etype, evalue, etb)
out.flush()
try:
self.debugger()
except KeyboardInterrupt:
Expand Down
23 changes: 9 additions & 14 deletions MANIFEST.in
Expand Up @@ -9,28 +9,23 @@ graft setupext
graft IPython/UserConfig

graft doc
exclude doc/\#*
exclude doc/*.1
exclude doc/manual_base*
exclude doc/ChangeLog.*
exclude doc/\#*
exclude doc/update_magic.sh
exclude doc/update_version.sh
exclude doc/manual_base*
exclude doc/manual/WARNINGS
exclude doc/manual/*.aux
exclude doc/manual/*.log
exclude doc/manual/*.out
exclude doc/manual/*.pl
exclude doc/manual/*.tex

# There seems to be no way of excluding whole subdirectories, other than
# manually excluding all their subdirs. distutils really is horrible...
exclude doc/attic/*
exclude doc/build/doctrees/*
exclude doc/build/latex/*
exclude doc/build/html/_sources/*



exclude doc/build/html/_static/*
exclude doc/build/html/*
exclude doc/build/latex/*

global-exclude *~
global-exclude *.flc
global-exclude *.pyc
global-exclude .dircopy.log
global-exclude .svn
global-exclude .bzr
17 changes: 17 additions & 0 deletions doc/ChangeLog
@@ -1,3 +1,20 @@
2008-05-28 *** Released version 0.8.3

2008-05-28 Fernando Perez <Fernando.Perez@berkeley.edu>

* ../win32_manual_post_install.py (run): Fix the windows installer
so the links to the docs are correct.

* IPython/ultraTB.py: flush stderr after writing to it to fix
problems with exception traceback ordering in some platforms.
Thanks to a report/fix by Jie Tang <jietang86-AT-gmail.com>.

* IPython/Magic.py (magic_cpaste): add stripping of continuation
prompts, feature requested by Stefan vdW.

* ../setup.py: updates to build and release tools in preparation
for 0.8.3 release.

2008-05-27 Ville Vainio <vivainio@gmail.com>

* iplib.py, ipmaker.py: survive lack of doctest and site._Helper
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 12 additions & 2 deletions doc/do_sphinx.py 100644 → 100755
@@ -1,3 +1,7 @@
#!/usr/bin/env python
"""Script to build documentation using Sphinx.
"""

import fileinput,os,sys

def oscmd(c):
Expand All @@ -11,6 +15,7 @@ def oscmd(c):
oscmd('sphinx-build -b latex -d build/doctrees source build/latex')

# Produce pdf.
topdir = os.getcwd()
os.chdir('build/latex')

# Change chapter style to section style: allows chapters to start on
Expand Down Expand Up @@ -60,5 +65,10 @@ def oscmd(c):
oscmd('makeindex -s python.ist modipython.idx')
oscmd('pdflatex ipython.tex')
oscmd('pdflatex ipython.tex')
oscmd('cp ipython.pdf ../html')
os.chdir('../..')

# Create a manual/ directory with final html/pdf output
os.chdir(topdir)
oscmd('rm -rf manual')
oscmd('mkdir manual')
oscmd('cp -r build/html/*.html build/html/_static manual/')
oscmd('cp build/latex/ipython.pdf manual/')
111 changes: 66 additions & 45 deletions setup.py
Expand Up @@ -4,7 +4,7 @@
Under Posix environments it works like a typical setup.py script.
Under Windows, the command sdist is not supported, since IPython
requires utilities, which are not available under Windows."""
requires utilities which are not available under Windows."""

#*****************************************************************************
# Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu>
Expand All @@ -18,15 +18,41 @@
import sys

from glob import glob

# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
# update it when the contents of directories change.
if os.path.exists('MANIFEST'): os.remove('MANIFEST')

from distutils.core import setup
from setupext import install_data_ext

# Local imports
from IPython.genutils import target_update

# A few handy globals
isfile = os.path.isfile
pjoin = os.path.join

# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
# update it when the contents of directories change.
if os.path.exists('MANIFEST'): os.remove('MANIFEST')
##############################################################################
# Utility functions
def oscmd(s):
print ">", s
os.system(s)

# A little utility we'll need below, since glob() does NOT allow you to do
# exclusion on multiple endings!
def file_doesnt_endwith(test,endings):
"""Return true if test is a file and its name does NOT end with any
of the strings listed in endings."""
if not isfile(test):
return False
for e in endings:
if test.endswith(e):
return False
return True

###############################################################################
# Main code begins

if os.name == 'posix':
os_name = 'posix'
Expand All @@ -36,45 +62,45 @@
print 'Unsupported operating system:',os.name
sys.exit(1)

# Under Windows, 'sdist' is not supported, since it requires lyxport (and
# hence lyx,perl,latex,pdflatex,latex2html,sh,...)
# Under Windows, 'sdist' has not been supported. Now that the docs build with
# Sphinx it might work, but let's not turn it on until someone confirms that it
# actually works.
if os_name == 'windows' and 'sdist' in sys.argv:
print 'The sdist command is not available under Windows. Exiting.'
sys.exit(1)

from distutils.core import setup

# update the manuals when building a source dist
if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
import textwrap
from IPython.genutils import target_update
# list of things to be updated. Each entry is a triplet of args for

# List of things to be updated. Each entry is a triplet of args for
# target_update()

def oscmd(s):
print ">", s
os.system(s)

oscmd("cd doc && python do_sphinx.py")

oscmd("cd doc && gzip -9c ipython.1 > ipython.1.gz")
oscmd("cd doc && gzip -9c pycolor.1 > pycolor.1.gz")
to_update = [ # The do_sphinx scripts builds html and pdf, so just one
# target is enough to cover all manual generation
('doc/manual/ipython.pdf',
['IPython/Release.py','doc/source/ipython.rst'],
"cd doc && python do_sphinx.py" ),

# FIXME - Disabled for now: we need to redo an automatic way
# of generating the magic info inside the rst.
#('doc/magic.tex',
#['IPython/Magic.py'],
#"cd doc && ./update_magic.sh" ),

('doc/ipython.1.gz',
['doc/ipython.1'],
"cd doc && gzip -9c ipython.1 > ipython.1.gz"),

('doc/pycolor.1.gz',
['doc/pycolor.1'],
"cd doc && gzip -9c pycolor.1 > pycolor.1.gz"),
]

[ target_update(*t) for t in to_update ]

# Release.py contains version, authors, license, url, keywords, etc.
execfile(pjoin('IPython','Release.py'))

# A little utility we'll need below, since glob() does NOT allow you to do
# exclusion on multiple endings!
def file_doesnt_endwith(test,endings):
"""Return true if test is a file and its name does NOT end with any
of the strings listed in endings."""
if not isfile(test):
return False
for e in endings:
if test.endswith(e):
return False
return True

# I can't find how to make distutils create a nested dir. structure, so
# in the meantime do it manually. Butt ugly.
# Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain
Expand All @@ -87,18 +113,15 @@ def file_doesnt_endwith(test,endings):
# MANIFEST.in file.
exclude = ('.sh','.1.gz')
docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('doc/*'))

examfiles = filter(isfile, glob('doc/examples/*.py'))
manfiles = filter(isfile, glob('doc/build/html/*'))
manstatic = filter(isfile, glob('doc/build/html/_static/*'))

# filter(isfile, glob('doc/manual/*.css')) + \
# filter(isfile, glob('doc/manual/*.png'))

manfiles = filter(isfile, glob('doc/manual/*'))
manstatic = filter(isfile, glob('doc/manual/_static/*'))
manpages = filter(isfile, glob('doc/*.1.gz'))

cfgfiles = filter(isfile, glob('IPython/UserConfig/*'))
scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor',
'scripts/irunner'])

igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*'))

# Script to be run by the windows binary installer after the default setup
Expand Down Expand Up @@ -129,19 +152,15 @@ def file_doesnt_endwith(test,endings):
]}
}
scriptfiles = []
# eggs will lack docs, eaxmples
# eggs will lack docs, examples
datafiles = []

#datafiles = [('lib', 'IPython/UserConfig', cfgfiles)]
else:
# Normal, non-setuptools install
egg_extra_kwds = {}
# package_data of setuptools was introduced to distutils in 2.4
if sys.version_info < (2,4):
datafiles.append(('lib', 'IPython/UserConfig', cfgfiles))




# Call the setup() routine which does most of the work
setup(name = name,
version = version,
Expand All @@ -154,7 +173,9 @@ def file_doesnt_endwith(test,endings):
license = license,
platforms = platforms,
keywords = keywords,
packages = ['IPython', 'IPython.Extensions', 'IPython.external', 'IPython.gui', 'IPython.gui.wx', 'IPython.UserConfig'],
packages = ['IPython', 'IPython.Extensions', 'IPython.external',
'IPython.gui', 'IPython.gui.wx',
'IPython.UserConfig'],
scripts = scriptfiles,
package_data = {'IPython.UserConfig' : ['*'] },

Expand Down

0 comments on commit cabe846

Please sign in to comment.