##// END OF EJS Templates
Backport PR #2067: update tools/release_windows.py...
MinRK -
Show More
@@ -52,6 +52,7 b' from glob import glob'
52 52 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
53 53
54 54 from distutils.core import setup
55 from distutils.command.upload import upload
55 56
56 57 # On Python 3, we need distribute (new setuptools) to do the 2to3 conversion
57 58 if PY3:
@@ -171,6 +172,31 b" setup_args['package_data'] = package_data"
171 172 setup_args['data_files'] = data_files
172 173
173 174 #---------------------------------------------------------------------------
175 # custom upload_wininst command
176 #---------------------------------------------------------------------------
177
178 class UploadWindowsInstallers(upload):
179
180 description = "Upload Windows installers to PyPI (only used from tools/release_windows.py)"
181 user_options = upload.user_options + [
182 ('files=', 'f', 'exe file (or glob) to upload')
183 ]
184 def initialize_options(self):
185 upload.initialize_options(self)
186 meta = self.distribution.metadata
187 base = '{name}-{version}'.format(
188 name=meta.get_name(),
189 version=meta.get_version()
190 )
191 self.files = os.path.join('dist', '%s.*.exe' % base)
192
193 def run(self):
194 for dist_file in glob(self.files):
195 self.upload_file('bdist_wininst', 'any', dist_file)
196
197 setup_args['cmdclass']['upload_wininst'] = UploadWindowsInstallers
198
199 #---------------------------------------------------------------------------
174 200 # Handle scripts, dependencies, and setuptools specific things
175 201 #---------------------------------------------------------------------------
176 202
@@ -23,10 +23,10 b' except ImportError:'
23 23
24 24 github = '--github' in sys.argv
25 25
26 cmd_t = "{py} setup.py bdist_wininst --plat-name=py{v}-{plat}"
26 cmd_t = "{py} setup.py bdist_wininst --plat-name={plat}"
27 27
28 if '--pypi' in sys.argv:
29 cmd_t += ' --upload'
28 pypi = '--pypi' in sys.argv
29 pypi_cmd_t = "python setup.py upload_wininst -f {fname}"
30 30
31 31 for py in ['python', 'python3']:
32 32 # deliberately mangle the name,
@@ -36,11 +36,17 b" for py in ['python', 'python3']:"
36 36 shutil.rmtree('build')
37 37 except OSError:
38 38 pass
39 for plat in ['32b-Windows', '64b-Windows']:
39 for plat in ['win32', 'win-amd64']:
40 40 cmd = cmd_t.format(**locals())
41 41 sh(cmd)
42 orig = glob.glob(os.path.join('dist', 'ipython-*.{plat}.exe'.format(**locals())))[0]
43 mangled = orig.replace('.{plat}.exe'.format(**locals()),
44 '.py{v}-{plat}.exe'.format(**locals())
45 )
46 os.rename(orig, mangled)
47 if pypi:
48 sh(pypi_cmd_t.format(fname=mangled))
42 49 if github and gh_api:
43 exe = glob.glob(os.path.join("dist", "ipython-*{v}-{plat}.exe".format(**locals())))[0]
44 print ("Uploading %s to GitHub" % exe)
50 print ("Uploading %s to GitHub" % mangled)
45 51 desc = "IPython Installer for Python {v}.x on {plat}".format(**locals())
46 gh_api.post_download('ipython/ipython', exe, description=desc)
52 gh_api.post_download('ipython/ipython', mangled, description=desc)
General Comments 0
You need to be logged in to leave comments. Login now