##// END OF EJS Templates
Do not upload to archive.ipython.org anymore...
M Bussonnier -
Show More
@@ -1,86 +1,10 b''
1 #!/usr/bin/env python3
1 #!/usr/bin/env python3
2 """IPython release script.
2 """IPython release script.
3
3
4 This should ONLY be run at real release time.
4 Deprecated
5 """
6 from __future__ import print_function
7
8 import os
9 from glob import glob
10 from pathlib import Path
11 from subprocess import call
12 import sys
13
14 from toollib import (get_ipdir, cd, execfile, sh, archive,
15 archive_user, archive_dir)
16
17 # Get main ipython dir, this will raise if it doesn't pass some checks
18 ipdir = get_ipdir()
19 tooldir = ipdir / 'tools'
20 distdir = ipdir / 'dist'
21
22 # Where I keep static backups of each release
23 ipbackupdir = Path('~/ipython/backup').expanduser()
24 if not ipbackupdir.exists():
25 ipbackupdir.mkdir(parents=True, exist_ok=True)
26
27 # Start in main IPython dir
28 cd(ipdir)
29
30 # Load release info
31 version = None
32 execfile(Path('IPython','core','release.py'), globals())
33
34 # Build site addresses for file uploads
35 release_site = '%s/release/%s' % (archive, version)
36 backup_site = '%s/backup/' % archive
37
38 # Start actual release process
39 print()
40 print('Releasing IPython')
41 print('=================')
42 print()
43 print('Version:', version)
44 print()
45 print('Source IPython directory:', ipdir)
46 print()
47
48 # Perform local backup, go to tools dir to run it.
49 cd(tooldir)
50
5
51 if 'upload' in sys.argv:
6 """
52 cd(distdir)
7 sys.exit("deprecated")
53
54 # do not upload OS specific files like .DS_Store
55 to_upload = glob('*.whl')+glob('*.tar.gz')
56
57 # Make target dir if it doesn't exist
58 print('1. Uploading IPython to archive.ipython.org')
59 sh('ssh %s "mkdir -p %s/release/%s" ' % (archive_user, archive_dir, version))
60 sh('scp *.tar.gz *.whl %s' % release_site)
61
62 print('2. Uploading backup files...')
63 cd(ipbackupdir)
64 sh('scp `ls -1tr *tgz | tail -1` %s' % backup_site)
65
66 print('3. Uploading to PyPI using twine')
67 cd(distdir)
68 call(['twine', 'upload', '--verbose'] + to_upload)
69
70 else:
71 # Build, but don't upload
72
73 # Make backup tarball
74 sh('python make_tarball.py')
75 sh('mv ipython-*.tgz %s' % ipbackupdir)
76
77 # Build release files
78 sh('./build_release')
79
80 cd(ipdir)
81
82 print("`./release upload` to upload source distribution on PyPI and ipython archive")
83 sys.exit(0)
84
8
85
9
86
10
@@ -1,259 +1,259 b''
1 # Simple tool to help for release
1 # Simple tool to help for release
2 # when releasing with bash, simple source it to get asked questions.
2 # when releasing with bash, simple source it to get asked questions.
3
3
4 # misc check before starting
4 # misc check before starting
5 BLACK=$(tput setaf 1)
5 BLACK=$(tput setaf 1)
6 RED=$(tput setaf 1)
6 RED=$(tput setaf 1)
7 GREEN=$(tput setaf 2)
7 GREEN=$(tput setaf 2)
8 YELLOW=$(tput setaf 3)
8 YELLOW=$(tput setaf 3)
9 BLUE=$(tput setaf 4)
9 BLUE=$(tput setaf 4)
10 MAGENTA=$(tput setaf 5)
10 MAGENTA=$(tput setaf 5)
11 CYAN=$(tput setaf 6)
11 CYAN=$(tput setaf 6)
12 WHITE=$(tput setaf 7)
12 WHITE=$(tput setaf 7)
13 NOR=$(tput sgr0)
13 NOR=$(tput sgr0)
14
14
15
15
16 echo "Checking all tools are installed..."
16 echo "Checking all tools are installed..."
17
17
18 python -c 'import keyring'
18 python -c 'import keyring'
19 python -c 'import twine'
19 python -c 'import twine'
20 python -c 'import sphinx'
20 python -c 'import sphinx'
21 python -c 'import sphinx_rtd_theme'
21 python -c 'import sphinx_rtd_theme'
22 python -c 'import pytest'
22 python -c 'import pytest'
23 python -c 'import build'
23 python -c 'import build'
24 # those are necessary fo building the docs
24 # those are necessary fo building the docs
25 echo "Checking imports for docs"
25 echo "Checking imports for docs"
26 python -c 'import numpy'
26 python -c 'import numpy'
27 python -c 'import matplotlib'
27 python -c 'import matplotlib'
28
28
29
29
30
30
31
31
32 echo "Will use $BLUE'$EDITOR'$NOR to edit files when necessary"
32 echo "Will use $BLUE'$EDITOR'$NOR to edit files when necessary"
33 echo -n "PREV_RELEASE (X.y.z) [$PREV_RELEASE]: "
33 echo -n "PREV_RELEASE (X.y.z) [$PREV_RELEASE]: "
34 read input
34 read input
35 PREV_RELEASE=${input:-$PREV_RELEASE}
35 PREV_RELEASE=${input:-$PREV_RELEASE}
36 echo -n "MILESTONE (X.y) [$MILESTONE]: "
36 echo -n "MILESTONE (X.y) [$MILESTONE]: "
37 read input
37 read input
38 MILESTONE=${input:-$MILESTONE}
38 MILESTONE=${input:-$MILESTONE}
39 echo -n "VERSION (X.y.z) [$VERSION]:"
39 echo -n "VERSION (X.y.z) [$VERSION]:"
40 read input
40 read input
41 VERSION=${input:-$VERSION}
41 VERSION=${input:-$VERSION}
42 echo -n "BRANCH (main|X.y) [$BRANCH]:"
42 echo -n "BRANCH (main|X.y) [$BRANCH]:"
43 read input
43 read input
44 BRANCH=${input:-$BRANCH}
44 BRANCH=${input:-$BRANCH}
45
45
46 ask_section(){
46 ask_section(){
47 echo
47 echo
48 echo $BLUE"$1"$NOR
48 echo $BLUE"$1"$NOR
49 echo -n $GREEN"Press Enter to continue, S to skip: "$NOR
49 echo -n $GREEN"Press Enter to continue, S to skip: "$NOR
50 if [ "$ZSH_NAME" = "zsh" ] ; then
50 if [ "$ZSH_NAME" = "zsh" ] ; then
51 read -k1 value
51 read -k1 value
52 value=${value%$'\n'}
52 value=${value%$'\n'}
53 else
53 else
54 read -n1 value
54 read -n1 value
55 fi
55 fi
56 if [ -z "$value" ] || [ $value = 'y' ]; then
56 if [ -z "$value" ] || [ $value = 'y' ]; then
57 return 0
57 return 0
58 fi
58 fi
59 return 1
59 return 1
60 }
60 }
61
61
62
62
63 maybe_edit(){
63 maybe_edit(){
64 echo
64 echo
65 echo $BLUE"$1"$NOR
65 echo $BLUE"$1"$NOR
66 echo -n $GREEN"Press ${BLUE}e$GREEN to Edit ${BLUE}$1$GREEN, any other keys to skip: "$NOR
66 echo -n $GREEN"Press ${BLUE}e$GREEN to Edit ${BLUE}$1$GREEN, any other keys to skip: "$NOR
67 if [ "$ZSH_NAME" = "zsh" ] ; then
67 if [ "$ZSH_NAME" = "zsh" ] ; then
68 read -k1 value
68 read -k1 value
69 value=${value%$'\n'}
69 value=${value%$'\n'}
70 else
70 else
71 read -n1 value
71 read -n1 value
72 fi
72 fi
73
73
74 echo
74 echo
75 if [ $value = 'e' ] ; then
75 if [ $value = 'e' ] ; then
76 $=EDITOR $1
76 $=EDITOR $1
77 fi
77 fi
78 }
78 }
79
79
80
80
81
81
82 echo
82 echo
83 if ask_section "Updating what's new with information from docs/source/whatsnew/pr"
83 if ask_section "Updating what's new with information from docs/source/whatsnew/pr"
84 then
84 then
85 python tools/update_whatsnew.py
85 python tools/update_whatsnew.py
86
86
87 echo
87 echo
88 echo $BLUE"please move the contents of "docs/source/whatsnew/development.rst" to version-X.rst"$NOR
88 echo $BLUE"please move the contents of "docs/source/whatsnew/development.rst" to version-X.rst"$NOR
89 echo $GREEN"Press enter to continue"$NOR
89 echo $GREEN"Press enter to continue"$NOR
90 read
90 read
91 fi
91 fi
92
92
93 if ask_section "Gen Stats, and authors"
93 if ask_section "Gen Stats, and authors"
94 then
94 then
95
95
96 echo
96 echo
97 echo $BLUE"here are all the authors that contributed to this release:"$NOR
97 echo $BLUE"here are all the authors that contributed to this release:"$NOR
98 git log --format="%aN <%aE>" $PREV_RELEASE... | sort -u -f
98 git log --format="%aN <%aE>" $PREV_RELEASE... | sort -u -f
99
99
100 echo
100 echo
101 echo $BLUE"If you see any duplicates cancel (Ctrl-C), then edit .mailmap."
101 echo $BLUE"If you see any duplicates cancel (Ctrl-C), then edit .mailmap."
102 echo $GREEN"Press enter to continue:"$NOR
102 echo $GREEN"Press enter to continue:"$NOR
103 read
103 read
104
104
105 echo $BLUE"generating stats"$NOR
105 echo $BLUE"generating stats"$NOR
106 python tools/github_stats.py --milestone $MILESTONE > stats.rst
106 python tools/github_stats.py --milestone $MILESTONE > stats.rst
107
107
108 echo $BLUE"stats.rst files generated."$NOR
108 echo $BLUE"stats.rst files generated."$NOR
109 echo $GREEN"Please merge it with the right file (github-stats-X.rst) and commit."$NOR
109 echo $GREEN"Please merge it with the right file (github-stats-X.rst) and commit."$NOR
110 echo $GREEN"press enter to continue."$NOR
110 echo $GREEN"press enter to continue."$NOR
111 read
111 read
112
112
113 fi
113 fi
114
114
115 if ask_section "Generate API difference (using frapuccino)"
115 if ask_section "Generate API difference (using frapuccino)"
116 then
116 then
117 echo $BLUE"Checking out $PREV_RELEASE"$NOR
117 echo $BLUE"Checking out $PREV_RELEASE"$NOR
118 git checkout tags/$PREV_RELEASE
118 git checkout tags/$PREV_RELEASE
119 sleep 1
119 sleep 1
120 echo $BLUE"Saving API to file $PREV_RELEASE"$NOR
120 echo $BLUE"Saving API to file $PREV_RELEASE"$NOR
121 frappuccino IPython IPython.kernel IPython.lib IPython.qt IPython.lib.kernel IPython.html IPython.frontend IPython.external --save IPython-$PREV_RELEASE.json
121 frappuccino IPython IPython.kernel IPython.lib IPython.qt IPython.lib.kernel IPython.html IPython.frontend IPython.external --save IPython-$PREV_RELEASE.json
122 echo $BLUE"coming back to $BRANCH"$NOR
122 echo $BLUE"coming back to $BRANCH"$NOR
123 git switch $BRANCH
123 git switch $BRANCH
124 sleep 1
124 sleep 1
125 echo $BLUE"comparing ..."$NOR
125 echo $BLUE"comparing ..."$NOR
126 frappuccino IPython IPython.kernel IPython.lib --compare IPython-$PREV_RELEASE.json
126 frappuccino IPython IPython.kernel IPython.lib --compare IPython-$PREV_RELEASE.json
127 echo $GREEN"Use the above guideline to write an API changelog ..."$NOR
127 echo $GREEN"Use the above guideline to write an API changelog ..."$NOR
128 echo $GREEN"Press any keys to continue"$NOR
128 echo $GREEN"Press any keys to continue"$NOR
129 read
129 read
130 fi
130 fi
131
131
132 echo "Cleaning repository"
132 echo "Cleaning repository"
133 git clean -xfdi
133 git clean -xfdi
134
134
135 echo $GREEN"please update version number in ${RED}IPython/core/release.py${NOR} , Do not commit yet – we'll do it later."$NOR
135 echo $GREEN"please update version number in ${RED}IPython/core/release.py${NOR} , Do not commit yet – we'll do it later."$NOR
136 echo $GREEN"I tried ${RED}sed -i bkp -e '/Uncomment/s/^# //g' IPython/core/release.py${NOR}"
136 echo $GREEN"I tried ${RED}sed -i bkp -e '/Uncomment/s/^# //g' IPython/core/release.py${NOR}"
137 sed -i bkp -e '/Uncomment/s/^# //g' IPython/core/release.py
137 sed -i bkp -e '/Uncomment/s/^# //g' IPython/core/release.py
138 rm IPython/core/release.pybkp
138 rm IPython/core/release.pybkp
139 git diff | cat
139 git diff | cat
140 maybe_edit IPython/core/release.py
140 maybe_edit IPython/core/release.py
141
141
142 echo $GREEN"Press enter to continue"$NOR
142 echo $GREEN"Press enter to continue"$NOR
143 read
143 read
144
144
145 if ask_section "Build the documentation ?"
145 if ask_section "Build the documentation ?"
146 then
146 then
147 make html -C docs
147 make html -C docs
148 echo
148 echo
149 echo $GREEN"Check the docs, press enter to continue"$NOR
149 echo $GREEN"Check the docs, press enter to continue"$NOR
150 read
150 read
151
151
152 fi
152 fi
153
153
154 if ask_section "Should we commit, tag, push... etc ? "
154 if ask_section "Should we commit, tag, push... etc ? "
155 then
155 then
156 echo
156 echo
157 echo $BLUE"Let's commit : git commit -am \"release $VERSION\" -S"
157 echo $BLUE"Let's commit : git commit -am \"release $VERSION\" -S"
158 echo $GREEN"Press enter to commit"$NOR
158 echo $GREEN"Press enter to commit"$NOR
159 read
159 read
160 git commit -am "release $VERSION" -S
160 git commit -am "release $VERSION" -S
161
161
162 echo
162 echo
163 echo $BLUE"git push origin \$BRANCH ($BRANCH)?"$NOR
163 echo $BLUE"git push origin \$BRANCH ($BRANCH)?"$NOR
164 echo $GREEN"Make sure you can push"$NOR
164 echo $GREEN"Make sure you can push"$NOR
165 echo $GREEN"Press enter to continue"$NOR
165 echo $GREEN"Press enter to continue"$NOR
166 read
166 read
167 git push origin $BRANCH
167 git push origin $BRANCH
168
168
169 echo
169 echo
170 echo "Let's tag : git tag -am \"release $VERSION\" \"$VERSION\" -s"
170 echo "Let's tag : git tag -am \"release $VERSION\" \"$VERSION\" -s"
171 echo $GREEN"Press enter to tag commit"$NOR
171 echo $GREEN"Press enter to tag commit"$NOR
172 read
172 read
173 git tag -am "release $VERSION" "$VERSION" -s
173 git tag -am "release $VERSION" "$VERSION" -s
174
174
175 echo
175 echo
176 echo $BLUE"And push the tag: git push origin \$VERSION ?"$NOR
176 echo $BLUE"And push the tag: git push origin \$VERSION ?"$NOR
177 echo $GREEN"Press enter to continue"$NOR
177 echo $GREEN"Press enter to continue"$NOR
178 read
178 read
179 git push origin $VERSION
179 git push origin $VERSION
180
180
181
181
182 echo $GREEN"please update version number and back to .dev in ${RED}IPython/core/release.py"
182 echo $GREEN"please update version number and back to .dev in ${RED}IPython/core/release.py"
183 echo $GREEN"I tried ${RED}sed -i bkp -e '/Uncomment/s/^/# /g' IPython/core/release.py${NOR}"
183 echo $GREEN"I tried ${RED}sed -i bkp -e '/Uncomment/s/^/# /g' IPython/core/release.py${NOR}"
184 sed -i bkp -e '/Uncomment/s/^/# /g' IPython/core/release.py
184 sed -i bkp -e '/Uncomment/s/^/# /g' IPython/core/release.py
185 rm IPython/core/release.pybkp
185 rm IPython/core/release.pybkp
186 git diff | cat
186 git diff | cat
187 echo $GREEN"Please bump ${RED}the minor version number${NOR}"
187 echo $GREEN"Please bump ${RED}the minor version number${NOR}"
188 maybe_edit IPython/core/release.py
188 maybe_edit IPython/core/release.py
189 echo ${BLUE}"Do not commit yet – we'll do it later."$NOR
189 echo ${BLUE}"Do not commit yet – we'll do it later."$NOR
190
190
191
191
192 echo $GREEN"Press enter to continue"$NOR
192 echo $GREEN"Press enter to continue"$NOR
193 read
193 read
194
194
195 echo
195 echo
196 echo "Let's commit : "$BLUE"git commit -am \"back to dev\""$NOR
196 echo "Let's commit : "$BLUE"git commit -am \"back to dev\""$NOR
197 echo $GREEN"Press enter to commit"$NOR
197 echo $GREEN"Press enter to commit"$NOR
198 read
198 read
199 git commit -am "back to dev"
199 git commit -am "back to dev"
200
200
201 echo
201 echo
202 echo $BLUE"git push origin \$BRANCH ($BRANCH)?"$NOR
202 echo $BLUE"git push origin \$BRANCH ($BRANCH)?"$NOR
203 echo $GREEN"Press enter to continue"$NOR
203 echo $GREEN"Press enter to continue"$NOR
204 read
204 read
205 git push origin $BRANCH
205 git push origin $BRANCH
206
206
207
207
208 echo
208 echo
209 echo $BLUE"let's : git checkout tags/$VERSION"$NOR
209 echo $BLUE"let's : git checkout tags/$VERSION"$NOR
210 echo $GREEN"Press enter to continue"$NOR
210 echo $GREEN"Press enter to continue"$NOR
211 read
211 read
212 git checkout tags/$VERSION
212 git checkout tags/$VERSION
213 fi
213 fi
214
214
215 if ask_section "Should we build and release ?"
215 if ask_section "Should we build and release ?"
216 then
216 then
217
217
218 echo $BLUE"going to set SOURCE_DATE_EPOCH"$NOR
218 echo $BLUE"going to set SOURCE_DATE_EPOCH"$NOR
219 echo $BLUE'export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)'$NOR
219 echo $BLUE'export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)'$NOR
220 echo $GREEN"Press enter to continue"$NOR
220 echo $GREEN"Press enter to continue"$NOR
221 read
221 read
222
222
223 export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)
223 export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)
224
224
225 echo $BLUE"SOURCE_DATE_EPOCH set to $SOURCE_DATE_EPOCH"$NOR
225 echo $BLUE"SOURCE_DATE_EPOCH set to $SOURCE_DATE_EPOCH"$NOR
226 echo $GREEN"Press enter to continue"$NOR
226 echo $GREEN"Press enter to continue"$NOR
227 read
227 read
228
228
229
229
230
230
231 echo
231 echo
232 echo $BLUE"Attempting to build package..."$NOR
232 echo $BLUE"Attempting to build package..."$NOR
233
233
234 tools/release
234 tools/build_release
235
235
236
236
237 echo $RED'$ shasum -a 256 dist/*'
237 echo $RED'$ shasum -a 256 dist/*'
238 shasum -a 256 dist/*
238 shasum -a 256 dist/*
239 echo $NOR
239 echo $NOR
240
240
241 echo $BLUE"We are going to rebuild, node the hash above, and compare them to the rebuild"$NOR
241 echo $BLUE"We are going to rebuild, node the hash above, and compare them to the rebuild"$NOR
242 echo $GREEN"Press enter to continue"$NOR
242 echo $GREEN"Press enter to continue"$NOR
243 read
243 read
244
244
245 echo
245 echo
246 echo $BLUE"Attempting to build package..."$NOR
246 echo $BLUE"Attempting to build package..."$NOR
247
247
248 tools/release
248 tools/build_release
249
249
250 echo $RED"Check the shasum for SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH"
250 echo $RED"Check the shasum for SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH"
251 echo $RED'$ shasum -a 256 dist/*'
251 echo $RED'$ shasum -a 256 dist/*'
252 shasum -a 256 dist/*
252 shasum -a 256 dist/*
253 echo $NOR
253 echo $NOR
254
254
255 if ask_section "upload packages ?"
255 if ask_section "upload packages ?"
256 then
256 then
257 tools/release upload
257 twine upload --verbose dist/*.tar.gz dist/*.whl
258 fi
258 fi
259 fi
259 fi
General Comments 0
You need to be logged in to leave comments. Login now