From e0f395f6a1cc360532fbbe4636f6dd9218b37c65 Mon Sep 17 00:00:00 2001 From: ville Date: Sat, 16 Feb 2008 11:50:47 +0200 Subject: [PATCH 1/9] initialization (no svn history) --- setup.py | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 setup.py diff --git a/setup.py b/setup.py new file mode 100644 index 000000000..ed3348443 --- /dev/null +++ b/setup.py @@ -0,0 +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 + ) From 8da9a478413e44681f327027352a619b14c6fa86 Mon Sep 17 00:00:00 2001 From: "Ville M. Vainio" Date: Thu, 28 Feb 2008 20:30:23 +0200 Subject: [PATCH 2/9] more crlf --- setup.py | 360 +++++++++++++++++++++++++++---------------------------- 1 file changed, 180 insertions(+), 180 deletions(-) diff --git a/setup.py b/setup.py index ed3348443..a677ba821 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 + ) From 3eb24f919e85d77b0835fc20c21dd0dbed71262d Mon Sep 17 00:00:00 2001 From: Fernando Perez Date: Sun, 9 Mar 2008 22:00:33 -0700 Subject: [PATCH 3/9] Update permissions --- setup.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 setup.py diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 From fb442f6dca846f25c4a2ae984f5109703f90a755 Mon Sep 17 00:00:00 2001 From: ldufrechou Date: Sat, 29 Mar 2008 10:31:30 +0100 Subject: [PATCH 4/9] Added gui and gui.wx to setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a677ba821..025a5c624 100755 --- a/setup.py +++ b/setup.py @@ -170,7 +170,7 @@ setup(name = name, license = license, platforms = platforms, keywords = keywords, - packages = ['IPython', 'IPython.Extensions', 'IPython.external'], + packages = ['IPython', 'IPython.Extensions', 'IPython.external', 'IPython.gui', 'IPython.gui.wx'], scripts = scriptfiles, cmdclass = {'install_data': install_data_ext}, From 826c6d262ed76742ed4effc303e96527117fc3c1 Mon Sep 17 00:00:00 2001 From: ville Date: Sat, 3 May 2008 19:06:46 +0300 Subject: [PATCH 5/9] setup.py: use package_data to grab UserConfig files, install UserConfig as normal package --- setup.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 025a5c624..20daf9f6a 100755 --- a/setup.py +++ b/setup.py @@ -104,7 +104,7 @@ def file_doesnt_endwith(test,endings): # 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 +docdirbase = 'share/doc/ipython' manpagebase = 'share/man/man1' # We only need to exclude from this things NOT already excluded in the @@ -136,7 +136,6 @@ 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), ] @@ -156,6 +155,11 @@ if 'setuptools' in sys.modules: #datafiles = [('lib', 'IPython/UserConfig', cfgfiles)] else: 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 @@ -170,8 +174,9 @@ setup(name = name, license = license, platforms = platforms, keywords = keywords, - packages = ['IPython', 'IPython.Extensions', 'IPython.external', 'IPython.gui', 'IPython.gui.wx'], + packages = ['IPython', 'IPython.Extensions', 'IPython.external', 'IPython.gui', 'IPython.gui.wx', 'IPython.UserConfig'], scripts = scriptfiles, + package_data = {'IPython.UserConfig' : ['*'] }, cmdclass = {'install_data': install_data_ext}, data_files = datafiles, From 9e716ec99b2f562421e6cde9056e6f21219c2cf3 Mon Sep 17 00:00:00 2001 From: "Ville M. Vainio" Date: Thu, 22 May 2008 19:44:30 +0300 Subject: [PATCH 6/9] Updated setup.py and do_sphinx.py for new manual distribution --- setup.py | 60 ++++++++++++++++++++++---------------------------------- 1 file changed, 23 insertions(+), 37 deletions(-) diff --git a/setup.py b/setup.py index 20daf9f6a..877840d85 100755 --- a/setup.py +++ b/setup.py @@ -46,43 +46,25 @@ 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 # 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) + + def oscmd(s): + cwd = os.getcwd() + for l in textwrap.dedent(s).splitlines(): + print ">", l.strip() + os.system(l.strip()) + + os.chdir(cwd) + + 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") # Release.py contains version, authors, license, url, keywords, etc. execfile(pjoin('IPython','Release.py')) @@ -113,9 +95,12 @@ 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')) +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')) + manpages = filter(isfile, glob('doc/*.1.gz')) cfgfiles = filter(isfile, glob('IPython/UserConfig/*')) scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor', @@ -135,6 +120,7 @@ if 'bdist_wininst' in sys.argv: datafiles = [('data', docdirbase, docfiles), ('data', pjoin(docdirbase, 'examples'),examfiles), ('data', pjoin(docdirbase, 'manual'),manfiles), + ('data', pjoin(docdirbase, 'manual/_static'),manstatic), ('data', manpagebase, manpages), ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles), ] From 1e114fb69e58a4216020d2b45b106fb71856209d Mon Sep 17 00:00:00 2001 From: "Ville M. Vainio" Date: Thu, 22 May 2008 21:11:35 +0300 Subject: [PATCH 7/9] fix do_sphinx running in setup.py --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 877840d85..d01b27bc1 100755 --- a/setup.py +++ b/setup.py @@ -60,8 +60,7 @@ if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): os.chdir(cwd) oscmd("""\ - cd doc - python do_sphinx.py""") + 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") From 16cc23ec97f2e7169b7daefede9a69bcbfff3a73 Mon Sep 17 00:00:00 2001 From: "Ville M. Vainio" Date: Thu, 22 May 2008 21:57:52 +0300 Subject: [PATCH 8/9] docs: remove build crap from sdist with manifest.in --- setup.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index d01b27bc1..65944b3b9 100755 --- a/setup.py +++ b/setup.py @@ -52,15 +52,10 @@ if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): # target_update() def oscmd(s): - cwd = os.getcwd() - for l in textwrap.dedent(s).splitlines(): - print ">", l.strip() - os.system(l.strip()) + print ">", s + os.system(s) - os.chdir(cwd) - - oscmd("""\ - cd doc && python do_sphinx.py""") + 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") From 427d1da3f5ba67f64f9eee6eafe65232eb5da382 Mon Sep 17 00:00:00 2001 From: Fernando Perez Date: Wed, 28 May 2008 20:15:04 -0700 Subject: [PATCH 9/9] Finish doc/build tools cleanup. Fix small stderr flush error in exception reporting. Final fixes to cpaste to support doctests. --- setup.py | 111 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 66 insertions(+), 45 deletions(-) diff --git a/setup.py b/setup.py index 65944b3b9..a98f793a8 100755 --- a/setup.py +++ b/setup.py @@ -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 @@ -18,15 +18,41 @@ import os 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' @@ -36,45 +62,45 @@ 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,...) +# 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 @@ -87,18 +113,15 @@ manpagebase = 'share/man/man1' # 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 @@ -129,19 +152,15 @@ if 'setuptools' in sys.modules: ]} } 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, @@ -154,7 +173,9 @@ setup(name = name, 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' : ['*'] },