From c446b0e12e08eaf906f3c8f7c5ae76e92cf6e9a3 2008-05-29 03:15:04 From: Fernando Perez Date: 2008-05-29 03:15:04 Subject: [PATCH] Finish doc/build tools cleanup. Fix small stderr flush error in exception reporting. Final fixes to cpaste to support doctests. --- diff --git a/IPython/Magic.py b/IPython/Magic.py index ccca61b..6c0c488 100644 --- a/IPython/Magic.py +++ b/IPython/Magic.py @@ -3140,7 +3140,7 @@ Defaulting color scheme to 'NoColor'""" 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 %%' ('%%' @@ -3148,8 +3148,9 @@ Defaulting color scheme to 'NoColor'""" 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'. @@ -3166,8 +3167,15 @@ Defaulting color scheme to 'NoColor'""" 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 diff --git a/IPython/Release.py b/IPython/Release.py index aa1a959..9eaeedb 100644 --- a/IPython/Release.py +++ b/IPython/Release.py @@ -22,7 +22,7 @@ name = 'ipython' # because bdist_rpm does not accept dashes (an RPM) convention, and # bdist_deb does not accept underscores (a Debian convention). -revision = '83' +revision = '84' branch = 'ipython' if branch == 'ipython': diff --git a/IPython/ultraTB.py b/IPython/ultraTB.py index bccdcac..eb2e579 100644 --- a/IPython/ultraTB.py +++ b/IPython/ultraTB.py @@ -377,8 +377,8 @@ class ListTB(TBTools): 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.""" @@ -855,8 +855,8 @@ class VerboseTB(TBTools): (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. @@ -977,13 +977,13 @@ class AutoFormattedTB(FormattedTB): 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: diff --git a/MANIFEST.in b/MANIFEST.in index b585984..4ff6ecb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -9,24 +9,19 @@ 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 -exclude doc/build -exclude doc/attic - - +# 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/html/_sources/* +exclude doc/build/html/_static/* +exclude doc/build/html/* +exclude doc/build/latex/* global-exclude *~ global-exclude *.flc diff --git a/doc/ChangeLog b/doc/ChangeLog index b29cf8c..a35d481 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,18 @@ +2008-05-28 Fernando Perez + + * ../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 . + + * 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 * iplib.py, ipmaker.py: survive lack of doctest and site._Helper diff --git a/setup.py b/setup.py index 65944b3..a98f793 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' : ['*'] }, diff --git a/tools/bkp.py b/tools/bkp.py deleted file mode 100755 index 4fd2fb4..0000000 --- a/tools/bkp.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python -"""Backup directories using rsync. Quick and dirty. - -backup.py config_file final_actions -""" - -#---------------------------------------------------------------------------- -# configure in this section - -# all dirs relative to current dir. - -# output directory for backups -outdir = '' - -# list directories to backup as a dict with 1 or 0 values for -# recursive (or not) descent: -to_backup = {} - -# list exclude patterns here (space-separated): -# if the pattern ends with a / then it will only match a directory, not a -# file, link or device. -# see man rsync for more details on the exclude patterns -exc_pats = '#*# *~ *.pyc *.pyo *.o ' - -# global options for rsync -rsync_opts='-v -t -a --delete --delete-excluded' - -#---------------------------------------------------------------------------- -# real code begins -import os,string,re,sys -from IPython.genutils import * -from IPython.Itpl import itpl - -# config file can redefine final actions -def final(): - pass - -# load config from cmd line config file or default bkprc.py -try: - execfile(sys.argv[1]) -except: - try: - execfile('bkprc.py') - except IOError: - print 'You need to provide a config file: bkp.py rcfile' - sys.exit() - -# make output dir if needed -outdir = os.path.expanduser(outdir) -try: - os.makedirs(outdir) -except OSError: # raised if dir already exists -> no need to make it - pass - -# build rsync command and call: -exclude = re.sub(r'([^\s].*?)(\s|$)',r'--exclude "\1"\2',exc_pats) -rsync = itpl('rsync $rsync_opts $exclude') - -# the same can also be done with lists (keep it for reference): -#exclude = string.join(['--exclude "'+p+'"' for p in qw(exc_pats)]) - -# rsync takes -r as a flag, not 0/1 so translate: -rec_flag = {0:'',1:'-r'} - -# loop over user specified directories calling rsync -for bakdir,rec in to_backup.items(): - bakdir = os.path.expanduser(bakdir) - xsys(itpl('$rsync $rec_flag[rec] $bakdir $outdir'), - debug=0,verbose=1,header='\n### ') - -# final actions? -final() diff --git a/tools/bkp.sh b/tools/bkp.sh deleted file mode 100755 index 5954e34..0000000 --- a/tools/bkp.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -# Simple backup script for ipython, to keep around a static copy of the whole -# project at the current version point. We do this by exporting from SVN. - -# Config here -IPYTHONSVN=$HOME/ipython/svn/ipython/trunk -BACKUPDIR=$HOME/ipython/backup - -#### -# Code begins -IPVERSION=`ipython -Version` -IPX=ipython-$IPVERSION -ARCHIVE=$BACKUPDIR/$IPX.tgz - -svn export $IPYTHONSVN $IPX - -tar czf $ARCHIVE $IPX - -rm -rf $IPX - -echo "Backup left in: $ARCHIVE" diff --git a/tools/bkprc.py b/tools/bkprc.py deleted file mode 100644 index 6903150..0000000 --- a/tools/bkprc.py +++ /dev/null @@ -1,22 +0,0 @@ -# config file for a quick'n dirty backup script that uses rsync - -# output directory for backups -outdir = '~/tmp' - -# list directories to backup as a dict with 1 or 0 values for -# recursive (or not) descent: -to_backup = {'~/ipython/ipython':1} - -# exclude patterns. anything ending in / is considered a directory -exc_pats = '#*# *~ *.o *.pyc *.pyo MANIFEST *.pdf *.flc build/ dist/ ' \ -' doc/manual/ doc/manual.lyx ChangeLog.* magic.tex *.1.gz ' - -# final actions after doing the backup -def final(): - dbg = 0 - version = bq('ipython -V') - out_tgz = outdir+'/ipython-'+version+'.tgz' - xsys(itpl('cd $outdir; pwd;tar -czf $out_tgz ipython'),debug=dbg,verbose=1) - #xsys(itpl('cp $out_tgz /mnt/card/fperez/ipython'),debug=dbg,verbose=1) - xsys(itpl('mv $out_tgz ~/ipython/backup'),debug=dbg,verbose=1) - xsys(itpl('rm -rf ${outdir}/ipython'),debug=dbg,verbose=1) diff --git a/tools/ipsvnc b/tools/ipsvnc deleted file mode 100755 index 77d8014..0000000 --- a/tools/ipsvnc +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python -"""Simple svn commit wrapper which emails a given list of people. - -Usage: - - ipsvnc [args] - -This is equivalent to doing - - svn commit [args] - -If the commit operation is successful (the script asks for confirmation), a -hardwired list of maintainers is informed of the commit. - -This is a poor-man's substitute for a proper svn post-commit hook with an -ipython-svn email list, which we're waiting to get soon. It should be removed -once that facility is in place. - -This only works on a unix box which can send mail by itself.""" - -import os -import commands -import sys -import time - -# Package maintainers to be alerted -maintainers = ['fperez@colorado.edu', 'rkern@ucsd.edu', 'antont@an.org', - 'tsanko@gmail.com'] - -#maintainers = ['fperez@colorado.edu'] # dbg - -# Assemble command line back, before passing it to svn -svnargs = [] -for arg in sys.argv[1:]: - if ' ' in arg: - svnargs.append('"%s"' % arg) - else: - svnargs.append(arg) -svnargs = ' '.join(svnargs) - -#print 'SVN args: <%s>' % svnargs; sys.exit() # dbg - -# perform commit -print 'Performing SVN commit, this may take some time...' -os.system('svn commit %s' % svnargs) -svntime = time.asctime() -print 'Getting SVN log and version info...' -svnstatus = commands.getoutput('svn log -r HEAD') -svnversion = commands.getoutput('svnversion .').split(':')[-1] - -# Confirm with user (trying to get the status from the svn commit blocks -# silently, I don't care to debug it) -ans = raw_input('If commit was succesful, proceed ' - 'with email notification? [Y/n] ') -if ans.lower().startswith('n'): - print "Exiting now..." - sys.exit(1) -else: - print "OK. Emailing maintainers..." - -# Send emails -subject = "[IPython SVN] New commit performed by %s" % os.getlogin() -body = """\ -Commit performed at: %s - -SVN arguments used: %s - -SVN Version: %s - -This version probably points to this changeset: -http://projects.scipy.org/ipython/ipython/changeset/%s - -Current SVN status after last commit: -%s""" % (svntime,svnargs,svnversion,svnversion,svnstatus) - -for maint in maintainers: - print "Emailing",maint - os.system('echo "%s" | mail -s "%s" %s' % (body, subject,maint)) diff --git a/tools/lyxport b/tools/lyxport deleted file mode 100755 index 0cc6a5f..0000000 --- a/tools/lyxport +++ /dev/null @@ -1,1049 +0,0 @@ -#!/usr/bin/env perl -# -#***************************************************************************** -# -# lyxport - script for exporting lyx docs to HTML, PostScript and PDF -# -# Inspired on the lyx2html script by Steffen Evers (tron@cs.tu-berlin.de) -# (many thanks to him). -# -# Copyright (C) 2001 Fernando Pérez (Fernando.Perez@colorado.edu) -# -#***************************************************************************** -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# If you do not have a copy of the GNU General Public License, write -# to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, -# MA 02139, USA. -# -# If the author of this software was too lazy to include the full GPL -# text along with the code, you can find it at: -# -# http://www.gnu.org/copyleft/gpl.html -# -#***************************************************************************** - -=pod - -=head1 NAME - -B - Export a LyX or LaTeX file to HTML, PostScript and PDF. - -=head1 SYNOPSIS - -B [options] F - -Perl script which takes a LyX or LaTeX file as its only argument and produces -HTML, PostScript and PDF versions of the document. The name is short for "lyx -export". - -You can call B with a filename with or without extension: F, -F and F will all work. B will update the LaTeX -file if there is a corresponding LyX file with a newer timestamp. - -Use B for more information, and B for a full -man page. - -=cut - -#***************************************************************************** -# modify here the command names to suit your local conditions -my %cmd= ( - lyx => "/usr/bin/lyx", - latex => "latex", - latex2html => "latex2html", - dvips => "dvips", - pdflatex => "pdflatex", - epstopdf => "epstopdf" - ); - -#************ DO NOT CHANGE ANYTHING BELOW THIS ULESS YOU *REALLY* KNOW -#************ WHAT YOU ARE DOING. - -#***************************************************************************** -# modules and globals -use strict; -use File::Copy; -use File::Basename; -my (%opt); # command line options -my $version = "0.3.2"; # keep this up to date with the docs (at end)! - -#***************************************************************************** -# "main" (simple minded way to keep variable scoping under control) -main(); - -sub main { - my ($runs, # number of latex runs - $file_in, # input filename as given at cmd line - $file_base, # base (no extension) name of file to work on - $lyx_time, # timestamps of lyx/tex files - $tex_time, - $l2h_file, # tex file cleaned up for latex2html - $targets_built, - $targets_failed, - $status, # status string for diagnostics printing - @latex_from_lyx # LaTeX files was created from LyX file - ); - - #------------------------------------------------------------------------ - # code begins - - cmdline_process(\%opt,\$file_in); - - # set defaults and filenames needed throughout - $runs=$opt{runs}; - set_cmd_defaults(\%cmd); - $file_base=check_file_exists($file_in); - # various filenames (with extensions) - my @exts=qw(lyx tex aux dvi log ps pdf out toc); - my ($lyx,$tex,$aux,$dvi,$log,$ps,$pdf,$out,$toc) = map { "$file_base.$_" } @exts; - - # first, if tex file is older than lyx file, update - @latex_from_lyx=update_tex($lyx,$tex); - - if ($opt{clean}) { - lyxport_info("Cleanup of old auxiliary files requested"); - safe_system("rm -rf $file_base"); - unlink ($aux,$log,$out,$toc); - } - - # run latex for both html (needs .aux file) and ps (needs .dvi) - if ($opt{html} or $opt{ps}) { - run_latex("$cmd{latex} -interaction=nonstopmode",$tex,\$runs); - } - # now make targets - if ($opt{html}) { - make_html($tex,$file_base,$opt{opts_l2h},\$status, - \$targets_built,\$targets_failed); - } - if ($opt{ps}) { - make_ps($dvi,$ps,$file_base,\$status,\$targets_built,\$targets_failed); - } - if ($opt{pdf}) { - make_pdf($tex,$pdf,\$runs,$file_base, - \$status,\$targets_built,\$targets_failed); - } - - #cleanup before exiting and print some diagnostics info - unless ($opt{debug}) { - unlink ($dvi,$log,$out); - } - # extra cleanup - if ($opt{tidy}) { - print "tidy up $opt{tidy},$aux,$log,$out,$toc,@latex_from_lyx\n"; - tidy_up($opt{tidy},$aux,$log,$out,$toc,@latex_from_lyx); - } - final_diagnostics($file_in,$status,$targets_built,$targets_failed); - exit(0); -} # end of main() - -#***************************************************************************** -# subroutines - -#----------------------------------------------------------------------------- -sub make_html { - my($tex,$html_dir,$opts_l2h,$stat_ref,$built_ref,$failed_ref)=@_; - my($success); - - lyxport_info("Making HTML"); - run_latex2html($tex,$opts_l2h); - $success=check_targets("${html_dir}/${html_dir}.html",'HTML', - $built_ref,$failed_ref); - if ($success) {$$stat_ref .= "Target HTML built in directory $html_dir\n" } -} # end of make_html() - -#----------------------------------------------------------------------------- -sub make_ps { - my($dvi,$ps,$html_dir,$stat_ref,$built_ref,$failed_ref)=@_; - my($success); - - lyxport_info("Making PostScript"); - safe_system("$cmd{dvips} $dvi -o $ps"); - $success=check_targets($ps,'PostScript',$built_ref,$failed_ref); - if ($success and not $opt{leave}) { - move2html_dir('PostScript',$ps,$html_dir,$stat_ref,$built_ref); - } -} # end of make_ps() - -#----------------------------------------------------------------------------- -sub make_pdf { - my($tex,$pdf,$runs_ref,$html_dir,$stat_ref,$built_ref,$failed_ref)=@_; - my($success); - - lyxport_info("Making PDF"); - run_pdflatex($tex,$pdf,$runs_ref); - $success=check_targets($pdf,'PDF',$built_ref,$failed_ref); - if ($success and not $opt{leave}) { - move2html_dir('PDF',$pdf,$html_dir,$stat_ref,$built_ref); - } -} # end of make_pdf() - -#----------------------------------------------------------------------------- -# move a given target to the html dir, only if it exists. leaves diagnostics -# info in a status string -sub move2html_dir { - my($name,$file,$dir,$stat_ref,$html_status_ref)=@_; - - if ($$html_status_ref =~ /HTML/) { - safe_system("mv $file $dir"); - $$stat_ref .= "Target $name moved to directory $dir\n"; - } else { - $$stat_ref .= "Target $name left in current directory\n"; - } -} # end of move2html_dir() - -#----------------------------------------------------------------------------- -# make sure that the tex file is up to date vs the lyx original before starting -# returns a list of the included .tex files which were generated (besides the main one) -sub update_tex { - my($lyx,$tex)=@_; - my($lyx_time,$tex_time); - my(@lyx_out,@made_tex,$lc); - - @made_tex=(); - unless (-e $lyx) { - print "LyX file not found. Working off the LaTeX file alone.\n\n"; - return; - } - $lyx_time=(stat($lyx))[9]; - $tex_time=(stat($tex))[9]; - if ($lyx_time>$tex_time or not(-e $tex)) { - lyxport_info("LaTeX file outdated or not existent, regenerating it..."); - unlink $tex; - @lyx_out=`$cmd{lyx} -dbg latex --export latex $lyx 2>&1 `; - # try again without -dbg option: LyX has a bug here! Note that this will - # disable the ability to remove extra .tex files generated from \include - # statements. But at least it will work, until they fix the bug in LyX. - unless (-e $tex) { - @lyx_out=`$cmd{lyx} --export latex $lyx 2>&1 `; - } - # end of ugly workaround - unless (-e $tex) {die "Aborting: couldn't create LaTeX file with LyX.\n\n"}; - push (@made_tex,$tex); - # find whether lyx made auxiliary (included) .tex files and report - foreach $lc (0..$#lyx_out-1) { - $_=$lyx_out[$lc]; - if (/^incfile:.*\.lyx/) { - $lyx_out[$lc+1] =~ /^writefile:(.*)$/; - push (@made_tex,basename($1)); - } - } - if (@made_tex) { - lyxport_info("Made LaTeX included files: @made_tex"); - } - lyxport_info("Done with LaTeX generation. Moving on."); - } - return @made_tex; -} # end of update_tex() - -#----------------------------------------------------------------------------- -# run latex on a file as many times as needed -# if the given # of runs is > 0, that many are done; otherwise latex is run -# as many times as needed until cross-references work. -# can be used to run either normal latex or pdflatex -sub run_latex { - my($latex_cmd,$file,$runs_ref)=@_; - - # pre-determined # of runs - if ($$runs_ref > 0) { - foreach (1..$$runs_ref) { - lyxport_info("$latex_cmd run # $$runs_ref"); - safe_system("$latex_cmd $file"); - } - } - # or make as many runs as needed to get things right (not very robust...) - else { - $$runs_ref=0; - while (1) { - $$runs_ref++; - lyxport_info("$latex_cmd run # $$runs_ref"); - $_ = `$latex_cmd $file`; - print; - last unless (/Rerun to get cross-references right/m or - /^No file .*\.toc.$/m); - } - } -} # end of run_latex() - -#----------------------------------------------------------------------------- -# cleanup the tex code so that latex2html doesn't get too confused -# this is essentially a Perl version (made with s2p) of Steffan Effer's -# original improvetex sed script, part of his lyx2html script collection -sub improve_tex4html { - my ($texfile,$newfile)=@_; - my ($len1,$pflag); - my $printit=1; - local *OLD,*NEW; - - open(OLD,"< $texfile") || die "Can't read from file $texfile: $!\n"; - open(NEW,"> $newfile") || die "Can't write to file $newfile: $!\n"; - select(NEW) || die "Can't make $newfile default filehandle: $!\n"; - -# code generated by s2p follows. Emacs can't reindent it properly! -# this code is ugly (once in Perl, original sed was ok). Clean it up... -$pflag=$\; # save print flag -$\="\n"; -LINE: -while () { - chomp; - # remove pagerefs over two lines (senseless in HTML) - if (/on *$\|on *page *$/) { - $_ .= "\n"; - $len1 = length; - $_ .= ; - chop if $len1 < length; - s/on *\n*page *\n*\\pageref{[^}]*}/\n/g; - } - # remove regular pagerefs (senseless in HTML) - s/on *page *\\pageref{[^}]*}//g; - # comment out redefintion of url tag (confuses latex2html) - if (/^\\IfFileExists{url.sty}/) { - s/^/%/; - print; - $_ = ; - s/^/%/; - } - # remove empty pages - if (/^\\thispagestyle{empty}~\\newpage$/) { - $printit = 0; - next LINE; - } - if (/^\\thispagestyle{empty}~$/) { - $printit = 0; - next LINE; - } - # remove custom latex commands for fancyheaders - s/\\fancyhead[^{]*{[^{}]*([^{}]*{[^{}]*})*[^{}]*}*//g; - s/\\thispagestyle{[^{}]*}//g; - # change documentclass from scrbook to book - s/^(\\documentclass[^{}]*{)scrbook}/$1book}/; - # comment out unsupported packages - s/^(\\usepackage\[T1\]{fontenc})/%$1/; - s/^(\\usepackage{a4wide})/%$1/; - s/^(\\usepackage{fancyhdr})/%$1/; - s/^(\\usepackage{ae)/%$1/; - s/^(\\pagestyle{fancy})/%$1/; - # the geometry package doesn't make sense in html - s/^(\\usepackage{geometry})/%$1/; - s/^(\\geometry)/%$1/; - # comment out ident/skip block command (produces error message; why?) - s/^(\\setlength\\parskip{.*})/%$1/; - s/^(\\setlength\\parindent{.*})/%$1/; -} continue { - if ($printit) { print } - else { $printit++ } -} -close(OLD); -close(NEW); -select(STDOUT); -$\=$pflag; # restore defaults -} # end of improve_tex4html() - -#----------------------------------------------------------------------------- -sub run_latex2html { - my ($tex,$latex2html_opts)=@_; - my ($l2h_file,$symlink_exists,$htmldir); - - ($htmldir=$tex) =~ s/\.tex$//; - $l2h_file="${tex}_#tmp_2html#"; - improve_tex4html($tex,$l2h_file); - # add index support - my $xtraargs = ""; - my $idx = "$htmldir.idx"; - if(-e $idx ) { - $xtraargs .= "-index $idx"; - } - safe_system("$cmd{latex2html} $xtraargs $latex2html_opts $l2h_file"); - unless ($opt{debug}) { - unlink($l2h_file,"$htmldir/labels.pl"); - } - - # latex2html always leaves 2 copies of the file (one as file.html, one as - # index.html). In systems that support symlinks, remove one and replace it - # with a link: - $symlink_exists = eval { symlink("",""); 1 }; - if ($symlink_exists) { - unlink("$htmldir/index.html"); - symlink("$htmldir.html","$htmldir/index.html"); - } -} # end of run_latex2html() - -#----------------------------------------------------------------------------- -# remove calls to eps figures if they have an accompanying tiff, jpg or png -sub improve_tex_figs { - my ($tex,$textmp)=@_; - local (*TEX,*TMP); - - # begin changes to tex file - my ($printit,$figname,$fignoneps,$figbase,$figext,$fignew,@figlist,@tmpfiles); - open(TEX,"< $tex") || die "Can't read from LaTeX file $tex: $!\n"; - open(TMP,"> $textmp") || die "Can't write to temp file $textmp: $!\n"; - $printit=1; - while () { - if (/includegraphics{([^\}]*)/) { - $figname=$1; - # remove .eps from fig name and make a .pdf version if necessary - if ($figname =~ /\.eps$/i) { - ($figbase = $figname) =~ s/\.eps$//i; - # now we need to find if there's any non-eps figure for this file: - # pdflatex can handle jpegs, tiffs, etc. So we only need to build - # an associated pdf if there is no other figure file for pdflatex - # to work with - @figlist=grep {/\.jpe?g$|\.tiff?$|\.png$|\.pdf$/i} <$figbase.*>; - if (@figlist > 1) { - lyxport_info("Problem! More than one figure file found: @figlist"); - die "I don't know what to do here. Sorry, aborting...\n\n"; - } elsif (@figlist==1) { - # problem: pdftex only recognizes jpg (not jpeg, not JPG, etc) - # and tif (not tiff, not TIF, etc). It also gets confused by files - # called a.b.c.jpg (it thinks .b.c.jpg is the extension). argh!!! - ($fignoneps)=(@figlist); - # so first, extract the 3 or 4 letter extension and lowercase it - $fignoneps =~ /.*\.(....??)$/; - ($figext = $1) =~ tr/[A-Z]/[a-z]/; - # and remove any periods from the base of the name (replace by _) - $figbase =~ s/\./_/g; - $fignew="$figbase.$figext"; - if ($fignoneps =~ /\.JPE?G$|\.TIFF?$|\.PNG$|\.PDF$/) { - lyxport_info("pdflatex only recognizes the following extensions:\n". - "pdf, png, jpg, tif. (all lowercase, no variations like jpeg or tiff).\n". - "lyxport will make a copy of $fignoneps to $fignew so that pdflatex is happy"); - copy($fignoneps,$fignew); - push(@tmpfiles,$fignew); - } - s/$figname/$fignew/; # in $_, for printing to temp file - } else { - s/$figname/$figbase.pdf/; - lyxport_info("Making PDF figure <$figbase.pdf> from <$figname>"); - safe_system("$cmd{epstopdf} $figname"); - } - - } - } - } continue { - if ($printit) { print TMP $_} - else { $printit++ } - } - close(TEX); - close(TMP); - return @tmpfiles; -} # end of improve_tex_figs() - -#----------------------------------------------------------------------------- -# Make the pdf directly from the latex file -# Notes: for this to work ok, the following must have been done: -# 1. ~/.dvipsrc file must contain the lines -# p+ psfonts.cmz -# p+ psfonts.amz -# 2. The latex preamble of the lyx file must have -# \usepackage{ae,aecompl} -# This is so that T1 encoded fonts come out looking good in the final pdf. -sub run_pdflatex { - my ($tex,$pdf,$runs_ref)=@_; - my ($texbase,$tmpbase,$textmp,@tmpfiles,@extensions,$printit); - local *TEX,*TMP; - - # first fix references to eps figures (make sure that pdf versions exist!!!) - # make all changes in a temp tex file - ($texbase=$tex) =~ s/\.tex$//; - $tmpbase = "${texbase}_#tmp_pdf#"; - @extensions=qw(tex aux out toc log); - ($textmp,@tmpfiles)= map { "${tmpbase}.$_" } @extensions; - - push(@tmpfiles,improve_tex_figs($tex,$textmp)); - # now run the actual pdflatex converter - run_latex("$cmd{pdflatex} -interaction=nonstopmode",$textmp,$runs_ref); - rename( "${tmpbase}.pdf",$pdf); - unless ($opt{debug}) { unlink ($textmp,@tmpfiles,"texput.log"); } -} # end of run_pdflatex() - -#----------------------------------------------------------------------------- -# general utility routines (not related to latex/html/pdf) follow - -#------------------------------------------------------------------------- -sub cmdline_process{ - my($opt_ref,$file_ref)=@_; - - # modules - no strict "vars"; # avoid some unpleasant warnings while checking options - - use Getopt::Long; - # allow bundling of single letter options (-a -b == -ab) - Getopt::Long::Configure ("bundling"); - use Pod::Usage; - - # note: the second name for each option (after |) is an alias for user - # convenience only. Internally, the only created hash entries use the *first* - # name as a key (i.e. $opt{h} doesn't exist, $opt{html} is set with -h or --html) - my(@option_list) = qw(html|h ps|p pdf|f leave - runs|r=i opts_l2h|o=s clean|c tidy|t+ - cld|l debug|d help man|m version|v); - - # debug mode overrides all post-run cleanup options - if ($opt{debug}) { $opt{t}=0 } - - # default: a negative # of runs means auto-detect - $$opt_ref{runs}= -99; - # dash options first - GetOptions($opt_ref,@option_list) || pod2usage(-verbose => 0); - - # execute all possible "die" modes first - cmdline_debug(%$opt_ref) if ($$opt_ref{cld}); - pod2usage(-verbose => 1) if ($$opt_ref{help}); - pod2usage(-verbose => 2) if ($$opt_ref{man}); - die "\nlyxport: version $version\n\n" if ($$opt_ref{version}); - - ## Now get filename (only ONE) - pod2usage(-verbose => 0, -message => - "\nERROR: lyxport works with exactly ONE file at a time.\n") - if (@ARGV != 1); - ($$file_ref)=@ARGV; - - # choose whether to make all targets or just the explicitly specified ones - unless ($$opt_ref{html} or $$opt_ref{ps} or $$opt_ref{pdf}) { - $$opt_ref{html}=$$opt_ref{ps}=$$opt_ref{pdf}=1; - } -} # end of cmdline_process() - -#----------------------------------------------------------------------------- -# quick and dirty hash printing by key/value pairs -sub print_hash { - my($key_msg,$val_msg,%hash)=@_; - my($op,$val); - - while ( ($op,$val)=each(%hash) ) {print "$key_msg $op $val_msg $val\n" } -} # end of print_hash() - -#----------------------------------------------------------------------------- -sub cmdline_debug{ - my(%opt)=@_; - - print "\nlyxport command line debug mode\n"; - print "-------------------------------\n\n"; - print "This is a dump of your command line options, as key-value pairs:\n\n"; - print_hash("","->",%opt); - print "\nExiting...\n\n"; - exit; -} # end of cmdline_debug() - -#----------------------------------------------------------------------------- -# execute a system call but die with some info if return value is non-zero -sub safe_system { - my $error; - - $error=system(@_)/256; - if ($error) { - print "\nERROR: Command\n @_\nfailed.\n"; - } - return $error; -} # end of safe_system() - -#----------------------------------------------------------------------------- -# check that the command names specified at the top exist in the system, -# otherwise choose bare defaults and hope for the best. -sub set_cmd_defaults { - my ($cmd)=@_; - my ($prog,$cmd_name); - - print "\n"; - while (($prog,$cmd_name)=each(%cmd)) { - print "Checking for program <$prog>, as <$cmd_name>... \n"; - if (system("which $cmd_name")/256) { - $$cmd{$prog}=$prog; - print "Not found. Reverting to default name $prog.\n"; - } else { print "OK, found it.\n" } - } - print "\nDone configuring command names\n\n"; -} # end of set_cmd_defaults() - -#----------------------------------------------------------------------------- -# make sure there's either a .lyx or a .tex file to work with -# returns a stripped name (without .lyx or .tex extension) of the file -sub check_file_exists { - my($file_in)=@_; - my($base_file); - - $_=$file_in; - if (/\.lyx$/) { s/\.lyx$// } - elsif (/\.tex$/) { s/\.tex$// } - $base_file=$_; - unless (-e "${base_file}.lyx" or -e "${base_file}.tex") { - die "I can't find a LyX or LaTeX file to work with!\nAborting...\n\n"; - } - return $base_file; -} # end of check_file_exists() - -#----------------------------------------------------------------------------- -sub check_targets{ - my($file,$tag,$built,$failed)=@_; - my($success)=0; - - $tag .= ' '; - if (-s $file) { $$built .= $tag; $success=1; } - else { $$failed .= $tag } - return $success; -} # end of check_targets() - -#----------------------------------------------------------------------------- -# do extra cleaning of aux, toc, log files generated during running -sub tidy_up { - my($tidy,$aux,$log,$out,$toc,@latex_from_lyx)=@_; - - lyxport_info("Cleanup of leftover auxiliary files"); - print "Removing files: $aux, $log, $out, $toc\n"; - unlink ($aux,$log,$out,$toc); - if ($tidy>1 and @latex_from_lyx) { - lyxport_info("Extra cleanup: removing LaTeX file(s) @latex_from_lyx"); - unlink(@latex_from_lyx); - foreach (@latex_from_lyx) { - s/\.tex$/\.aux/; - if (-e) { - print "Removing aux file $_\n"; - unlink($_); - } - } - } -} # end of tidy_up() - -#----------------------------------------------------------------------------- -sub lyxport_info { - my ($target)=@_; - - print "\n",'*'x75,"\n"; - print " $target\n\n"; -} # end of lyxport_info() - -#----------------------------------------------------------------------------- -sub final_diagnostics{ - my($file_in,$status,$targets_built,$targets_failed)=@_; - - lyxport_info("All done!"); - print "Input file: $file_in\n\n"; - print "Targets built : $targets_built\n\n"; - if ($targets_failed) { - print "PROBLEM!\nTargets failed: $targets_failed\n\n"; - } - print "Diagnostics of build process:\n\n$status\nBye!\n\n"; -} # end of final_diagnostics() - - -#************************ end of code for ******************* - -__END__ - -=pod - -=head1 DESCRIPTION - -=head2 Purpose - -LyX ( http://www.lyx.org ) is a wonderful document processor, which can produce -from a single source multiple versions for different purposes: a PostScript -file for printing on a Unix-type system, a PDF file for distribution across -multiple operating systems, or an HTML file for Internet display. It -accomplishes this by exporting its own file format to a LaTeX file and then -running various converters on this resulting file. - -However, it turns out that this process isn't exactly foolproof, as these -converters have all sorts of little quirks which can produce anything from -surprises in the way the final result looks like to outright failure of the -export process. The purpose of B is to serve as a "smart wrapper" -around those export facilities which LyX normally uses, trying to massage the -LaTeX file that everything starts from in the hopes of having better success -in producing HTML and PDF (PostScript usually poses no problems). - -B also allows you to keep around only the LyX file, and possibly any -ancillary figure files. B takes care of generating (and removing -afterwards if instructed to do so) any intermediate files necessary for the -export process. - -For example, in order to make PDF from a LaTeX file, any included eps figures -need to be converted to pdf format. But LyX likes to have the figures in eps -format for on-screen display, which is a great feature to have. B -allows you to keep your LyX file as usual (with references to .eps figures) -and will make .pdf versions of any included figure on the fly as needed. You -can even ask it to remove those pdf files after it finishes, if you really -want to maintain a minimum of files around (though it will have to remake them -again if you ever need to update your pdf exported document). - -=head2 Command line use - -If you simply type B F, it will try to make PostScript, HTML, -and PDF versions of your file, putting them all in a single directory named -F (without a .lyx or .tex extension if your file had one). But it has -L for making only the -formats you want, and fairly detailed control over its behavior. - -=head2 If you don't have LyX - -Despite its name, if you are a regular LaTeX user and don't even have LyX -installed in your system, B can still be useful to you. In fact, -B only uses LyX once in each run: if there is no F or if -F file is newer than F, B updates F -from F. But if there is no F at all it will simply use -F and proceed with all its functionality intact. - -=cut -########################################################################### -=pod - -=head1 OPTIONS AND ARGUMENTS - -Single letter options (preceded by a single dash B<->) can be bundled: B<-pf> -is equivalent to B<-p -f>. Long options (preceded by two dashes B<-->) can be -abbreviated to as few letters as needed to clear ambiguity. - -=over - -=item B<-r --runs> I - -Set number of latex runs by hand (otherwise auto-determined). - -=item B<-o --opts_l2h> I<'string'> - -String with options to be passed to B. This string should be -protected by single quotes to allow double quotes inside of it. - -For example, if you want to pass to B the option B<-info "my -info"> you can do so with B (the extra spaces -around the quote marks are not needed, they are here only for the sake of -clarity). - -B has I command-line options. For a project you are working -constantly on, it may be more convenient to permanently set some of those -options via a file called F<.latex2html-init> which B always -reads at startup. See the B man page or the excellent online -documentation kept at http://www-texdev.mpce.mq.edu.au/l2h/docs/manual for -full details. - -=item B<-h --html> - -Export to HTML. - -=item B<-p --ps> - -Export to PostScript. - -=item B<-f --pdf> - -Export to PDF. See below the section L for details on how to -obtain nice-looking PDF from your LaTeX sources. - -If none of the three above options is specified, the default behavior is to -export I three formats. If any is given, then only those formats -explicitly specified will be produced (e.g. B<-h -f> makes HTML and PDF only, -but not PostScript). - -=item B<--leave> - -By default lyxport moves the resulting PostScript and PDF files into the -directory containing the HTML results (if it was created). This option tells -it to leave them in the current directory. - -=item B<-c --clean> - -Do a clean start export, removing first any html directory, .aux, .log -and .toc files which may have been left from previous runs. - -=item B<-t --tidy> - -B will tidy up I itself, removing .aux, .log and .toc files left -in the current directory. Use this only for "final" publication of documents, as -those files are otherwise useful to shorten the time of runs. - -This option is incremental: you can call it twice (you can bundle it as -B<-tt>). If called twice, B will remove also the LaTeX file -associated with your LyX file, but I B I. This behavior is meant to be a safety net, so that -B doesn't accidentally remove LaTeX files which you may have manually -modified in some way. - -So if this option is called twice, you can start with a LyX file named F -and end up only with your original file plus a single directory named F which -will contain F, F and F (plus some ancillary stuff for -the html version). This mode of operation is obviously provided for the neatness -freaks amongst us. - -=item B<-d --debug> - -Debugging mode: B will leave I temporary files it creates lying -around. If a particular target refuses to build, you can then try to run the -respective commands on the temporary files manually, and possibly diagnose the -source of the problem. - -This option will override any calls made to option B<--tidy>. - -=item B<-l --cld> - -Special command-line debugging mode: only prints (in a rather primitive form) -the names and values of all command-line options which were set. Useful for -finding problems with complicated option strings being passed to -B. - -=item B<--help> - -Print this help and quit. - -=item B<-m --man> - -Print a complete man page. B is documented using embedded pod -strings, so you can see its full documentation using the command B. - -You can also convert this documentation to other formats using the -I family of converters (L, L, L -and L). See their respective man pages for details. - -Note that if you installed B properly, you should already have a man -page available, plus html and plain text versions of the documents. These are -by default installed to a directory named F, where -F is the version number. At installation time, you may manually change -the F prefix. Consult your local documents or ask your system -administrator for details on the specifics of your configuration. - -=item B<-v --version> - -Print version information and quit. - -=item B - -The given filename may have a .lyx or .tex extension (or none at -all). I will update the tex file from the lyx file if necessary. - -B accepts only I filename at a time. - -=back - -=cut -########################################################################### -=pod - -=head1 INTEGRATION WITH LyX - -If you find that B is more succesful in exporting your files than -LyX's default calls to B and B, you can modify LyX to -use B as its conversion routine. For LyX versions 1.1.6 and above, go -to C<< Edit->Preferences->Converters->Converters >> and specify B as your -converter for C<< LaTeX->HTML >> and C<< LaTeX->PDF >>. LyX's convention -is to call B<$$i> the current file. - -For example, if you want to setup B to be your PDF export filter -under LyX, in the C dialog, in the C<< LaTeX->PDF(pdflatex) >> -option, set: - - lyxport --pdf $$i - -This way you'll be able to export to pdf directly from within LyX, even if -your figures are in eps format. - -LyX's C dialog is a bit confusing: after making changes, you must -first press the C button for your changes to actually be recorded, and -then C. - -You can similarly set up B to be your LaTeX to HTML converter. - -For LyX versions earlier than 1.1.6 (which didn't have the new Preferences -dialog) these same options can be configured via your LyX defaults file. See -the LyX documentation for details. - -=cut -########################################################################### -=pod - -=head1 PDF GENERATION - -=head2 Fonts - -Normally PDF documents made on Unix-type systems from LaTeX sources produce -horrible looking fonts when viewed with Adobe's own Acrobat Reader. I don't -know the many intricacies of the problem (you can search for the details on -your own). I'll simply list here the trick that has helped I solve the -font problem. Try it, your mileage may vary. - -=over - -=item 1 - -In your home directory, make (or modify it if it already exists) a file -named F<.dvipsrc> which must contain the lines: - - p+ psfonts.cmz - p+ psfonts.amz - -=item 2 - -Make sure that the LaTeX preamble of your LyX file (or the part before -C<\begin{document}> if you are using straight LaTeX files) contains: - - \usepackage[T1]{fontenc} - \usepackage{ae,aecompl} - -This will guarantee that T1 encoded fonts come out looking good in the final PDF. - -=back - -=head2 Figures - -B (if I understand correctly) only accepts filenames with a single -B<.> in them, and only uses graphic files with extensions pdf, png, jpg and -tif (all lowercase). B will do its best to analyze your latex file -and try to change references to figures to accommodate B, by -creating temporary copies of your image files if necessary. - -Ideally, you should be able to have for example a figure called F -along with a F (for B to preview it), and B would -export a pdf document without leaving any more files after itself, even though -it temporarily had to create F to make B happy. As I -said, ideally... If things don't quite work, try the B<--debug> option. If you -find a fix for the problem, mail it to me: fperez@pizero.colorado.edu - -=head2 Links - -In order for URLs and similar elements to produce proper active links in the -PDF document, you need to include in your LaTeX preamble the line - - \usepackage{hyperref} - -=cut -########################################################################### -=pod - -=head1 REQUIRES - -B relies on some programs listed below, for the reasons indicated: - -=over - -=item B - -To make LaTeX files from LyX files. Tested with lyx version 1.1.6fix1, should -work with earlier versions (perhaps with minor changes to the way LyX is called). - -=item B - -To produce PostScript and for latex2html to work properly (cross-references). - -=item B - -For making PostScript output. - -=item B - -For generating HTML from latex sources. - -=item B - -For making PDF output from a latex file with proper cross-referencing and -internal document links. - -=item B - -A Perl script to automatically generate pdf versions of eps figures included -in lyx files. It is more robust in its handling of various eps quirks than a -straight call to B. - -=item B - -Well, it's a Perl script after all, isn't it? - -=back - -However, partial use of B is still possible without some of these -components. If for example you don't have B in your system, you -can still use B to produce PostScript and PDF. Various combinations -are possible. - -=head2 Portability - -There are calls in B to some Unix commands like B. For this -reason it is not totally portable. These calls are however reasonably few and -could be eliminated if there is enough demand by replacing them with -equivalent Perl code. It's just more work... - -=cut -########################################################################### -=pod - -=head1 TO DO - -=over - -=item * - -Build rpm for more convenient installation. - -=item * - -Clean up the C code for readability. - -=back - -=cut -########################################################################### -=pod - -=head1 VERSION - -This is B version 0.3.1 - -=cut -########################################################################### -=pod - -=head1 AUTHOR - -Fernando Pérez Efperez@pizero.colorado.eduE. - -Please email me with comments, suggestions, bugfixes, etc. - -The most current version of B should always be available at -http://www-hep.colorado.edu/~fperez/lyxport - -=cut -########################################################################### -=pod - -=head1 ACKNOWLEDGEMENTS - -Inspired on the B script by Steffen Evers -Etron@cs.tu-berlin.deE. Some of the code is a blatant ripoff of -Steffen's code, using B to get Perl versions of his original B -scripts. - -=cut -########################################################################### -=pod - - -=head1 COPYRIGHT AND DISCLAIMER - -This program is Copyright 2001 by Fernando Pérez. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; either version 2 of the License, or (at your option) any later -version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -If you do not have a copy of the GNU General Public License write to -the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, -MA 02139, USA. - -If the author of this software was too lazy to include the full GPL text along -with the code, you can find it at: http://www.gnu.org/copyleft/gpl.html - -=cut -#************************** end of file ********************** diff --git a/tools/testrel b/tools/testrel index 4d08d8f..749500a 100755 --- a/tools/testrel +++ b/tools/testrel @@ -2,13 +2,22 @@ # release test -cd ~/ipython/ipython +ipdir=~/ipython/ipython +ipbackupdir=~/ipython/backup -# clean up build/dist directories -rm -rf build/* -rm -rf dist/* +cd $ipdir + +# Clean up build/dist directories +rm -rf $ipdir/build/* +rm -rf $ipdir/dist/* + +# Perform local backup +cd $ipdir/tools +./make_tarball.py +mv ipython-*.tgz $ipbackupdir # build source distros +cd $ipdir ./setup.py sdist --formats=gztar # Build rpms @@ -25,4 +34,4 @@ python2.5 ./setup_bdist_egg.py ./setup.py bdist_wininst --install-script=ipython_win_post_install.py # Change name so retarded Vista runs the installer correctly -rename 's/win32/win32-setup/' dist/*.exe +rename 's/win32/win32-setup/' $ipdir/dist/*.exe diff --git a/win32_manual_post_install.py b/win32_manual_post_install.py index 3149015..ce93027 100755 --- a/win32_manual_post_install.py +++ b/win32_manual_post_install.py @@ -104,8 +104,8 @@ def run(wait=0): 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' + man_pdf = doc_dir + r'\manual\ipython.pdf' + man_htm = doc_dir + r'\manual\ipython.html' make_shortcut('IPython.lnk',sys.executable, '"%s"' % ip_filename, my_documents_dir,