##// END OF EJS Templates
Merge branch 'version-info' into trunk
Fernando Perez -
r3216:133507fb merge
parent child Browse files
Show More
@@ -0,0 +1,1
1 IPython/.git_commit_info.ini export-subst
@@ -0,0 +1,9
1 # This is an ini file that may contain information about the code state
2 [commit hash]
3
4 # The line below may contain a valid hash if it has been substituted during
5 # 'git archive'
6 archive_subst_hash=$Format:%h$
7
8 # This line may be modified by the install process
9 install_hash=
@@ -1,8 +1,10
1 build
2 ./dist
1 3 docs/dist
2 4 docs/build/*
3 5 docs/source/api/generated
4 *.pyc
6 *.py[co]
5 7 build
6 8 *.egg-info
7 *.py~
9 *~
8 10 *.bak
@@ -1,77 +1,85
1 IPython is licensed under the terms of the new or revised BSD license, as follows:
1 =============================
2 The IPython licensing terms
3 =============================
2 4
3 Copyright (c) 2008, IPython Development Team
5 IPython is licensed under the terms of the Modified BSD License (also known as
6 New or Revised BSD), as follows:
7
8 Copyright (c) 2008-2010, IPython Development Team
9 Copyright (c) 2001-2007, Fernando Perez. <fernando.perez@colorado.edu>
10 Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
11 Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
4 12
5 13 All rights reserved.
6 14
7 Redistribution and use in source and binary forms, with or without modification,
8 are permitted provided that the following conditions are met:
15 Redistribution and use in source and binary forms, with or without
16 modification, are permitted provided that the following conditions are met:
9 17
10 Redistributions of source code must retain the above copyright notice, this list of
11 conditions and the following disclaimer.
18 Redistributions of source code must retain the above copyright notice, this
19 list of conditions and the following disclaimer.
12 20
13 Redistributions in binary form must reproduce the above copyright notice, this list
14 of conditions and the following disclaimer in the documentation and/or other
15 materials provided with the distribution.
21 Redistributions in binary form must reproduce the above copyright notice, this
22 list of conditions and the following disclaimer in the documentation and/or
23 other materials provided with the distribution.
16 24
17 Neither the name of the IPython Development Team nor the names of its contributors
18 may be used to endorse or promote products derived from this software without
19 specific prior written permission.
25 Neither the name of the IPython Development Team nor the names of its
26 contributors may be used to endorse or promote products derived from this
27 software without specific prior written permission.
20 28
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
22 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE.
29 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
32 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
33 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
37 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 39
32 40 About the IPython Development Team
33 41 ----------------------------------
34 42
35 Fernando Perez began IPython in 2001 based on code from Janko Hauser <jhauser@zscout.de>
36 and Nathaniel Gray <n8gray@caltech.edu>. Fernando is still the project lead.
43 Fernando Perez began IPython in 2001 based on code from Janko Hauser
44 <jhauser@zscout.de> and Nathaniel Gray <n8gray@caltech.edu>. Fernando is still
45 the project lead.
46
47 The IPython Development Team is the set of all contributors to the IPython
48 project. This includes all of the IPython subprojects. A full list with
49 details is kept in the documentation directory, in the file
50 ``about/credits.txt``.
37 51
38 The IPython Development Team is the set of all contributors to the IPython project.
39 This includes all of the IPython subprojects. Here is a list of the currently active contributors:
52 The core team that coordinates development on GitHub can be found here:
53 http://github.com/ipython. As of late 2010, it consists of:
40 54
41 * Matthieu Brucher
42 * Ondrej Certik
43 * Laurent Dufrechou
44 * Robert Kern
45 * Brian E. Granger
46 * Fernando Perez (project leader)
47 * Benjamin Ragan-Kelley
48 * Ville M. Vainio
49 * Gael Varoququx
50 * Stefan van der Walt
51 * Tech-X Corporation
52 * Barry Wark
55 * Brian E. Granger
56 * Jonathan March
57 * Evan Patterson
58 * Fernando Perez
59 * Min Ragan-Kelley
60 * Robert Kern
53 61
54 If your name is missing, please add it.
55 62
56 63 Our Copyright Policy
57 64 --------------------
58 65
59 IPython uses a shared copyright model. Each contributor maintains copyright over
60 their contributions to IPython. But, it is important to note that these
66 IPython uses a shared copyright model. Each contributor maintains copyright
67 over their contributions to IPython. But, it is important to note that these
61 68 contributions are typically only changes to the repositories. Thus, the IPython
62 69 source code, in its entirety is not the copyright of any single person or
63 institution. Instead, it is the collective copyright of the entire IPython
64 Development Team. If individual contributors want to maintain a record of what
65 changes/contributions they have specific copyright on, they should indicate their
66 copyright in the commit message of the change, when they commit the change to
67 one of the IPython repositories.
70 institution. Instead, it is the collective copyright of the entire IPython
71 Development Team. If individual contributors want to maintain a record of what
72 changes/contributions they have specific copyright on, they should indicate
73 their copyright in the commit message of the change, when they commit the
74 change to one of the IPython repositories.
68 75
69 With this in mind, the following banner should be used in any source code file to
70 indicate the copyright and license terms:
76 With this in mind, the following banner should be used in any source code file
77 to indicate the copyright and license terms:
71 78
72 #-------------------------------------------------------------------------------
73 # Copyright (C) 2008 The IPython Development Team
79 #-----------------------------------------------------------------------------
80 # Copyright (c) 2010, IPython Development Team.
81 #
82 # Distributed under the terms of the Modified BSD License.
74 83 #
75 # Distributed under the terms of the BSD License. The full license is in
76 # the file COPYING, distributed as part of this software.
77 #------------------------------------------------------------------------------- No newline at end of file
84 # The full license is in the file COPYING.txt, distributed with this software.
85 #-----------------------------------------------------------------------------
@@ -6,10 +6,14 IPython.
6 6 IPython is a set of tools for interactive and exploratory computing in Python.
7 7 """
8 8 #-----------------------------------------------------------------------------
9 # Copyright (C) 2008-2009 The IPython Development Team
9 # Copyright (c) 2008-2010, IPython Development Team.
10 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
11 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
12 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
10 13 #
11 # Distributed under the terms of the BSD License. The full license is in
12 # the file COPYING, distributed as part of this software.
14 # Distributed under the terms of the Modified BSD License.
15 #
16 # The full license is in the file COPYING.txt, distributed with this software.
13 17 #-----------------------------------------------------------------------------
14 18
15 19 #-----------------------------------------------------------------------------
@@ -45,6 +49,7 from .frontend.terminal.embed import embed
45 49 from .core.error import TryNext
46 50 from .core.interactiveshell import InteractiveShell
47 51 from .testing import test
52 from .utils.sysinfo import sys_info
48 53
49 54 # Release data
50 55 __author__ = ''
@@ -52,4 +57,3 for author, email in release.authors.itervalues():
52 57 __author__ += author + ' <' + email + '>\n'
53 58 __license__ = release.license
54 59 __version__ = release.version
55 __revision__ = release.revision
@@ -1,39 +1,40
1 1 # -*- coding: utf-8 -*-
2 2 """Release data for the IPython project."""
3 3
4 #*****************************************************************************
5 # Copyright (C) 2008-2009 The IPython Development Team
6 # Copyright (C) 2001-2008 Fernando Perez <fperez@colorado.edu>
7 # Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and Nathaniel Gray
8 # <n8gray@caltech.edu>
4 #-----------------------------------------------------------------------------
5 # Copyright (c) 2008-2010, IPython Development Team.
6 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
7 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
8 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
9 9 #
10 # Distributed under the terms of the BSD License. The full license is in
11 # the file COPYING, distributed as part of this software.
12 #*****************************************************************************
10 # Distributed under the terms of the Modified BSD License.
11 #
12 # The full license is in the file COPYING.txt, distributed with this software.
13 #-----------------------------------------------------------------------------
13 14
14 15 # Name of the package for release purposes. This is the name which labels
15 16 # the tarballs and RPMs made by distutils, so it's best to lowercase it.
16 17 name = 'ipython'
17 18
18 # For versions with substrings (like 0.6.16.svn), use an extra . to separate
19 # the new substring. We have to avoid using either dashes or underscores,
20 # because bdist_rpm does not accept dashes (an RPM) convention, and
21 # bdist_deb does not accept underscores (a Debian convention).
19 # IPython version information. An empty _version_extra corresponds to a full
20 # release. 'dev' as a _version_extra string means this is a development
21 # version
22 _version_major = 0
23 _version_minor = 11
24 _version_micro = '' # use '' for first of series, number for 1 and above
25 _version_extra = 'dev'
26 #_version_extra = '' # Uncomment this for full releases
22 27
23 development = True # change this to False to do a release
24 version_base = '0.11.alpha1'
25 branch = 'ipython'
26 # This needs to be updated to something that is meaningful for git
27 revision = '0'
28 # Construct full version string from these.
29 _ver = [_version_major, _version_minor]
30 if _version_micro:
31 _ver.append(_version_micro)
32 if _version_extra:
33 _ver.append(_version_extra)
28 34
29 if development:
30 if branch == 'ipython':
31 version = '%s.git' % (version_base)
32 else:
33 version = '%s.git.%s' % (version_base, branch)
34 else:
35 version = version_base
35 __version__ = '.'.join(map(str, _ver))
36 36
37 version = __version__ # backwards compatibility name
37 38
38 39 description = "An interactive computing environment for Python"
39 40
@@ -95,8 +96,8 The parallel computing architecture has the following main features:
95 96
96 97 * Robust error handling in parallel code.
97 98
98 The latest development version is always available from IPython's `Launchpad
99 site <http://launchpad.net/ipython>`_.
99 The latest development version is always available from IPython's `GitHub
100 site <http://github.com/ipython>`_.
100 101 """
101 102
102 103 license = 'BSD'
@@ -322,7 +322,6 class IPAppConfigLoader(BaseAppConfigLoader):
322 322 # Crash handler for this application
323 323 #-----------------------------------------------------------------------------
324 324
325
326 325 _message_template = """\
327 326 Oops, $self.app_name crashed. We do our best to make it stable, but...
328 327
@@ -354,7 +353,7 class IPAppCrashHandler(CrashHandler):
354 353 def __init__(self, app):
355 354 contact_name = release.authors['Fernando'][0]
356 355 contact_email = release.authors['Fernando'][1]
357 bug_tracker = 'https://bugs.launchpad.net/ipython/+filebug'
356 bug_tracker = 'http://github.com/ipython/ipython/issues'
358 357 super(IPAppCrashHandler,self).__init__(
359 358 app, contact_name, contact_email, bug_tracker
360 359 )
@@ -325,7 +325,7 class ClusterDirCrashHandler(CrashHandler):
325 325 def __init__(self, app):
326 326 contact_name = release.authors['Brian'][0]
327 327 contact_email = release.authors['Brian'][1]
328 bug_tracker = 'https://bugs.launchpad.net/ipython/+filebug'
328 bug_tracker = 'http://github.com/ipython/ipython/issues'
329 329 super(ClusterDirCrashHandler,self).__init__(
330 330 app, contact_name, contact_email, bug_tracker
331 331 )
@@ -115,7 +115,7 have['gobject'] = test_for('gobject')
115 115 def report():
116 116 """Return a string with a summary report of test-related variables."""
117 117
118 out = [ sys_info() ]
118 out = [ sys_info(), '\n']
119 119
120 120 avail = []
121 121 not_avail = []
@@ -1,6 +1,6
1 1 # encoding: utf-8
2 2 """
3 Utilities for getting information about a system.
3 Utilities for getting information about IPython and the system it's running in.
4 4 """
5 5
6 6 #-----------------------------------------------------------------------------
@@ -16,37 +16,122 Utilities for getting information about a system.
16 16
17 17 import os
18 18 import platform
19 import pprint
19 20 import sys
20 21 import subprocess
21 22
23 from ConfigParser import ConfigParser
24
22 25 from IPython.core import release
23 26
24 27 #-----------------------------------------------------------------------------
28 # Globals
29 #-----------------------------------------------------------------------------
30 COMMIT_INFO_FNAME = '.git_commit_info.ini'
31
32 #-----------------------------------------------------------------------------
25 33 # Code
26 34 #-----------------------------------------------------------------------------
27 35
36 def pkg_commit_hash(pkg_path):
37 """Get short form of commit hash given directory `pkg_path`
38
39 There should be a file called 'COMMIT_INFO.txt' in `pkg_path`. This is a
40 file in INI file format, with at least one section: ``commit hash``, and two
41 variables ``archive_subst_hash`` and ``install_hash``. The first has a
42 substitution pattern in it which may have been filled by the execution of
43 ``git archive`` if this is an archive generated that way. The second is
44 filled in by the installation, if the installation is from a git archive.
45
46 We get the commit hash from (in order of preference):
47
48 * A substituted value in ``archive_subst_hash``
49 * A written commit hash value in ``install_hash`
50 * git output, if we are in a git repository
51
52 If all these fail, we return a not-found placeholder tuple
53
54 Parameters
55 ----------
56 pkg_path : str
57 directory containing package
58
59 Returns
60 -------
61 hash_from : str
62 Where we got the hash from - description
63 hash_str : str
64 short form of hash
65 """
66 # Try and get commit from written commit text file
67 pth = os.path.join(pkg_path, COMMIT_INFO_FNAME)
68 if not os.path.isfile(pth):
69 raise IOError('Missing commit info file %s' % pth)
70 cfg_parser = ConfigParser()
71 cfg_parser.read(pth)
72 archive_subst = cfg_parser.get('commit hash', 'archive_subst_hash')
73 if not archive_subst.startswith('$Format'): # it has been substituted
74 return 'archive substitution', archive_subst
75 install_subst = cfg_parser.get('commit hash', 'install_hash')
76 if install_subst != '':
77 return 'installation', install_subst
78 # maybe we are in a repository
79 proc = subprocess.Popen('git rev-parse --short HEAD',
80 stdout=subprocess.PIPE,
81 stderr=subprocess.PIPE,
82 cwd=pkg_path, shell=True)
83 repo_commit, _ = proc.communicate()
84 if repo_commit:
85 return 'repository', repo_commit.strip()
86 return '(none found)', '<not found>'
87
88
89 def pkg_info(pkg_path):
90 """Return dict describing the context of this package
91
92 Parameters
93 ----------
94 pkg_path : str
95 path containing __init__.py for package
96
97 Returns
98 -------
99 context : dict
100 with named parameters of interest
101 """
102 src, hsh = pkg_commit_hash(pkg_path)
103 return dict(
104 ipython_version=release.version,
105 ipython_path=pkg_path,
106 commit_source=src,
107 commit_hash=hsh,
108 sys_version=sys.version,
109 sys_executable=sys.executable,
110 sys_platform=sys.platform,
111 platform=platform.platform(),
112 os_name=os.name,
113 )
114
115
28 116 def sys_info():
29 117 """Return useful information about IPython and the system, as a string.
30 118
31 Examples
32 --------
33 In [1]: print(sys_info())
34 IPython version: 0.11.bzr.r1340 # random
35 BZR revision : 1340
36 Platform info : os.name -> posix, sys.platform -> linux2
37 : Linux-2.6.31-17-generic-i686-with-Ubuntu-9.10-karmic
38 Python info : 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
39 [GCC 4.4.1]
40 """
41 out = []
42 out.append('IPython version: %s' % release.version)
43 out.append('BZR revision : %s' % release.revision)
44 out.append('Platform info : os.name -> %s, sys.platform -> %s' %
45 (os.name,sys.platform) )
46 out.append(' : %s' % platform.platform())
47 out.append('Python info : %s' % sys.version)
48 out.append('') # ensure closing newline
49 return '\n'.join(out)
119 Example
120 -------
121 In [2]: print sys_info()
122 {'commit_hash': '144fdae', # random
123 'commit_source': 'repository',
124 'ipython_path': '/home/fperez/usr/lib/python2.6/site-packages/IPython',
125 'ipython_version': '0.11.dev',
126 'os_name': 'posix',
127 'platform': 'Linux-2.6.35-22-generic-i686-with-Ubuntu-10.10-maverick',
128 'sys_executable': '/usr/bin/python',
129 'sys_platform': 'linux2',
130 'sys_version': '2.6.6 (r266:84292, Sep 15 2010, 15:52:39) \\n[GCC 4.4.5]'}
131 """
132 p = os.path
133 path = p.dirname(p.abspath(p.join(__file__, '..')))
134 return pprint.pformat(pkg_info(path))
50 135
51 136
52 137 def _num_cpus_unix():
@@ -18,6 +18,7 graft IPython/scripts
18 18 graft IPython/testing
19 19 graft IPython/utils
20 20
21 include IPython/.git_commit_info.ini
21 22
22 23 graft docs
23 24 exclude docs/\#*
@@ -18,14 +18,9 For full details, see the installation section of the manual. The basic parts
18 18 of IPython only need the Python standard library, but much of its more advanced
19 19 functionality requires extra packages.
20 20
21 Officially, IPython requires Python version 2.5 or 2.6. We have *not* yet
22 started to port IPython to Python 3.0.
23
24 .. warning::
25
26 IPython 0.10 has only been well tested with Python 2.5 and 2.6. Parts of
27 it may work with Python 2.4, but we do not officially support Python 2.4
28 anymore. If you need to use 2.4, you can still run IPython 0.9.
21 Officially, IPython requires Python version 2.6 or 2.7. An experimental port
22 of IPython to Python 3.x has been sarted, and is available at
23 http://github.com/takowl/ipython/tree/ipython-py3k.
29 24
30 25
31 26 Instant running
@@ -49,28 +49,22 it system-wide or having configure anything, by typing at the terminal:
49 49
50 50 python ipython.py
51 51
52 and similarly, you can execute the built-in test suite with:
53
54 .. code-block:: bash
55
56 python iptest.py
52 In order to run the test suite, you must at least be able to import IPython,
53 even if you haven't fully installed the user-facing scripts yet (common in a
54 development environment). You can then run the tests with:
57 55
56 .. code-block:: bash
58 57
59 This script manages intelligently both nose and trial, choosing the correct
60 test system for each of IPython's components.
58 python -c "import IPython; IPython.test()"
61 59
62 Once you have either installed it or at least configured your system to be
63 able to import IPython, you can run the tests with:
60 Once you have installed IPython either via a full install or using:
64 61
65 62 .. code-block:: bash
66 63
67 python -c "import IPython; IPython.test()"
64 python setup.py develop
68 65
69 This should work as long as IPython can be imported, even if you haven't fully
70 installed the user-facing scripts yet (common in a development environment).
71 Once you have installed IPython, you will have available system-wide a script
72 called :file:`iptest` that does the exact same as the :file:`iptest.py` script
73 in the source directory, so you can then test simply with:
66 you will have available a system-wide script called :file:`iptest` that runs
67 the full test suite. You can then run the suite with:
74 68
75 69 .. code-block:: bash
76 70
@@ -83,26 +77,25 Regardless of how you run things, you should eventually see something like:
83 77
84 78 **********************************************************************
85 79 Test suite completed for system with the following information:
86 IPython version: 0.11.bzr.r1340
87 BZR revision : 1340
88 Platform info : os.name -> posix, sys.platform -> linux2
89 : Linux-2.6.31-17-generic-i686-with-Ubuntu-9.10-karmic
90 Python info : 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
91 [GCC 4.4.1]
92
93 Running from an installed IPython: True
80 {'commit_hash': '144fdae',
81 'commit_source': 'repository',
82 'ipython_path': '/home/fperez/usr/lib/python2.6/site-packages/IPython',
83 'ipython_version': '0.11.dev',
84 'os_name': 'posix',
85 'platform': 'Linux-2.6.35-22-generic-i686-with-Ubuntu-10.10-maverick',
86 'sys_executable': '/usr/bin/python',
87 'sys_platform': 'linux2',
88 'sys_version': '2.6.6 (r266:84292, Sep 15 2010, 15:52:39) \n[GCC 4.4.5]'}
94 89
95 90 Tools and libraries available at test time:
96 91 curses foolscap gobject gtk pexpect twisted wx wx.aui zope.interface
97 92
98 Tools and libraries NOT available at test time:
99 objc
100
101 Ran 11 test groups in 36.244s
93 Ran 9 test groups in 67.213s
102 94
103 95 Status:
104 96 OK
105 97
98
106 99 If not, there will be a message indicating which test group failed and how to
107 100 rerun that group individually. For example, this tests the
108 101 :mod:`IPython.utils` subpackage, the :option:`-v` option shows progress
@@ -110,7 +103,7 indicators:
110 103
111 104 .. code-block:: bash
112 105
113 $ python iptest.py -v IPython.utils
106 $ iptest -v IPython.utils
114 107 ..........................SS..SSS............................S.S...
115 108 .........................................................
116 109 ----------------------------------------------------------------------
@@ -126,7 +119,7 example, this lets you run the specific test :func:`test_rehashx` inside the
126 119
127 120 .. code-block:: bash
128 121
129 $ python iptest.py -vv IPython.core.tests.test_magic:test_rehashx
122 $ iptest -vv IPython.core.tests.test_magic:test_rehashx
130 123 IPython.core.tests.test_magic.test_rehashx(True,) ... ok
131 124 IPython.core.tests.test_magic.test_rehashx(True,) ... ok
132 125
@@ -146,6 +139,16 package basis:
146 139
147 140 trial IPython.kernel
148 141
142 .. note::
143
144 The system information summary printed above is accessible from the top
145 level package. If you encounter a problem with IPython, it's useful to
146 include this information when reporting on the mailing list; use::
147
148 from IPython import sys_info
149 print sys_info()
150
151 and include the resulting information in your query.
149 152
150 153 For developers: writing tests
151 154 =============================
@@ -6,12 +6,16 Under Posix environments it works like a typical setup.py script.
6 6 Under Windows, the command sdist is not supported, since IPython
7 7 requires utilities which are not available under Windows."""
8 8
9 #-------------------------------------------------------------------------------
10 # Copyright (C) 2008 The IPython Development Team
9 #-----------------------------------------------------------------------------
10 # Copyright (c) 2008-2010, IPython Development Team.
11 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
12 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
13 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
11 14 #
12 # Distributed under the terms of the BSD License. The full license is in
13 # the file COPYING, distributed as part of this software.
14 #-------------------------------------------------------------------------------
15 # Distributed under the terms of the Modified BSD License.
16 #
17 # The full license is in the file COPYING.txt, distributed with this software.
18 #-----------------------------------------------------------------------------
15 19
16 20 #-----------------------------------------------------------------------------
17 21 # Minimal Python version sanity check
@@ -55,7 +59,8 from setupbase import (
55 59 find_package_data,
56 60 find_scripts,
57 61 find_data_files,
58 check_for_dependencies
62 check_for_dependencies,
63 record_commit_info,
59 64 )
60 65
61 66 isfile = os.path.isfile
@@ -239,6 +244,7 else:
239 244 # Do the actual setup now
240 245 #---------------------------------------------------------------------------
241 246
247 setup_args['cmdclass'] = {'build_py': record_commit_info('IPython')}
242 248 setup_args['packages'] = packages
243 249 setup_args['package_data'] = package_data
244 250 setup_args['scripts'] = scripts
@@ -1,5 +1,4
1 1 # encoding: utf-8
2
3 2 """
4 3 This module defines the things that are used in setup.py for building IPython
5 4
@@ -9,8 +8,7 This includes:
9 8 * Functions for finding things like packages, package data, etc.
10 9 * A function for checking dependencies.
11 10 """
12
13 __docformat__ = "restructuredtext en"
11 from __future__ import print_function
14 12
15 13 #-------------------------------------------------------------------------------
16 14 # Copyright (C) 2008 The IPython Development Team
@@ -22,9 +20,11 __docformat__ = "restructuredtext en"
22 20 #-------------------------------------------------------------------------------
23 21 # Imports
24 22 #-------------------------------------------------------------------------------
23 import os
24 import sys
25 25
26 import os, sys
27
26 from ConfigParser import ConfigParser
27 from distutils.command.build_py import build_py
28 28 from glob import glob
29 29
30 30 from setupext import install_data_ext
@@ -38,7 +38,7 isfile = os.path.isfile
38 38 pjoin = os.path.join
39 39
40 40 def oscmd(s):
41 print ">", s
41 print(">", s)
42 42 os.system(s)
43 43
44 44 # A little utility we'll need below, since glob() does NOT allow you to do
@@ -175,9 +175,9 def make_dir_struct(tag,base,out_base):
175 175 # filenames, we must join back with the dirpath to get full valid file
176 176 # paths:
177 177 pfiles = [pjoin(dirpath,f) for f in filenames]
178 # Finally, generate the entry we need, which is a triple of (tag,output
178 # Finally, generate the entry we need, which is a pari of (output
179 179 # path, files) for use as a data_files parameter in install_data.
180 out.append((tag,out_path,pfiles))
180 out.append((out_path, pfiles))
181 181
182 182 return out
183 183
@@ -194,7 +194,8 def find_data_files():
194 194
195 195 # Simple file lists can be made by hand
196 196 manpages = filter(isfile, glob(pjoin('docs','man','*.1.gz')))
197 igridhelpfiles = filter(isfile, glob(pjoin('IPython','extensions','igrid_help.*')))
197 igridhelpfiles = filter(isfile,
198 glob(pjoin('IPython','extensions','igrid_help.*')))
198 199
199 200 # For nested structures, use the utility above
200 201 example_files = make_dir_struct(
@@ -209,15 +210,15 def find_data_files():
209 210 )
210 211
211 212 # And assemble the entire output list
212 data_files = [ ('data',manpagebase, manpages),
213 ('data',pjoin(docdirbase,'extensions'),igridhelpfiles),
213 data_files = [ (manpagebase, manpages),
214 (pjoin(docdirbase, 'extensions'), igridhelpfiles),
214 215 ] + manual_files + example_files
215 216
216 217 ## import pprint # dbg
217 ## print '*'*80
218 ## print 'data files'
218 ## print('*'*80)
219 ## print('data files')
219 220 ## pprint.pprint(data_files)
220 ## print '*'*80
221 ## print('*'*80)
221 222
222 223 return data_files
223 224
@@ -271,8 +272,10 def find_scripts():
271 272 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
272 273 # doesn't find them.
273 274 if 'bdist_wininst' in sys.argv:
274 if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
275 print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting."
275 if len(sys.argv) > 2 and \
276 ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
277 print("ERROR: bdist_wininst must be run alone. Exiting.",
278 file=sys.stderr)
276 279 sys.exit(1)
277 280 scripts.append(pjoin('scripts','ipython_win_post_install.py'))
278 281
@@ -288,7 +291,7 def check_for_dependencies():
288 291 This function should NOT be called if running under setuptools!
289 292 """
290 293 from setupext.setupext import (
291 print_line, print_raw, print_status, print_message,
294 print_line, print_raw, print_status,
292 295 check_for_zopeinterface, check_for_twisted,
293 296 check_for_foolscap, check_for_pyopenssl,
294 297 check_for_sphinx, check_for_pygments,
@@ -312,3 +315,61 def check_for_dependencies():
312 315 check_for_pygments()
313 316 check_for_nose()
314 317 check_for_pexpect()
318
319
320 def record_commit_info(pkg_dir, build_cmd=build_py):
321 """ Return extended build command class for recording commit
322
323 The extended command tries to run git to find the current commit, getting
324 the empty string if it fails. It then writes the commit hash into a file
325 in the `pkg_dir` path, named ``.git_commit_info.ini``.
326
327 In due course this information can be used by the package after it is
328 installed, to tell you what commit it was installed from if known.
329
330 To make use of this system, you need a package with a .git_commit_info.ini
331 file - e.g. ``myproject/.git_commit_info.ini`` - that might well look like
332 this::
333
334 # This is an ini file that may contain information about the code state
335 [commit hash]
336 # The line below may contain a valid hash if it has been substituted
337 # during 'git archive'
338 archive_subst_hash=$Format:%h$
339 # This line may be modified by the install process
340 install_hash=
341
342 The .git_commit_info file above is also designed to be used with git
343 substitution - so you probably also want a ``.gitattributes`` file in the
344 root directory of your working tree that contains something like this::
345
346 myproject/.git_commit_info.ini export-subst
347
348 That will cause the ``.git_commit_info.ini`` file to get filled in by ``git
349 archive`` - useful in case someone makes such an archive - for example with
350 via the github 'download source' button.
351
352 Although all the above will work as is, you might consider having something
353 like a ``get_info()`` function in your package to display the commit
354 information at the terminal. See the ``pkg_info.py`` module in the nipy
355 package for an example.
356 """
357 class MyBuildPy(build_cmd):
358 ''' Subclass to write commit data into installation tree '''
359 def run(self):
360 build_py.run(self)
361 import subprocess
362 proc = subprocess.Popen('git rev-parse --short HEAD',
363 stdout=subprocess.PIPE,
364 stderr=subprocess.PIPE,
365 shell=True)
366 repo_commit, _ = proc.communicate()
367 # We write the installation commit even if it's empty
368 cfg_parser = ConfigParser()
369 cfg_parser.read(pjoin(pkg_dir, '.git_commit_info.ini'))
370 cfg_parser.set('commit hash', 'install_hash', repo_commit)
371 out_pth = pjoin(self.build_lib, pkg_dir, '.git_commit_info.ini')
372 out_file = open(out_pth, 'wt')
373 cfg_parser.write(out_file)
374 out_file.close()
375 return MyBuildPy
@@ -20,16 +20,16 for d in ['build','dist',pjoin('docs','build'),pjoin('docs','dist'),
20 20 remove_tree(d)
21 21
22 22 # Build source and binary distros
23 c('./setup.py sdist --formats=gztar,zip')
23 sh('./setup.py sdist --formats=gztar,zip')
24 24
25 25 # Build eggs
26 c('python2.6 ./setupegg.py bdist_egg')
26 sh('python2.6 ./setupegg.py bdist_egg')
27 27
28 28 # Call the windows build separately, so that the extra Windows scripts don't
29 29 # get pulled into Unix builds (setup.py has code which checks for
30 30 # bdist_wininst)
31 c("python setup.py bdist_wininst --install-script=ipython_win_post_install.py")
31 sh("python setup.py bdist_wininst --install-script=ipython_win_post_install.py")
32 32
33 33 # Change name so retarded Vista runs the installer correctly
34 c("rename 's/linux-i686/win32-setup/' dist/*.exe")
35 c("rename 's/linux-x86_64/win32-setup/' dist/*.exe")
34 sh("rename 's/linux-i686/win32-setup/' dist/*.exe")
35 sh("rename 's/linux-x86_64/win32-setup/' dist/*.exe")
@@ -9,7 +9,7 import shutil
9 9
10 10 from toollib import *
11 11
12 tag = commands.getoutput('git describe')
12 tag = commands.getoutput('git describe --tags')
13 13 base_name = 'ipython-%s' % tag
14 14 tar_name = '%s.tgz' % base_name
15 15
@@ -21,5 +21,5 tar_name = '%s.tgz' % base_name
21 21 start_dir = os.getcwd()
22 22 cd('..')
23 23 git_tpl = 'git archive --format=tar --prefix={0}/ HEAD | gzip > {1}'
24 c(git_tpl.format(base_name, tar_name))
25 c('mv {0} tools/'.format(tar_name))
24 sh(git_tpl.format(base_name, tar_name))
25 sh('mv {0} tools/'.format(tar_name))
@@ -11,14 +11,16 pjoin = os.path.join
11 11 cd = os.chdir
12 12
13 13 # Utility functions
14 def c(cmd):
15 """Run system command, raise SystemExit if it returns an error."""
14 def sh(cmd):
15 """Run system command in shell, raise SystemExit if it returns an error."""
16 16 print "$",cmd
17 17 stat = os.system(cmd)
18 18 #stat = 0 # Uncomment this and comment previous to run in debug mode
19 19 if stat:
20 20 raise SystemExit("Command %s failed with code: %s" % (cmd, stat))
21 21
22 # Backwards compatibility
23 c = sh
22 24
23 25 def get_ipdir():
24 26 """Get IPython directory from command line, or assume it's the one above."""
@@ -39,17 +41,8 def get_ipdir():
39 41
40 42 def compile_tree():
41 43 """Compile all Python files below current directory."""
42 vstr = '.'.join(map(str,sys.version_info[:2]))
43 stat = os.system('python %s/lib/python%s/compileall.py .' %
44 (sys.prefix,vstr))
44 stat = os.system('python -m compileall .')
45 45 if stat:
46 46 msg = '*** ERROR: Some Python files in tree do NOT compile! ***\n'
47 47 msg += 'See messages above for the actual file that produced it.\n'
48 48 raise SystemExit(msg)
49
50
51 def version_info():
52 """Return bzr version info as a dict."""
53 out = os.popen('bzr version-info')
54 pairs = (l.split(':',1) for l in out)
55 return dict(((k,v.strip()) for (k,v) in pairs))
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now