##// END OF EJS Templates
enable uploading wininst to PyPI with 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
@@ -25,9 +25,8 b" github = '--github' in sys.argv"
25 25
26 26 cmd_t = "{py} setup.py bdist_wininst --plat-name={plat}"
27 27
28 if '--pypi' in sys.argv:
29 raise NotImplementedError("pypi upload doesn't work yet")
30 cmd_t += ' upload'
28 pypi = '--pypi' in sys.argv
29 pypi_cmd_t = "python setup.py upload_wininst -f {fname}"
31 30
32 31 for py in ['python', 'python3']:
33 32 # deliberately mangle the name,
@@ -45,6 +44,8 b" for py in ['python', 'python3']:"
45 44 '.py{v}-{plat}.exe'.format(**locals())
46 45 )
47 46 os.rename(orig, mangled)
47 if pypi:
48 sh(pypi_cmd_t.format(fname=mangled))
48 49 if github and gh_api:
49 50 print ("Uploading %s to GitHub" % mangled)
50 51 desc = "IPython Installer for Python {v}.x on {plat}".format(**locals())
General Comments 0
You need to be logged in to leave comments. Login now