Show More
@@ -0,0 +1,55 b'' | |||
|
1 | """Various utilities common to IPython release and maintenance tools. | |
|
2 | """ | |
|
3 | # Library imports | |
|
4 | import os | |
|
5 | import sys | |
|
6 | ||
|
7 | from distutils.dir_util import remove_tree | |
|
8 | ||
|
9 | # Useful shorthands | |
|
10 | pjoin = os.path.join | |
|
11 | cd = os.chdir | |
|
12 | ||
|
13 | # Utility functions | |
|
14 | def c(cmd): | |
|
15 | """Run system command, raise SystemExit if it returns an error.""" | |
|
16 | print "$",cmd | |
|
17 | #stat = os.system(cmd) | |
|
18 | stat = 0 # Uncomment this and comment previous to run in debug mode | |
|
19 | if stat: | |
|
20 | raise SystemExit("Command %s failed with code: %s" % (cmd, stat)) | |
|
21 | ||
|
22 | ||
|
23 | def get_ipdir(): | |
|
24 | """Get IPython directory from command line, or assume it's the one above.""" | |
|
25 | ||
|
26 | # Initialize arguments and check location | |
|
27 | try: | |
|
28 | ipdir = sys.argv[1] | |
|
29 | except IndexError: | |
|
30 | ipdir = '..' | |
|
31 | ||
|
32 | ipdir = os.path.abspath(ipdir) | |
|
33 | ||
|
34 | cd(ipdir) | |
|
35 | if not os.path.isdir('IPython') and os.path.isfile('setup.py'): | |
|
36 | raise SystemExit('Invalid ipython directory: %s' % ipdir) | |
|
37 | return ipdir | |
|
38 | ||
|
39 | ||
|
40 | def compile_tree(): | |
|
41 | """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)) | |
|
45 | if stat: | |
|
46 | msg = '*** ERROR: Some Python files in tree do NOT compile! ***\n' | |
|
47 | msg += 'See messages above for the actual file that produced it.\n' | |
|
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)) |
@@ -57,7 +57,7 b' def file_doesnt_endwith(test,endings):' | |||
|
57 | 57 | # Basic project information |
|
58 | 58 | #--------------------------------------------------------------------------- |
|
59 | 59 | |
|
60 |
# |
|
|
60 | # release.py contains version, authors, license, url, keywords, etc. | |
|
61 | 61 | execfile(pjoin('IPython','core','release.py')) |
|
62 | 62 | |
|
63 | 63 | # Create a dict with the basic information |
@@ -42,7 +42,7 b' from distutils import dir_util' | |||
|
42 | 42 | import py2exe |
|
43 | 43 | |
|
44 | 44 | # update the manuals when building a source dist |
|
45 |
# |
|
|
45 | # release.py contains version, authors, license, url, keywords, etc. | |
|
46 | 46 | execfile(pjoin('IPython','core','release.py')) |
|
47 | 47 | |
|
48 | 48 | # A little utility we'll need below, since glob() does NOT allow you to do |
@@ -1,20 +1,19 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 |
""" |
|
|
3 | """ | |
|
2 | """Script to check that all code in a directory compiles correctly. | |
|
4 | 3 |
|
|
5 | import os | |
|
6 | import sys | |
|
4 | Usage: | |
|
7 | 5 |
|
|
6 | compile.py | |
|
8 | 7 |
|
|
9 | vstr = '.'.join(map(str,sys.version_info[:2])) | |
|
8 | This script verifies that all Python files in the directory where run, and all | |
|
9 | of its subdirectories, compile correctly. | |
|
10 | 10 |
|
|
11 | stat = os.system('python %s/lib/python%s/compileall.py .' % (sys.prefix,vstr)) | |
|
11 | Before a release, call this script from the top-level directory. | |
|
12 | """ | |
|
13 | ||
|
14 | import sys | |
|
12 | 15 | |
|
13 | ||
|
14 | if stat: | |
|
15 | print '*** THERE WAS AN ERROR! ***' | |
|
16 | print 'See messages above for the actual file that produced it.' | |
|
17 | else: | |
|
18 | print 'OK' | |
|
16 | from toollib import compile_tree | |
|
19 | 17 | |
|
20 | sys.exit(stat) | |
|
18 | if __name__ == '__main__': | |
|
19 | compile_tree() |
@@ -2,35 +2,22 b'' | |||
|
2 | 2 | """Simple script to create a tarball with proper bzr version info. |
|
3 | 3 | """ |
|
4 | 4 | |
|
5 |
import os |
|
|
5 | import os | |
|
6 | import sys | |
|
7 | import shutil | |
|
6 | 8 | |
|
7 | basever = '0.9.0' | |
|
9 | from toollib import * | |
|
8 | 10 | |
|
9 | def oscmd(c): | |
|
10 | print ">",c | |
|
11 | s = os.system(c) | |
|
12 | if s: | |
|
13 | print "Error",s | |
|
14 | sys.exit(s) | |
|
11 | c('python update_revnum.py') | |
|
15 | 12 | |
|
16 | def verinfo(): | |
|
13 | execfile('../IPython/core/release.py') # defines version_base | |
|
17 | 14 | |
|
18 | out = os.popen('bzr version-info') | |
|
19 | pairs = (l.split(':',1) for l in out) | |
|
20 | d = dict(((k,v.strip()) for (k,v) in pairs)) | |
|
21 | return d | |
|
22 | ||
|
23 | basename = 'ipython' | |
|
24 | ||
|
25 | #tarname = '%s.r%s.tgz' % (basename, ver) | |
|
26 | oscmd('python update_revnum.py') | |
|
27 | ||
|
28 | ver = verinfo() | |
|
15 | ver = version_info() | |
|
29 | 16 | |
|
30 | 17 | if ver['branch-nick'] == 'ipython': |
|
31 |
tarname = 'ipython-%s.bzr.r%s.tgz' % (base |
|
|
18 | tarname = 'ipython-%s.bzr.r%s.tgz' % (version_base, ver['revno']) | |
|
32 | 19 | else: |
|
33 |
tarname = 'ipython-%s.bzr.r%s.%s.tgz' % (base |
|
|
20 | tarname = 'ipython-%s.bzr.r%s.%s.tgz' % (version_base, ver['revno'], | |
|
34 | 21 | ver['branch-nick']) |
|
35 | 22 | |
|
36 |
|
|
|
23 | c('bzr export ' + tarname) |
@@ -1,48 +1,42 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | """IPython release script | |
|
3 | ||
|
4 | Create ipykit and exe installer | |
|
5 | ||
|
6 | requires py2exe | |
|
2 | """IPython release build script. | |
|
7 | 3 | """ |
|
4 | from toollib import * | |
|
8 | 5 | |
|
9 | import os | |
|
10 | import distutils.dir_util | |
|
11 | import sys | |
|
12 | ||
|
13 | execfile('../IPython/Release.py') | |
|
14 | ||
|
15 | def c(cmd): | |
|
16 | print ">",cmd | |
|
17 | os.system(cmd) | |
|
6 | # Get main ipython dir, this will raise if it doesn't pass some checks | |
|
7 | ipdir = get_ipdir() | |
|
8 | cd(ipdir) | |
|
18 | 9 | |
|
19 | ipykit_name = "ipykit-%s" % version | |
|
10 | # Load release info | |
|
11 | execfile(pjoin('IPython','core','release.py')) | |
|
20 | 12 | |
|
21 | os.chdir('..') | |
|
22 | if os.path.isdir('dist'): | |
|
23 | distutils.dir_util.remove_tree('dist') | |
|
24 | if os.path.isdir(ipykit_name): | |
|
25 | distutils.dir_util.remove_tree(ipykit_name) | |
|
13 | # Check that everything compiles | |
|
14 | compile_tree() | |
|
26 | 15 | |
|
27 | if sys.platform == 'win32': | |
|
28 | c("python exesetup.py py2exe") | |
|
29 | ||
|
30 | os.rename('dist',ipykit_name) | |
|
31 | ||
|
32 | c("zip -r %s.zip %s" % (ipykit_name, ipykit_name)) | |
|
16 | # Cleanup | |
|
17 | for d in ['build','dist',pjoin('docs','build'),pjoin('docs','dist')]: | |
|
18 | if os.path.isdir(d): | |
|
19 | remove_tree(d) | |
|
33 | 20 | |
|
34 | 21 | # Build source and binary distros |
|
35 | 22 | c('./setup.py sdist --formats=gztar') |
|
36 | 23 | |
|
37 | c("python2.4 ./setup.py bdist_rpm --binary-only --release=py24 --python=/usr/bin/python2.4") | |
|
38 | c("python2.5 ./setup.py bdist_rpm --binary-only --release=py25 --python=/usr/bin/python2.5") | |
|
24 | # Build version-specific RPMs, where we must use the --python option to ensure | |
|
25 | # that the resulting RPM is really built with the requested python version (so | |
|
26 | # things go to lib/python2.X/...) | |
|
27 | c("python2.5 ./setup.py bdist_rpm --binary-only --release=py25 " | |
|
28 | "--python=/usr/bin/python2.5") | |
|
29 | c("python2.6 ./setup.py bdist_rpm --binary-only --release=py26 " | |
|
30 | "--python=/usr/bin/python2.6") | |
|
39 | 31 | |
|
40 | 32 | # Build eggs |
|
41 | c('python2.4 ./eggsetup.py bdist_egg') | |
|
42 | 33 | c('python2.5 ./eggsetup.py bdist_egg') |
|
34 | c('python2.6 ./eggsetup.py bdist_egg') | |
|
43 | 35 | |
|
36 | # Call the windows build separately, so that the extra Windows scripts don't | |
|
37 | # get pulled into Unix builds (setup.py has code which checks for | |
|
38 | # bdist_wininst) | |
|
44 | 39 | c("python setup.py bdist_wininst --install-script=ipython_win_post_install.py") |
|
45 | 40 | |
|
46 | os.chdir('tools') | |
|
47 | c('python make_tarball.py') | |
|
48 | ||
|
41 | # Change name so retarded Vista runs the installer correctly | |
|
42 | c("rename 's/win32/win32-setup/' dist/*.exe") |
@@ -1,35 +1,43 b'' | |||
|
1 | #!/bin/bash | |
|
2 |
|
|
|
1 | #!/usr/bin/env python | |
|
2 | """IPython release script. | |
|
3 | 3 | |
|
4 | PYVER=`python -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $1$2}' ` | |
|
5 | version=`ipython -Version` | |
|
6 | ipdir=~/ipython/ipython | |
|
7 | ipbackupdir=~/ipython/backup | |
|
4 | This should only be run at real release time. | |
|
5 | """ | |
|
8 | 6 | |
|
9 | echo | |
|
10 | echo "Releasing IPython version $version" | |
|
11 | echo "==================================" | |
|
7 | from toollib import * | |
|
8 | ||
|
9 | # Get main ipython dir, this will raise if it doesn't pass some checks | |
|
10 | ipdir = get_ipdir() | |
|
11 | cd(ipdir) | |
|
12 | ||
|
13 | # Load release info | |
|
14 | execfile(pjoin('IPython','core','release.py')) | |
|
15 | ||
|
16 | # Where I keep static backups of each release | |
|
17 | ipbackupdir = os.path.expanduser('~/ipython/backup') | |
|
18 | ||
|
19 | ||
|
20 | print "Releasing IPython version $version" | |
|
21 | print "==================================" | |
|
12 | 22 | |
|
13 | 23 | # Perform local backup |
|
14 | cd $ipdir/tools | |
|
15 | ./make_tarball.py | |
|
16 | mv ipython-*.tgz $ipbackupdir | |
|
24 | c('./make_tarball.py') | |
|
25 | c('mv ipython-*.tgz %s' % ipbackupdir) | |
|
17 | 26 | |
|
18 | 27 | # Build release files |
|
19 | ./testrel $ipdir | |
|
28 | c('./mkrel.py %s' % ipdir) | |
|
20 | 29 | |
|
21 | 30 | # Register with the Python Package Index (PyPI) |
|
22 |
|
|
|
23 | cd $ipdir | |
|
24 | ./setup.py register | |
|
31 | print "Registering with PyPI..." | |
|
32 | c('./setup.py register') | |
|
25 | 33 | |
|
26 | 34 | # Upload all files |
|
27 | cd $ipdir/dist | |
|
28 |
|
|
|
29 | scp * ipython@ipython.scipy.org:www/dist/ | |
|
35 | cd('dist') | |
|
36 | print "Uploading distribution files..." | |
|
37 | c('scp * ipython@ipython.scipy.org:www/dist/') | |
|
30 | 38 | |
|
31 |
|
|
|
32 |
cd |
|
|
33 | scp `ls -1tr *tgz | tail -1` ipython@ipython.scipy.org:www/backup/ | |
|
39 | print "Uploading backup files..." | |
|
40 | cd(ipbackupdir) | |
|
41 | c('scp `ls -1tr *tgz | tail -1` ipython@ipython.scipy.org:www/backup/') | |
|
34 | 42 | |
|
35 |
|
|
|
43 | print "Done!" |
@@ -1,3 +1,9 b'' | |||
|
1 | """XXX - What exactly is the use of this script? | |
|
2 | ||
|
3 | I (fperez) tried it quickly and it doesn't work in its current form. Either it | |
|
4 | needs to be fixed and documented or removed. | |
|
5 | """ | |
|
6 | ||
|
1 | 7 | import cProfile as profile |
|
2 | 8 | import sys |
|
3 | 9 | #import profile |
@@ -1,5 +1,5 b'' | |||
|
1 | 1 | #!/bin/sh |
|
2 | ||
|
2 | # Simple upload script to push up into the testing directory a local build | |
|
3 | 3 | ipdir=$PWD/.. |
|
4 | 4 | |
|
5 | 5 | cd $ipdir/dist |
@@ -1,23 +1,32 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 |
""" |
|
|
2 | """Change the revision number in release.py | |
|
3 | 3 |
|
|
4 | import os | |
|
5 | import re,pprint | |
|
4 | This edits in-place release.py to update the revision number from bzr info. | |
|
5 | ||
|
6 | Usage: | |
|
6 | 7 |
|
|
7 | def verinfo(): | |
|
8 | ./update_revnum.py""" | |
|
9 | ||
|
10 | import os | |
|
11 | import pprint | |
|
12 | import re | |
|
8 | 13 | |
|
9 | out = os.popen('bzr version-info') | |
|
10 | pairs = (l.split(':',1) for l in out) | |
|
11 | d = dict(((k,v.strip()) for (k,v) in pairs)) | |
|
12 | return d | |
|
14 | from toollib import * | |
|
13 | 15 | |
|
14 | ver = verinfo() | |
|
16 | if __name__ == '__main__': | |
|
17 | ver = version_info() | |
|
15 | 18 | |
|
16 | 19 | pprint.pprint(ver) |
|
17 | 20 | |
|
18 | 21 | rfile = open('../IPython/core/release.py','rb').read() |
|
19 |
newcont = re.sub(r'revision\s*=.*', |
|
|
22 | newcont = re.sub(r'revision\s*=.*', | |
|
23 | "revision = '%s'" % ver['revno'], | |
|
24 | rfile) | |
|
20 | 25 | |
|
21 | newcont = re.sub(r'^branch\s*=[^=].*', "branch = '%s'" % ver['branch-nick'], newcont ) | |
|
26 | newcont = re.sub(r'^branch\s*=[^=].*', | |
|
27 | "branch = '%s'" % ver['branch-nick'], | |
|
28 | newcont) | |
|
22 | 29 | |
|
23 |
open('../IPython/core/release.py','wb') |
|
|
30 | f = open('../IPython/core/release.py','wb') | |
|
31 | f.write(newcont) | |
|
32 | f.close() |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now