From fea50de713dbb34c40634df7945edfda9395e39a 2008-02-28 18:30:23 From: Ville M. Vainio Date: 2008-02-28 18:30:23 Subject: [PATCH] more crlf --- diff --git a/ChangeLog b/ChangeLog index 0545819..8d406a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,3 @@ -This file used to be symlink in SVN, but now it serves as a *warning* so that -nobody creates symlinks to the bzr repository - +This file used to be symlink in SVN, but now it serves as a *warning* so that +nobody creates symlinks to the bzr repository + diff --git a/MANIFEST.in b/MANIFEST.in index 01b1313..4e3de84 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,30 +1,30 @@ -include README_Windows.txt -include win32_manual_post_install.py -include ipython.py - -graft scripts - -graft setupext - -graft IPython/UserConfig - -graft 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 - -global-exclude *~ -global-exclude *.flc -global-exclude *.pyc -global-exclude .dircopy.log -global-exclude .svn +include README_Windows.txt +include win32_manual_post_install.py +include ipython.py + +graft scripts + +graft setupext + +graft IPython/UserConfig + +graft 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 + +global-exclude *~ +global-exclude *.flc +global-exclude *.pyc +global-exclude .dircopy.log +global-exclude .svn diff --git a/README b/README index 57ab77e..aec04be 100644 --- a/README +++ b/README @@ -1,11 +1,11 @@ -Please see the doc/ directory for full manuals and other documents. The manual is -prepared using the LyX system (www.lyx.org), but in the doc/manual directory -you'll find HTML and PDF versions. - -These manuals normally get installed to $PREFIX/share/doc/ipython-VERSION, unless you -redirect the installer via a --prefix/--home option. Normally, $PREFIX is -/usr, but your Python may be installed elsewhere. You can see its value by -running: - -python -c "import sys;print sys.prefix" - +Please see the doc/ directory for full manuals and other documents. The manual is +prepared using the LyX system (www.lyx.org), but in the doc/manual directory +you'll find HTML and PDF versions. + +These manuals normally get installed to $PREFIX/share/doc/ipython-VERSION, unless you +redirect the installer via a --prefix/--home option. Normally, $PREFIX is +/usr, but your Python may be installed elsewhere. You can see its value by +running: + +python -c "import sys;print sys.prefix" + diff --git a/README_Windows.txt b/README_Windows.txt index 65965e3..0ad13a7 100644 --- a/README_Windows.txt +++ b/README_Windows.txt @@ -1,50 +1,50 @@ -Notes for Windows Users -======================= - -See http://ipython.scipy.org/moin/IpythonOnWindows for up-to-date information -about running IPython on Windows. - - -Requirements ------------- - -IPython runs under (as far as the Windows family is concerned): - -- Windows XP, 2000 (and probably WinNT): works well. It needs: - - * PyWin32: http://sourceforge.net/projects/pywin32/ - - * PyReadline: http://ipython.scipy.org/moin/PyReadline/Intro - - * If you are using Python2.4, this in turn requires Tomas Heller's ctypes - from: http://starship.python.net/crew/theller/ctypes (not needed for Python - 2.5 users, since 2.5 already ships with ctypes). - -- Windows 95/98/ME: I have no idea. It should work, but I can't test. - -- CygWin environments should work, they are basically Posix. - -It needs Python 2.3 or newer. - - -Installation ------------- - -Double-click the supplied .exe installer file. If all goes well, that's all -you need to do. You should now have an IPython entry in your Start Menu. - - -Installation from source distribution -------------------------------------- - -In case the automatic installer does not work for some reason, you can -download the ipython-XXX.tar.gz file, which contains the full IPython source -distribution (the popular WinZip can read .tar.gz files). - -After uncompressing the archive, you can install it at a command terminal just -like any other Python module, by using python setup.py install'. After this -completes, you can run the supplied win32_manual_post_install.py script which -will add the relevant shortcuts to your startup menu. - -Optionally, you may skip installation altogether and just launch "ipython.py" -from the root folder of the extracted source distribution. +Notes for Windows Users +======================= + +See http://ipython.scipy.org/moin/IpythonOnWindows for up-to-date information +about running IPython on Windows. + + +Requirements +------------ + +IPython runs under (as far as the Windows family is concerned): + +- Windows XP, 2000 (and probably WinNT): works well. It needs: + + * PyWin32: http://sourceforge.net/projects/pywin32/ + + * PyReadline: http://ipython.scipy.org/moin/PyReadline/Intro + + * If you are using Python2.4, this in turn requires Tomas Heller's ctypes + from: http://starship.python.net/crew/theller/ctypes (not needed for Python + 2.5 users, since 2.5 already ships with ctypes). + +- Windows 95/98/ME: I have no idea. It should work, but I can't test. + +- CygWin environments should work, they are basically Posix. + +It needs Python 2.3 or newer. + + +Installation +------------ + +Double-click the supplied .exe installer file. If all goes well, that's all +you need to do. You should now have an IPython entry in your Start Menu. + + +Installation from source distribution +------------------------------------- + +In case the automatic installer does not work for some reason, you can +download the ipython-XXX.tar.gz file, which contains the full IPython source +distribution (the popular WinZip can read .tar.gz files). + +After uncompressing the archive, you can install it at a command terminal just +like any other Python module, by using python setup.py install'. After this +completes, you can run the supplied win32_manual_post_install.py script which +will add the relevant shortcuts to your startup menu. + +Optionally, you may skip installation altogether and just launch "ipython.py" +from the root folder of the extracted source distribution. diff --git a/exesetup.py b/exesetup.py index 1fa7cd6..ef38539 100644 --- a/exesetup.py +++ b/exesetup.py @@ -1,106 +1,106 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -r"""Setup script for exe distribution of IPython (does not require python). - -- Requires py2exe - -- install pyreadline *package dir* in ipython root directory by running: - -svn co http://ipython.scipy.org/svn/ipython/pyreadline/branches/maintenance_1.3/pyreadline/ -wget http://ipython.scipy.org/svn/ipython/pyreadline/branches/maintenance_1.3/readline.py - -OR (if you want the latest trunk): - -svn co http://ipython.scipy.org/svn/ipython/pyreadline/trunk/pyreadline - -- Create the distribution in 'dist' by running "python exesetup.py py2exe" - -- Run ipython.exe to go. - -""" - -#***************************************************************************** -# Copyright (C) 2001-2005 Fernando Perez -# -# Distributed under the terms of the BSD License. The full license is in -# the file COPYING, distributed as part of this software. -#***************************************************************************** - -# Stdlib imports -import os -import sys - -from glob import glob - - -# A few handy globals -isfile = os.path.isfile -pjoin = os.path.join - -from distutils.core import setup -from distutils import dir_util -import py2exe - -# update the manuals when building a source dist -# 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 - - -egg_extra_kwds = {} - -# Call the setup() routine which does most of the work -setup(name = name, - options = { - 'py2exe': { - 'packages' : ['IPython', 'IPython.Extensions', 'IPython.external', - 'pyreadline'], - 'excludes' : ["Tkconstants","Tkinter","tcl",'IPython.igrid','wx', - 'wxPython','igrid', 'PyQt4', 'zope', 'Zope', 'Zope2', - '_curses','enthought.traits','gtk','qt', 'pydb','idlelib', - ] - - } - }, - version = version, - description = description, - long_description = long_description, - author = authors['Fernando'][0], - author_email = authors['Fernando'][1], - url = url, - download_url = download_url, - license = license, - platforms = platforms, - keywords = keywords, - console = ['ipykit.py'], - - # extra params needed for eggs - **egg_extra_kwds - ) - -minimal_conf = """ -import IPython.ipapi -ip = IPython.ipapi.get() - -ip.load('ipy_kitcfg') -import ipy_profile_sh -""" - -if not os.path.isdir("dist/_ipython"): - print "Creating simple _ipython dir" - os.mkdir("dist/_ipython") - open("dist/_ipython/ipythonrc.ini","w").write("# intentionally blank\n") - open("dist/_ipython/ipy_user_conf.py","w").write(minimal_conf) - if os.path.isdir('bin'): - dir_util.copy_tree('bin','dist/bin') +#!/usr/bin/env python +# -*- coding: utf-8 -*- +r"""Setup script for exe distribution of IPython (does not require python). + +- Requires py2exe + +- install pyreadline *package dir* in ipython root directory by running: + +svn co http://ipython.scipy.org/svn/ipython/pyreadline/branches/maintenance_1.3/pyreadline/ +wget http://ipython.scipy.org/svn/ipython/pyreadline/branches/maintenance_1.3/readline.py + +OR (if you want the latest trunk): + +svn co http://ipython.scipy.org/svn/ipython/pyreadline/trunk/pyreadline + +- Create the distribution in 'dist' by running "python exesetup.py py2exe" + +- Run ipython.exe to go. + +""" + +#***************************************************************************** +# Copyright (C) 2001-2005 Fernando Perez +# +# Distributed under the terms of the BSD License. The full license is in +# the file COPYING, distributed as part of this software. +#***************************************************************************** + +# Stdlib imports +import os +import sys + +from glob import glob + + +# A few handy globals +isfile = os.path.isfile +pjoin = os.path.join + +from distutils.core import setup +from distutils import dir_util +import py2exe + +# update the manuals when building a source dist +# 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 + + +egg_extra_kwds = {} + +# Call the setup() routine which does most of the work +setup(name = name, + options = { + 'py2exe': { + 'packages' : ['IPython', 'IPython.Extensions', 'IPython.external', + 'pyreadline'], + 'excludes' : ["Tkconstants","Tkinter","tcl",'IPython.igrid','wx', + 'wxPython','igrid', 'PyQt4', 'zope', 'Zope', 'Zope2', + '_curses','enthought.traits','gtk','qt', 'pydb','idlelib', + ] + + } + }, + version = version, + description = description, + long_description = long_description, + author = authors['Fernando'][0], + author_email = authors['Fernando'][1], + url = url, + download_url = download_url, + license = license, + platforms = platforms, + keywords = keywords, + console = ['ipykit.py'], + + # extra params needed for eggs + **egg_extra_kwds + ) + +minimal_conf = """ +import IPython.ipapi +ip = IPython.ipapi.get() + +ip.load('ipy_kitcfg') +import ipy_profile_sh +""" + +if not os.path.isdir("dist/_ipython"): + print "Creating simple _ipython dir" + os.mkdir("dist/_ipython") + open("dist/_ipython/ipythonrc.ini","w").write("# intentionally blank\n") + open("dist/_ipython/ipy_user_conf.py","w").write(minimal_conf) + if os.path.isdir('bin'): + dir_util.copy_tree('bin','dist/bin') diff --git a/ipykit.py b/ipykit.py index a750788..622494f 100644 --- a/ipykit.py +++ b/ipykit.py @@ -1,21 +1,21 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" IPykit launcher - -w/o args, this launches a full ipykit session. - -If the first arg is a .py script, it will be run WITHOUT ipython, -to facilitate running python scripts almost normally on machines w/o python -in their own process (as opposed to %run). - -""" - -import sys -if len(sys.argv) > 1 and sys.argv[1].endswith('.py'): - # shortcut for running ipykit.exe directly on a .py file - do not bother - # starting ipython, just handle as normal python scripts - sys.argv = sys.argv[1:] - execfile(sys.argv[0]) -else: - import IPython - IPython.Shell.start().mainloop() +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" IPykit launcher + +w/o args, this launches a full ipykit session. + +If the first arg is a .py script, it will be run WITHOUT ipython, +to facilitate running python scripts almost normally on machines w/o python +in their own process (as opposed to %run). + +""" + +import sys +if len(sys.argv) > 1 and sys.argv[1].endswith('.py'): + # shortcut for running ipykit.exe directly on a .py file - do not bother + # starting ipython, just handle as normal python scripts + sys.argv = sys.argv[1:] + execfile(sys.argv[0]) +else: + import IPython + IPython.Shell.start().mainloop() diff --git a/setup.py b/setup.py index ed33484..a677ba8 100644 --- a/setup.py +++ b/setup.py @@ -1,180 +1,180 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -"""Setup script for IPython. - -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.""" - -#***************************************************************************** -# Copyright (C) 2001-2005 Fernando Perez -# -# Distributed under the terms of the BSD License. The full license is in -# the file COPYING, distributed as part of this software. -#***************************************************************************** - -# Stdlib imports -import os -import sys - -from glob import glob -from setupext import install_data_ext - -# 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') - -if os.name == 'posix': - os_name = 'posix' -elif os.name in ['nt','dos']: - os_name = 'windows' -else: - 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,...) -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'): - from IPython.genutils import target_update - # list of things to be updated. Each entry is a triplet of args for - # target_update() - to_update = [('doc/magic.tex', - ['IPython/Magic.py'], - "cd doc && ./update_magic.sh" ), - - ('doc/manual.lyx', - ['IPython/Release.py','doc/manual_base.lyx'], - "cd doc && ./update_version.sh" ), - - ('doc/manual/manual.html', - ['doc/manual.lyx', - 'doc/magic.tex', - 'doc/examples/example-gnuplot.py', - 'doc/examples/example-embed.py', - 'doc/examples/example-embed-short.py', - 'IPython/UserConfig/ipythonrc', - ], - "cd doc && " - "lyxport -tt --leave --pdf " - "--html -o '-noinfo -split +1 -local_icons' manual.lyx"), - - ('doc/new_design.pdf', - ['doc/new_design.lyx'], - "cd doc && lyxport -tt --pdf new_design.lyx"), - - ('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"), - ] - for target in to_update: - target_update(*target) - -# 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 -# information on how to do this more cleanly once python 2.4 can be assumed. -# Thanks to Noel for the tip. -docdirbase = 'share/doc/ipython-%s' % version -manpagebase = 'share/man/man1' - -# We only need to exclude from this things NOT already excluded in the -# 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/manual/*.html')) + \ - filter(isfile, glob('doc/manual/*.css')) + \ - filter(isfile, glob('doc/manual/*.png')) -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 -# routine, to add shortcuts and similar windows-only things. Windows -# post-install scripts MUST reside in the scripts/ dir, otherwise distutils -# doesn't find them. -if 'bdist_wininst' in sys.argv: - if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): - print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting." - sys.exit(1) - scriptfiles.append('scripts/ipython_win_post_install.py') - -datafiles = [('data', docdirbase, docfiles), - ('data', pjoin(docdirbase, 'examples'),examfiles), - ('data', pjoin(docdirbase, 'manual'),manfiles), - ('data', manpagebase, manpages), - ('lib', 'IPython/UserConfig', cfgfiles), - ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles), - ] - -if 'setuptools' in sys.modules: - # setuptools config for egg building - egg_extra_kwds = { - 'entry_points': { - 'console_scripts': [ - 'ipython = IPython.ipapi:launch_new_instance', - 'pycolor = IPython.PyColorize:main' - ]} - } - scriptfiles = [] - # eggs will lack docs, eaxmples - datafiles = [] - - #datafiles = [('lib', 'IPython/UserConfig', cfgfiles)] -else: - egg_extra_kwds = {} - - -# Call the setup() routine which does most of the work -setup(name = name, - version = version, - description = description, - long_description = long_description, - author = authors['Fernando'][0], - author_email = authors['Fernando'][1], - url = url, - download_url = download_url, - license = license, - platforms = platforms, - keywords = keywords, - packages = ['IPython', 'IPython.Extensions', 'IPython.external'], - scripts = scriptfiles, - - cmdclass = {'install_data': install_data_ext}, - data_files = datafiles, - # extra params needed for eggs - **egg_extra_kwds - ) +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""Setup script for IPython. + +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.""" + +#***************************************************************************** +# Copyright (C) 2001-2005 Fernando Perez +# +# Distributed under the terms of the BSD License. The full license is in +# the file COPYING, distributed as part of this software. +#***************************************************************************** + +# Stdlib imports +import os +import sys + +from glob import glob +from setupext import install_data_ext + +# 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') + +if os.name == 'posix': + os_name = 'posix' +elif os.name in ['nt','dos']: + os_name = 'windows' +else: + 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,...) +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'): + from IPython.genutils import target_update + # list of things to be updated. Each entry is a triplet of args for + # target_update() + to_update = [('doc/magic.tex', + ['IPython/Magic.py'], + "cd doc && ./update_magic.sh" ), + + ('doc/manual.lyx', + ['IPython/Release.py','doc/manual_base.lyx'], + "cd doc && ./update_version.sh" ), + + ('doc/manual/manual.html', + ['doc/manual.lyx', + 'doc/magic.tex', + 'doc/examples/example-gnuplot.py', + 'doc/examples/example-embed.py', + 'doc/examples/example-embed-short.py', + 'IPython/UserConfig/ipythonrc', + ], + "cd doc && " + "lyxport -tt --leave --pdf " + "--html -o '-noinfo -split +1 -local_icons' manual.lyx"), + + ('doc/new_design.pdf', + ['doc/new_design.lyx'], + "cd doc && lyxport -tt --pdf new_design.lyx"), + + ('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"), + ] + for target in to_update: + target_update(*target) + +# 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 +# information on how to do this more cleanly once python 2.4 can be assumed. +# Thanks to Noel for the tip. +docdirbase = 'share/doc/ipython-%s' % version +manpagebase = 'share/man/man1' + +# We only need to exclude from this things NOT already excluded in the +# 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/manual/*.html')) + \ + filter(isfile, glob('doc/manual/*.css')) + \ + filter(isfile, glob('doc/manual/*.png')) +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 +# routine, to add shortcuts and similar windows-only things. Windows +# post-install scripts MUST reside in the scripts/ dir, otherwise distutils +# doesn't find them. +if 'bdist_wininst' in sys.argv: + if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): + print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting." + sys.exit(1) + scriptfiles.append('scripts/ipython_win_post_install.py') + +datafiles = [('data', docdirbase, docfiles), + ('data', pjoin(docdirbase, 'examples'),examfiles), + ('data', pjoin(docdirbase, 'manual'),manfiles), + ('data', manpagebase, manpages), + ('lib', 'IPython/UserConfig', cfgfiles), + ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles), + ] + +if 'setuptools' in sys.modules: + # setuptools config for egg building + egg_extra_kwds = { + 'entry_points': { + 'console_scripts': [ + 'ipython = IPython.ipapi:launch_new_instance', + 'pycolor = IPython.PyColorize:main' + ]} + } + scriptfiles = [] + # eggs will lack docs, eaxmples + datafiles = [] + + #datafiles = [('lib', 'IPython/UserConfig', cfgfiles)] +else: + egg_extra_kwds = {} + + +# Call the setup() routine which does most of the work +setup(name = name, + version = version, + description = description, + long_description = long_description, + author = authors['Fernando'][0], + author_email = authors['Fernando'][1], + url = url, + download_url = download_url, + license = license, + platforms = platforms, + keywords = keywords, + packages = ['IPython', 'IPython.Extensions', 'IPython.external'], + scripts = scriptfiles, + + cmdclass = {'install_data': install_data_ext}, + data_files = datafiles, + # extra params needed for eggs + **egg_extra_kwds + ) diff --git a/test/test_embed.py b/test/test_embed.py index ef62718..876548c 100644 --- a/test/test_embed.py +++ b/test/test_embed.py @@ -1,32 +1,32 @@ -""" An example of one way to embed IPython in your own application - -This basically means starting up IPython with some of your programs objects visible in the IPython -user namespace. - -""" - -import sys -sys.path.append('..') - -import IPython.ipapi - -my_ns = dict(a=10) - -ses = IPython.ipapi.make_session(my_ns) - -# Now get the ipapi instance, to be stored somewhere in your program for manipulation of the running -# IPython session. See http://ipython.scipy.org/moin/IpythonExtensionApi - -ip = ses.IP.getapi() - -# let's play with the ipapi a bit, creating a magic function for a soon-to-be-started IPython -def mymagic_f(self,s): - print "mymagic says",s - -ip.expose_magic("mymagic",mymagic_f) - -# And finally, start the IPython interaction! This will block until you say Exit. - -ses.mainloop() - -print "IPython session finished! namespace content:",my_ns +""" An example of one way to embed IPython in your own application + +This basically means starting up IPython with some of your programs objects visible in the IPython +user namespace. + +""" + +import sys +sys.path.append('..') + +import IPython.ipapi + +my_ns = dict(a=10) + +ses = IPython.ipapi.make_session(my_ns) + +# Now get the ipapi instance, to be stored somewhere in your program for manipulation of the running +# IPython session. See http://ipython.scipy.org/moin/IpythonExtensionApi + +ip = ses.IP.getapi() + +# let's play with the ipapi a bit, creating a magic function for a soon-to-be-started IPython +def mymagic_f(self,s): + print "mymagic says",s + +ip.expose_magic("mymagic",mymagic_f) + +# And finally, start the IPython interaction! This will block until you say Exit. + +ses.mainloop() + +print "IPython session finished! namespace content:",my_ns diff --git a/test/test_ipapi.py b/test/test_ipapi.py index 8bd3561..30f51f4 100644 --- a/test/test_ipapi.py +++ b/test/test_ipapi.py @@ -1,54 +1,54 @@ -import sys -sys.path.append('..') - -import IPython.ipapi -IPython.ipapi.make_session() -ip = IPython.ipapi.get() - -def test_runlines(): - import textwrap - ip.runlines(['a = 10', 'a+=1']) - ip.runlines('assert a == 11\nassert 1') - - assert ip.user_ns['a'] == 11 - complex = textwrap.dedent("""\ - if 1: - print "hello" - if 1: - print "world" - - if 1: - print "foo" - if 1: - print "bar" - - if 1: - print "bar" - - """) - - - ip.runlines(complex) - - -def test_db(): - ip.db['__unittest_'] = 12 - assert ip.db['__unittest_'] == 12 - del ip.db['__unittest_'] - assert '__unittest_' not in ip.db - -def test_defalias(): - slot = [None] - # test callable alias - def cb(localip,s): - assert localip is ip - slot[0] = s - - ip.defalias('testalias', cb) - ip.runlines('testalias foo bar') - assert slot[0] == 'testalias foo bar' - - -test_runlines() -test_db() -test_defalias +import sys +sys.path.append('..') + +import IPython.ipapi +IPython.ipapi.make_session() +ip = IPython.ipapi.get() + +def test_runlines(): + import textwrap + ip.runlines(['a = 10', 'a+=1']) + ip.runlines('assert a == 11\nassert 1') + + assert ip.user_ns['a'] == 11 + complex = textwrap.dedent("""\ + if 1: + print "hello" + if 1: + print "world" + + if 1: + print "foo" + if 1: + print "bar" + + if 1: + print "bar" + + """) + + + ip.runlines(complex) + + +def test_db(): + ip.db['__unittest_'] = 12 + assert ip.db['__unittest_'] == 12 + del ip.db['__unittest_'] + assert '__unittest_' not in ip.db + +def test_defalias(): + slot = [None] + # test callable alias + def cb(localip,s): + assert localip is ip + slot[0] = s + + ip.defalias('testalias', cb) + ip.runlines('testalias foo bar') + assert slot[0] == 'testalias foo bar' + + +test_runlines() +test_db() +test_defalias diff --git a/win32_manual_post_install.py b/win32_manual_post_install.py index 0ec8886..3149015 100644 --- a/win32_manual_post_install.py +++ b/win32_manual_post_install.py @@ -1,141 +1,141 @@ -#!python -"""Windows-specific part of the installation""" - -import os, sys - -try: - import shutil,pythoncom - from win32com.shell import shell - import _winreg as wreg -except ImportError: - print """ -You seem to be missing the PythonWin extensions necessary for automatic -installation. You can get them (free) from -http://starship.python.net/crew/mhammond/ - -Please see the manual for details if you want to finish the installation by -hand, or get PythonWin and repeat the procedure. - -Press to exit this installer.""" - raw_input() - sys.exit() - - -def make_shortcut(fname,target,args='',start_in='',comment='',icon=None): - """Make a Windows shortcut (.lnk) file. - - make_shortcut(fname,target,args='',start_in='',comment='',icon=None) - - Arguments: - fname - name of the final shortcut file (include the .lnk) - target - what the shortcut will point to - args - additional arguments to pass to the target program - start_in - directory where the target command will be called - comment - for the popup tooltips - icon - optional icon file. This must be a tuple of the type - (icon_file,index), where index is the index of the icon you want - in the file. For single .ico files, index=0, but for icon libraries - contained in a single file it can be >0. - """ - - shortcut = pythoncom.CoCreateInstance( - shell.CLSID_ShellLink, None, - pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink - ) - shortcut.SetPath(target) - shortcut.SetArguments(args) - shortcut.SetWorkingDirectory(start_in) - shortcut.SetDescription(comment) - if icon: - shortcut.SetIconLocation(*icon) - shortcut.QueryInterface(pythoncom.IID_IPersistFile).Save(fname,0) - - -def run(wait=0): - # Find where the Start Menu and My Documents are on the filesystem - key = wreg.OpenKey(wreg.HKEY_CURRENT_USER, - r'Software\Microsoft\Windows\CurrentVersion' - r'\Explorer\Shell Folders') - - programs_dir = wreg.QueryValueEx(key,'Programs')[0] - my_documents_dir = wreg.QueryValueEx(key,'Personal')[0] - key.Close() - - # Find where the 'program files' directory is - key = wreg.OpenKey(wreg.HKEY_LOCAL_MACHINE, - r'SOFTWARE\Microsoft\Windows\CurrentVersion') - - program_files_dir = wreg.QueryValueEx(key,'ProgramFilesDir')[0] - key.Close() - - - # File and directory names - ip_dir = program_files_dir + r'\IPython' - ip_prog_dir = programs_dir + r'\IPython' - doc_dir = ip_dir+r'\doc' - ip_filename = ip_dir+r'\IPython_shell.py' - pycon_icon = doc_dir+r'\pycon.ico' - - if not os.path.isdir(ip_dir): - os.mkdir(ip_dir) - - # Copy startup script and documentation - shutil.copy(sys.prefix+r'\Scripts\ipython',ip_filename) - if os.path.isdir(doc_dir): - shutil.rmtree(doc_dir) - shutil.copytree('doc',doc_dir) - - # make shortcuts for IPython, html and pdf docs. - print 'Making entries for IPython in Start Menu...', - - # Create .bat file in \Scripts - fic = open(sys.prefix + r'\Scripts\ipython.bat','w') - fic.write('"' + sys.prefix + r'\python.exe' + '" -i ' + '"' + - sys.prefix + r'\Scripts\ipython" %*') - fic.close() - - # Create .bat file in \\Scripts - fic = open(sys.prefix + '\\Scripts\\ipython.bat','w') - fic.write('"' + sys.prefix + '\\python.exe' + '" -i ' + '"' + sys.prefix + '\\Scripts\ipython" %*') - fic.close() - - # Create shortcuts in Programs\IPython: - if not os.path.isdir(ip_prog_dir): - os.mkdir(ip_prog_dir) - os.chdir(ip_prog_dir) - - man_pdf = doc_dir + r'\manual.pdf' - man_htm = doc_dir + r'\manual\manual.html' - - make_shortcut('IPython.lnk',sys.executable, '"%s"' % ip_filename, - my_documents_dir, - 'IPython - Enhanced python command line interpreter', - (pycon_icon,0)) - make_shortcut('pysh.lnk',sys.executable, '"%s" -p pysh' % ip_filename, - my_documents_dir, - 'pysh - a system shell with Python syntax (IPython based)', - (pycon_icon,0)) - make_shortcut('Manual in HTML format.lnk',man_htm,'','', - 'IPython Manual - HTML format') - make_shortcut('Manual in PDF format.lnk',man_pdf,'','', - 'IPython Manual - PDF format') - - print """Done. - -I created the directory %s. There you will find the -IPython startup script and manuals. - -An IPython menu was also created in your Start Menu, with entries for -IPython itself and the manual in HTML and PDF formats. - -For reading PDF documents you need the freely available Adobe Acrobat -Reader. If you don't have it, you can download it from: -http://www.adobe.com/products/acrobat/readstep2.html -""" % ip_dir - - if wait: - print "Finished with IPython installation. Press Enter to exit this installer.", - raw_input() - -if __name__ == '__main__': - run() +#!python +"""Windows-specific part of the installation""" + +import os, sys + +try: + import shutil,pythoncom + from win32com.shell import shell + import _winreg as wreg +except ImportError: + print """ +You seem to be missing the PythonWin extensions necessary for automatic +installation. You can get them (free) from +http://starship.python.net/crew/mhammond/ + +Please see the manual for details if you want to finish the installation by +hand, or get PythonWin and repeat the procedure. + +Press to exit this installer.""" + raw_input() + sys.exit() + + +def make_shortcut(fname,target,args='',start_in='',comment='',icon=None): + """Make a Windows shortcut (.lnk) file. + + make_shortcut(fname,target,args='',start_in='',comment='',icon=None) + + Arguments: + fname - name of the final shortcut file (include the .lnk) + target - what the shortcut will point to + args - additional arguments to pass to the target program + start_in - directory where the target command will be called + comment - for the popup tooltips + icon - optional icon file. This must be a tuple of the type + (icon_file,index), where index is the index of the icon you want + in the file. For single .ico files, index=0, but for icon libraries + contained in a single file it can be >0. + """ + + shortcut = pythoncom.CoCreateInstance( + shell.CLSID_ShellLink, None, + pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink + ) + shortcut.SetPath(target) + shortcut.SetArguments(args) + shortcut.SetWorkingDirectory(start_in) + shortcut.SetDescription(comment) + if icon: + shortcut.SetIconLocation(*icon) + shortcut.QueryInterface(pythoncom.IID_IPersistFile).Save(fname,0) + + +def run(wait=0): + # Find where the Start Menu and My Documents are on the filesystem + key = wreg.OpenKey(wreg.HKEY_CURRENT_USER, + r'Software\Microsoft\Windows\CurrentVersion' + r'\Explorer\Shell Folders') + + programs_dir = wreg.QueryValueEx(key,'Programs')[0] + my_documents_dir = wreg.QueryValueEx(key,'Personal')[0] + key.Close() + + # Find where the 'program files' directory is + key = wreg.OpenKey(wreg.HKEY_LOCAL_MACHINE, + r'SOFTWARE\Microsoft\Windows\CurrentVersion') + + program_files_dir = wreg.QueryValueEx(key,'ProgramFilesDir')[0] + key.Close() + + + # File and directory names + ip_dir = program_files_dir + r'\IPython' + ip_prog_dir = programs_dir + r'\IPython' + doc_dir = ip_dir+r'\doc' + ip_filename = ip_dir+r'\IPython_shell.py' + pycon_icon = doc_dir+r'\pycon.ico' + + if not os.path.isdir(ip_dir): + os.mkdir(ip_dir) + + # Copy startup script and documentation + shutil.copy(sys.prefix+r'\Scripts\ipython',ip_filename) + if os.path.isdir(doc_dir): + shutil.rmtree(doc_dir) + shutil.copytree('doc',doc_dir) + + # make shortcuts for IPython, html and pdf docs. + print 'Making entries for IPython in Start Menu...', + + # Create .bat file in \Scripts + fic = open(sys.prefix + r'\Scripts\ipython.bat','w') + fic.write('"' + sys.prefix + r'\python.exe' + '" -i ' + '"' + + sys.prefix + r'\Scripts\ipython" %*') + fic.close() + + # Create .bat file in \\Scripts + fic = open(sys.prefix + '\\Scripts\\ipython.bat','w') + fic.write('"' + sys.prefix + '\\python.exe' + '" -i ' + '"' + sys.prefix + '\\Scripts\ipython" %*') + fic.close() + + # Create shortcuts in Programs\IPython: + if not os.path.isdir(ip_prog_dir): + os.mkdir(ip_prog_dir) + os.chdir(ip_prog_dir) + + man_pdf = doc_dir + r'\manual.pdf' + man_htm = doc_dir + r'\manual\manual.html' + + make_shortcut('IPython.lnk',sys.executable, '"%s"' % ip_filename, + my_documents_dir, + 'IPython - Enhanced python command line interpreter', + (pycon_icon,0)) + make_shortcut('pysh.lnk',sys.executable, '"%s" -p pysh' % ip_filename, + my_documents_dir, + 'pysh - a system shell with Python syntax (IPython based)', + (pycon_icon,0)) + make_shortcut('Manual in HTML format.lnk',man_htm,'','', + 'IPython Manual - HTML format') + make_shortcut('Manual in PDF format.lnk',man_pdf,'','', + 'IPython Manual - PDF format') + + print """Done. + +I created the directory %s. There you will find the +IPython startup script and manuals. + +An IPython menu was also created in your Start Menu, with entries for +IPython itself and the manual in HTML and PDF formats. + +For reading PDF documents you need the freely available Adobe Acrobat +Reader. If you don't have it, you can download it from: +http://www.adobe.com/products/acrobat/readstep2.html +""" % ip_dir + + if wait: + print "Finished with IPython installation. Press Enter to exit this installer.", + raw_input() + +if __name__ == '__main__': + run()