##// END OF EJS Templates
Add tools for self-contained distribution and installation.
Fernando Perez -
Show More
@@ -0,0 +1,130 b''
1 # Simple makefile to rapidly deploy IPython with all its dependencies.
2
3 # Configuration section. The version numbers and paths declared here may
4 # change with each release.
5
6 # IPython version
7 IPYTHON_VER=0.9.1
8
9 # Declare here version numbers of all the dependencies
10 PYOPENSSL_VER=0.6
11 ZOPE_INTERFACE_VER=3.4.1
12 TWISTED_VER=8.1.0
13 FOOLSCAP_VER=0.3.1
14 NOSE_VER=0.10.3
15
16 # Repository URLs for all packages. Make sure these are correct for each
17 # release, since projects may change paths!
18 IPYTHON_REPO=http://ipython.scipy.org/dist
19 PYOPENSSL_REPO=http://downloads.sourceforge.net/pyopenssl
20 ZOPE_INTERFACE_REPO=http://pypi.python.org/packages/source/z/zope.interface
21 TWISTED_REPO=http://tmrc.mit.edu/mirror/twisted/Twisted/8.1
22 FOOLSCAP_REPO=http://foolscap.lothar.com/releases
23 NOSE_REPO=http://somethingaboutorange.com/mrl/projects/nose
24
25 #-----------------------------------------------------------------------------
26 # Main code begins. There shouldn't be much to change here with each release.
27 #
28
29 # Hand-written files to ship in self-contained tarball
30 SOURCES=pkginstall pkginstall.cfg Makefile README.txt README.html
31
32 # Versions of tarballs we ship
33 IPYTHON=ipython-$(IPYTHON_VER).tar.gz
34 IP_ALLDEPS=ipython-alldeps-$(IPYTHON_VER)
35
36 PYOPENSSL=pyOpenSSL-$(PYOPENSSL_VER).tar.gz
37 ZOPE_INTERFACE=zope.interface-$(ZOPE_INTERFACE_VER).tar.gz
38 NOSE=nose-$(NOSE_VER).tar.gz
39 TWISTED=Twisted-$(TWISTED_VER).tar.bz2
40 FOOLSCAP=foolscap-$(FOOLSCAP_VER).tar.gz
41
42 TARBALLS=$(PYOPENSSL) $(ZOPE_INTERFACE) $(TWISTED) $(FOOLSCAP) \
43 $(NOSE) $(IPYTHON)
44
45 # URLs for downloads
46
47 #-----------------------------------------------------------------------------
48 # Target declaration
49 #
50
51 # Targets to install, in correct dependency order
52 install: pyopenssl zope.interface twisted foolscap nose ipython
53 echo
54 echo "IPython Installation finished."
55 echo "You can now run the ipython test suite by running:"
56 echo "iptest"
57 echo "If all tests pass, you can delete this entire directory."
58 echo
59
60 # Download targets
61 download: $(TARBALLS)
62
63 $(IPYTHON):
64 wget $(IPYTHON_REPO)/$(IPYTHON)
65
66 $(PYOPENSSL):
67 wget $(PYOPENSSL_REPO)/$(PYOPENSSL)
68
69 $(ZOPE_INTERFACE):
70 wget $(ZOPE_INTERFACE_REPO)/$(ZOPE_INTERFACE)
71
72 $(TWISTED):
73 wget $(TWISTED_REPO)/$(TWISTED)
74
75 $(FOOLSCAP):
76 wget $(FOOLSCAP_REPO)/$(FOOLSCAP)
77
78 $(NOSE):
79 wget $(NOSE_REPO)/$(NOSE)
80
81
82 # The calls to pkginstall must use the actual Python package name
83 nose: $(NOSE)
84 ./pkginstall nose
85
86 zope.interface: $(ZOPE_INTERFACE)
87 ./pkginstall zope.interface zope
88
89 pyopenssl: $(PYOPENSSL)
90 ./pkginstall pyOpenSSL OpenSSL
91
92 twisted: $(TWISTED)
93 ./pkginstall Twisted
94
95 foolscap: $(FOOLSCAP)
96 ./pkginstall foolscap
97
98 ipython: $(IPYTHON)
99 ./pkginstall ipython IPython
100
101 # Distribution targets
102 dist: $(IP_ALLDEPS).tar
103
104 $(IP_ALLDEPS).tar: download readme
105 -mkdir $(IP_ALLDEPS)
106 -ln $(SOURCES) $(TARBALLS) $(IP_ALLDEPS)/
107 tar cf $(IP_ALLDEPS).tar $(IP_ALLDEPS)
108 rm -rf $(IP_ALLDEPS)
109
110 readme: README.html
111
112 README.html: README.txt
113 rst2html README.txt > README.html
114
115 # Auxiliary targets
116 upload: dist
117 rsync -e ssh -av README.html $(IP_ALLDEPS).tar \
118 ipython@ipython.scipy.org:www/dist/alldeps
119
120 clean:
121 ls -p | grep /$ | xargs rm -rf
122 rm -f $(IP_ALLDEPS)* *~
123
124 distclean: clean
125 rm -f $(TARBALLS)
126 rm README.html
127
128 info:
129 echo "TARBALLS"
130 echo $(TARBALLS)
@@ -0,0 +1,109 b''
1 ===========================================================
2 Self-contained IPython installation with all dependencies
3 ===========================================================
4
5 This is a self-contained source distribution of IPython with all its
6 *non-graphical* dependencies, that installs in a single ``make`` call to your
7 home directory (by default) or any location of your choice.
8
9 This distribution is meant for developer-type usage in Unix environments, it is
10 *not* an easy way to get IPython working on Windows, since it assumes the
11 presence of a working compiler and development tools.
12
13 Currently, the distribution contains::
14
15 ipython-0.9.1.tar.gz
16 pyOpenSSL-0.6.tar.gz
17 zope.interface-3.4.1.tar.gz
18 Twisted-8.1.0.tar.bz2
19 foolscap-0.3.1.tar.gz
20 nose-0.10.3.tar.gz
21
22
23 Usage
24 =====
25
26 Download the single tarball where this README file lives and unpack it. If
27 your system is already configured as described below, these lines will do the
28 whole job::
29
30 wget http://ipython.scipy.org/dist/alldeps/ipython-alldeps-0.9.1.tar
31 tar xf ipython-alldeps-0.9.1.tar
32 cd ipython-alldeps-0.9.1
33 make
34
35 If all goes well, then just type::
36
37 iptest
38
39 to run IPython's test suite.
40
41
42 It is meant to be used in an environment where you have your ``$PATH``,
43 ``$PYTHONPATH``, etc variables properly configured, so that the installation of
44 packages can be made with (using ``~/usr/local`` as an example)::
45
46 python setup.py install --prefix=~/usr/local
47
48 For an explanation of how to do this, see below.
49
50 You can configure the default prefix used by editing the file
51 ``pkginstall.cfg``, where you can also override the python version used for the
52 process. If your system is configured in this manner, you can simply type::
53
54 make
55
56 and this will build and install all of IPython's non-graphical dependencies on
57 your system, assuming you have Python, a compiler, the Python headers and the
58 SSL headers available.
59
60
61 .. _environment_configuration:
62
63 Environment configuration
64 =========================
65
66 Below is an example of what to put in your ``~/.bashrc`` file to configure your
67 environment as described in this document, in a reasonably portable manner that
68 takes 64-bit operating systems into account::
69
70 # For processor dependent config
71 MACHINE=$(uname -m)
72
73 # Python version information
74 PYVER=$(python -ESV 2>&1)
75 PYVER_MINOR=${PYVER#Python }
76 PYVER_MAJOR=${PYVER_MINOR:0:3}
77
78 function export_paths {
79 # Export useful paths based on a common prefix
80
81 # Input: a path prefix
82
83 local prefix=$1
84 local pp
85 local lp
86 local pypath=python${PYVER_MAJOR}/site-packages
87
88 # Compute paths with 64-bit specifics
89 if [[ $MACHINE == "x86_64" ]]; then
90 lp=$prefix/lib64:$prefix/lib
91 pp=$prefix/lib64/$pypath:$prefix/lib/$pypath
92 else
93 lp=$prefix/lib
94 pp=$prefix/lib/$pypath
95 fi
96
97 # Set paths based on given prefix
98 export PATH=$prefix/bin:$PATH
99 export CPATH=$prefix/include:$CPATH
100 export LD_LIBRARY_PATH=$lp:$LD_LIBRARY_PATH
101 export LIBRARY_PATH=$lp:$LIBRARY_PATH
102 export PYTHONPATH=$pp:$PYTHONPATH
103 }
104
105 # Actually call the export function to set the paths. If you want more than
106 # one such prefix, note that the call *prepends* the new prefix to the
107 # existing paths, so later calls take priority.
108
109 export_paths $HOME/usr/local
@@ -0,0 +1,119 b''
1 #!/bin/bash
2 #
3 # Simple installation shell script for Python packages.
4 #
5 # Usage:
6 # pkginstall PAKPREFIX [PYPACKAGE]
7 #
8 # PAKPREFIX: prefix of the package as distributed in the tarball.
9 #
10 # PYPACKAGE: name of the Python package as it will end up installed. If not
11 # given, it defaults to PAKPREFIX.
12 #
13
14 #-----------------------------------------------------------------------------
15 # Process command-line args
16 #
17 PAKPREFIX=$1
18 PYPACKAGE=${2:-$PAKPREFIX}
19
20 #-----------------------------------------------------------------------------
21 # Configure main variables
22 #
23 # Defaults for variables that the .cfg file may override.
24 PYTHON_DEFAULT=python
25 PREFIX_DEFAULT=$HOME/usr/local
26
27 # Read config file which may declare user values for these variables.
28 source ./pkginstall.cfg
29
30 # Set the variables we'll actually use, either from the config file or from our
31 # defaults.
32 PYTHON=${PYTHON-${PYTHON_DEFAULT}}
33 PREFIX=${PREFIX-${PREFIX_DEFAULT}}
34
35 #-----------------------------------------------------------------------------
36 # 'Main' code begins
37 #
38
39 # Find the actual python executable path
40 PYTHONX=$(which $PYTHON)
41 if [[ ! -x $PYTHONX ]]; then
42 echo "ERROR: no python executable found at given path: $PYTHON"
43 echo "Aborting."
44 exit 1
45 fi
46
47 # Python version information. PYTHONV holds a versioned string used to build
48 # the site-packages path for the actual Python version we'll use.
49 PYVER=$($PYTHONX -ESV 2>&1)
50 PYVER_MINOR=${PYVER#Python }
51 PYVER_MAJOR=${PYVER_MINOR:0:3}
52 PYTHONV=python${PYVER_MAJOR}
53
54 # Set prefixes and other variables for the installation path.
55 SITEPKG=${PREFIX}/lib/${PYTHONV}/site-packages
56 SITEPKG64=${PREFIX}/lib64/${PYTHONV}/site-packages
57
58 # User diagnostics of current config
59 echo "Configuration:"
60 echo " PYTHON : $PYTHON"
61 echo " PYTHONX : $PYTHONX"
62 echo " PREFIX : $PREFIX"
63 echo " SITEPKG : $SITEPKG"
64 echo " SITEPKG64: $SITEPKG64"
65
66 # Find tarball
67 tarball=$(ls *$PAKPREFIX*.tar.*)
68
69 if [[ -z $tarball ]]; then
70 echo "ERROR: tarball not found for $PYPACKAGE"
71 exit 1
72 fi
73
74 # Figure out the name of the directory and compression format to use to unpack
75 pakdir=$(echo $tarball | awk -F '.tar.' '{print $1}')
76 tarfmt=$(echo $tarball | awk -F '.tar.' '{print $2}')
77
78 if [[ $tarfmt == "gz" ]]; then
79 tarflag="z"
80 else
81 tarflag="j"
82 fi
83
84 # Unpack the tarball if needed
85 if [[ ! -d $pakdir ]]; then
86 echo "Unpacking tarball: $tarball"
87 tar -x -${tarflag} -f $tarball
88
89 if [[ ! -d $pakdir ]]; then
90 echo "Tarball $tarball unpacked to unexpected path, aborting"
91 exit 1
92 fi
93 fi
94
95 # Remove existing ${PYPACKAGE} to make sure the build doesn't pick up spurious
96 # things. We don't touch the bin/ dir or anything else because it's hard to
97 # know what goes there in advance. But this should prevent most serious
98 # problems.
99 rm -rf $SITEPKG/${PYPACKAGE}
100 rm -rf $SITEPKG/${PYPACKAGE}*.egg
101 rm -rf $SITEPKG/${PYPACKAGE}*.egg-info
102
103 rm -rf $SITEPKG64/${PYPACKAGE}
104 rm -rf $SITEPKG64/${PYPACKAGE}*.egg
105 rm -rf $SITEPKG64/${PYPACKAGE}*.egg-info
106
107 # Make/install phase
108
109 # Set python search path correctly
110 export PYTHONPATH=$SITEPKG:$SITEPKG64:$PYTHONPATH
111
112 # Ensure install dirs exist
113 mkdir -p $SITEPKG
114 mkdir -p $SITEPKG64
115
116 cd ${pakdir}
117 rm -rf build dist
118 $PYTHONX setup.py clean
119 time $PYTHONX setup.py install --prefix=$PREFIX
@@ -0,0 +1,27 b''
1 # -*- sh -*-
2 #
3 # Configuration for the pkginstall script.
4 # This script uses bash syntax, as it will be sourced by a bash script.
5
6 # Uncomment and set the variables you want, otherwise pkginstall has sensible
7 # defaults predefined. These can also be declared either as environment
8 # variables (which can be done by the makefile calling this script).
9
10 #-----------------------------------------------------------------------------
11 #
12 # Executable for Python.
13 #
14 # You can set this to an explicit full path if you don't want the default
15 # (simply 'python') to be the version used to install this package.
16
17 #PYTHON=python
18
19 #-----------------------------------------------------------------------------
20 #
21 # Default prefix.
22 #
23 # This should be a valid input the setup.py script as the --prefix argument.
24 # That is, your $PYTHONPATH should contain $PREFIX/lib/pythonX.Y/site-packages,
25 # your $PATH should contain $PREFIX/bin, etc.
26
27 #PREFIX=$HOME/usr/local
General Comments 0
You need to be logged in to leave comments. Login now