##// END OF EJS Templates
Merge pull request #10831 from Carreau/protect-upload...
Thomas Kluyver -
r24023:36b8f2ac merge
parent child Browse files
Show More
@@ -1,94 +1,96
1 1 #!/usr/bin/env python
2 2 """IPython release script.
3 3
4 4 This should ONLY be run at real release time.
5 5 """
6 6 from __future__ import print_function
7 7
8 8 import os
9 from glob import glob
9 10 from subprocess import call
10 11 import sys
11 12
12 13 from toollib import (get_ipdir, pjoin, cd, execfile, sh, archive,
13 14 sdists, archive_user, archive_dir, buildwheels)
14 15 from gh_api import post_download
15 16
16 17 # Get main ipython dir, this will raise if it doesn't pass some checks
17 18 ipdir = get_ipdir()
18 19 tooldir = pjoin(ipdir, 'tools')
19 20 distdir = pjoin(ipdir, 'dist')
20 21
21 22 # Where I keep static backups of each release
22 23 ipbackupdir = os.path.expanduser('~/ipython/backup')
23 24 if not os.path.exists(ipbackupdir):
24 25 os.makedirs(ipbackupdir)
25 26
26 27 # Start in main IPython dir
27 28 cd(ipdir)
28 29
29 30 # Load release info
30 31 version = None
31 32 execfile(pjoin('IPython','core','release.py'), globals())
32 33
33 34 # Build site addresses for file uploads
34 35 release_site = '%s/release/%s' % (archive, version)
35 36 backup_site = '%s/backup/' % archive
36 37
37 38 # Start actual release process
38 39 print()
39 40 print('Releasing IPython')
40 41 print('=================')
41 42 print()
42 43 print('Version:', version)
43 44 print()
44 45 print('Source IPython directory:', ipdir)
45 46 print()
46 47
47 48 # Perform local backup, go to tools dir to run it.
48 49 cd(tooldir)
49 50
50 51 if 'upload' in sys.argv:
51 52 cd(distdir)
52 #print( 'Uploading distribution files to GitHub...')
53 53
54 for fname in os.listdir('.'):
54 # do not upload OS specific files like .DS_Store
55 to_upload = glob('*.whl')+glob('*.tar.gz')
56 for fname in to_upload:
55 57 # TODO: update to GitHub releases API
56 58 continue
57 59 print('uploading %s to GitHub' % fname)
58 60 desc = "IPython %s source distribution" % version
59 61 post_download("ipython/ipython", fname, description=desc)
60 62
61 63 # Make target dir if it doesn't exist
62 64 print('1. Uploading IPython to archive.ipython.org')
63 65 sh('ssh %s "mkdir -p %s/release/%s" ' % (archive_user, archive_dir, version))
64 sh('scp * %s' % release_site)
66 sh('scp *.tar.gz *.whl %s' % release_site)
65 67
66 68 print('2. Uploading backup files...')
67 69 cd(ipbackupdir)
68 70 sh('scp `ls -1tr *tgz | tail -1` %s' % backup_site)
69 71
70 72 print('3. Uploading to PyPI using twine')
71 73 cd(distdir)
72 call(['twine', 'upload'] + os.listdir('.'))
74 call(['twine', 'upload'] + to_upload)
73 75
74 76 else:
75 77 # Build, but don't upload
76 78
77 79 # Make backup tarball
78 80 sh('./make_tarball.py')
79 81 sh('mv ipython-*.tgz %s' % ipbackupdir)
80 82
81 83 # Build release files
82 84 sh('./build_release %s' % ipdir)
83 85
84 86 cd(ipdir)
85 87
86 88 # Upload all files
87 89 sh(sdists)
88 90
89 91 buildwheels()
90 92 print("`./release upload` to upload source distribution on PyPI and ipython archive")
91 93 sys.exit(0)
92 94
93 95
94 96
General Comments 0
You need to be logged in to leave comments. Login now