##// END OF EJS Templates
Improve Windows start menu shortcuts
Christoph Gohlke -
Show More
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -1,151 +1,160 b''
1 #!python
1 #!python
2 """Windows-specific part of the installation"""
2 """Distutils post installation script for Windows.
3
4 http://docs.python.org/2/distutils/builtdist.html#the-postinstallation-script
5
6 """
3
7
4 from __future__ import print_function
8 from __future__ import print_function
5
9
6 import os, sys, shutil
10 import os
7 pjoin = os.path.join
11 import sys
12 import shutil
13 import platform
8
14
9 # import setuptools if we can
10 try:
15 try:
11 import setuptools
16 import setuptools
17 have_setuptools = True
12 except ImportError:
18 except ImportError:
13 pass
19 have_setuptools = False
20
21
22 pjoin = os.path.join
23
24 # suffix for start menu folder names
25 pyver = "(Py%i.%i %i bit)" % (sys.version_info[0], sys.version_info[1],
26 (32, 64)[sys.maxsize > 2**32])
14
27
15
28
16 def mkshortcut(target,description,link_file,*args,**kw):
29 def mkshortcut(target, description, linkdir, arguments="", iconpath='',
17 """make a shortcut if it doesn't exist, and register its creation"""
30 workdir="%HOMEDRIVE%%HOMEPATH%", iconindex=0):
18
31 """Make a shortcut if it doesn't exist and register its creation."""
19 create_shortcut(target, description, link_file,*args,**kw)
32 filename = pjoin(linkdir, description + '.lnk')
20 file_created(link_file)
33 description = "%s %s" % (description, pyver)
34 create_shortcut(target, description, filename, arguments, workdir,
35 iconpath, iconindex)
36 file_created(filename)
37
38
39 def arguments(scriptsdir, script, scriptargs=''):
40 """Return command line arguments to be passed to the python executable."""
41 cmdbase = suffix(pjoin(scriptsdir, script))
42 if have_setuptools:
43 cmdbase += '-script.py'
44 return '"%s" %s' % (cmdbase, scriptargs)
45
21
46
22 def suffix(s):
47 def suffix(s):
23 """add '3' suffix to programs for Python 3"""
48 """Add '3' suffix to programs for Python 3."""
24 if sys.version_info[0] == 3:
49 if sys.version_info[0] == 3:
25 s = s+'3'
50 s = s + '3'
26 return s
51 return s
27
52
53
28 def install():
54 def install():
29 """Routine to be run by the win32 installer with the -install switch."""
55 """Routine to be run by the win32 installer with the -install switch."""
30
31 # Get some system constants
56 # Get some system constants
32 prefix = sys.prefix
57 python = pjoin(sys.prefix, 'python.exe')
33 python = pjoin(prefix, 'python.exe')
58 pythonw = pjoin(sys.prefix, 'pythonw.exe')
34 pythonw = pjoin(prefix, 'pythonw.exe')
59
35 have_setuptools = 'setuptools' in sys.modules
36
37 if not have_setuptools:
60 if not have_setuptools:
38 # This currently doesn't work without setuptools,
61 # This currently doesn't work without setuptools,
39 # so don't bother making broken links
62 # so don't bother making broken links
40 print("Distribute (setuptools) is required to create Start Menu items.", file=sys.stderr)
63 print("Distribute (setuptools) is required to"
41 print("Re-run this installer after installing distribute to get Start Menu items.", file=sys.stderr)
64 " create Start Menu items.", file=sys.stderr)
65 print("Re-run this installer after installing"
66 " distribute to get Start Menu items.", file=sys.stderr)
42 return
67 return
43
68
44 # Lookup path to common startmenu ...
69 # Lookup path to common startmenu ...
45 ip_start_menu = pjoin(get_special_folder_path('CSIDL_COMMON_PROGRAMS'),
70 ip_start_menu = pjoin(get_special_folder_path('CSIDL_COMMON_PROGRAMS'),
46 'IPython (Py%i.%i %i bit)' % (sys.version_info[0],
71 'IPython %s' % pyver)
47 sys.version_info[1],
72
48 8*tuple.__itemsize__))
49 # Create IPython entry ...
73 # Create IPython entry ...
50 if not os.path.isdir(ip_start_menu):
74 if not os.path.isdir(ip_start_menu):
51 os.mkdir(ip_start_menu)
75 os.mkdir(ip_start_menu)
52 directory_created(ip_start_menu)
76 directory_created(ip_start_menu)
53
77
54 # Create .py and .bat files to make things available from
78 # Create .py and .bat files to make things available from
55 # the Windows command line. Thanks to the Twisted project
79 # the Windows command line. Thanks to the Twisted project
56 # for this logic!
80 # for this logic!
57 programs = [
81 programs = [
58 'ipython',
82 'ipython',
59 'iptest',
83 'iptest',
60 'ipcontroller',
84 'ipcontroller',
61 'ipengine',
85 'ipengine',
62 'ipcluster',
86 'ipcluster',
63 'irunner'
87 'irunner',
64 ]
88 ]
65 programs = [ suffix(p) for p in programs ]
89 programs = [suffix(p) for p in programs]
66 scripts = pjoin(prefix,'scripts')
90 scripts = pjoin(sys.prefix, 'scripts')
67 if not have_setuptools:
91 if not have_setuptools:
68 # only create .bat files if we don't have setuptools
92 # only create .bat files if we don't have setuptools
69 for program in programs:
93 for program in programs:
70 raw = pjoin(scripts, program)
94 raw = pjoin(scripts, program)
71 bat = raw + '.bat'
95 bat = raw + '.bat'
72 py = raw + '.py'
96 py = raw + '.py'
73 # Create .py versions of the scripts
97 # Create .py versions of the scripts
74 shutil.copy(raw, py)
98 shutil.copy(raw, py)
75 # Create .bat files for each of the scripts
99 # Create .bat files for each of the scripts
76 bat_file = file(bat,'w')
100 bat_file = file(bat, 'w')
77 bat_file.write("@%s %s %%*" % (python, py))
101 bat_file.write("@%s %s %%*" % (python, py))
78 bat_file.close()
102 bat_file.close()
79
103
80 # Now move onto setting the Start Menu up
104 # Create Start Menu shortcuts
81 ipybase = suffix(pjoin(scripts, 'ipython'))
105 iconpath = pjoin(scripts, 'ipython.ico')
82 if have_setuptools:
106 mkshortcut(python, 'IPython', ip_start_menu,
83 # let setuptools take care of the scripts:
107 arguments(scripts, 'ipython'), iconpath)
84 ipybase = ipybase + '-script.py'
108 mkshortcut(python, 'IPython (pylab mode)', ip_start_menu,
85 workdir = "%HOMEDRIVE%%HOMEPATH%"
109 arguments(scripts, 'ipython', '--pylab'), iconpath)
86
110 mkshortcut(python, 'IPython Controller', ip_start_menu,
87 link = pjoin(ip_start_menu, 'IPython.lnk')
111 arguments(scripts, 'ipcontroller'), iconpath)
88 cmd = '"%s"' % ipybase
112 mkshortcut(python, 'IPython Engine', ip_start_menu,
89 mkshortcut(python, 'IPython', link, cmd, workdir)
113 arguments(scripts, 'ipengine'), iconpath)
90
114 mkshortcut(pythonw, 'IPython Qt Console', ip_start_menu,
115 arguments(scripts, 'ipython', 'qtconsole'), iconpath)
116 mkshortcut(pythonw, 'IPython Qt Console (pylab mode)', ip_start_menu,
117 arguments(scripts, 'ipython', 'qtconsole --pylab=inline'),
118 iconpath)
119
120 iconpath = pjoin(scripts, 'ipython_nb.ico')
121 mkshortcut(python, 'IPython Notebook', ip_start_menu,
122 arguments(scripts, 'ipython', 'notebook'), iconpath)
123 mkshortcut(python, 'IPython Notebook (pylab mode)', ip_start_menu,
124 arguments(scripts, 'ipython', 'notebook --pylab=inline'),
125 iconpath)
126
127 try:
128 import IPython
129 mkshortcut(pythonw, 'IPython Documentation', ip_start_menu,
130 '-m webbrowser -t "http://ipython.org/ipython-doc/'
131 'rel-%s/index.html"' % IPython.__version__,
132 iconpath='url.dll')
133 except Exception:
134 pass
135
91 # Disable pysh Start item until the profile restores functionality
136 # Disable pysh Start item until the profile restores functionality
92 # Most of this code is in IPython/deathrow, and needs to be updated
137 # Most of this code is in IPython/deathrow, and needs to be updated
93 # to 0.11 APIs
138 # to 0.11 APIs
94
139 #mkshortcut(python, 'IPython%s (command prompt mode)', ip_start_menu,
95 # link = pjoin(ip_start_menu, 'pysh.lnk')
140 # arguments(scripts, 'ipython', 'profile=pysh --init'))
96 # cmd = '"%s" profile=pysh --init' % ipybase
141
97 # mkshortcut(python, 'IPython (command prompt mode)', link, cmd, workdir)
98
99 link = pjoin(ip_start_menu, 'pylab.lnk')
100 cmd = '"%s" --pylab' % ipybase
101 mkshortcut(python, 'IPython (pylab mode)', link, cmd, workdir)
102
103 link = pjoin(ip_start_menu, 'ipcontroller.lnk')
104 cmdbase = suffix(pjoin(scripts, 'ipcontroller'))
105 if have_setuptools:
106 cmdbase += '-script.py'
107 cmd = '"%s"' % cmdbase
108 mkshortcut(python, 'IPython controller', link, cmd, workdir)
109
110 link = pjoin(ip_start_menu, 'ipengine.lnk')
111 cmdbase = suffix(pjoin(scripts, 'ipengine'))
112 if have_setuptools:
113 cmdbase += '-script.py'
114 cmd = '"%s"' % cmdbase
115 mkshortcut(python, 'IPython engine', link, cmd, workdir)
116
142
117 link = pjoin(ip_start_menu, 'ipythonqt.lnk')
118 cmdbase = suffix(pjoin(scripts, 'ipython'))
119 if have_setuptools:
120 cmdbase += '-script.py'
121 cmd = '"%s" qtconsole' % cmdbase
122 mkshortcut(pythonw, 'IPython Qt Console', link, cmd, workdir)
123
124 # FIXME: These below are commented out because we don't ship the html built
125 # docs anymore. We should make the shortcut to continue existing, but as a
126 # URL to the online the docs for the right version of IPython. The stable
127 # URLs have the pattern:
128 # http://ipython.org/ipython-doc/rel-X.Y.Z/html
129 # For IPython version X.Y.Z.
130
131 ## # Create documentation shortcuts ...
132 ## t = prefix + r'\share\doc\ipython\manual\index.html'
133 ## f = ip_start_menu + r'\Manual in HTML.lnk'
134 ## mkshortcut(t,'IPython Manual - HTML-Format',f)
135
136 def remove():
143 def remove():
137 """Routine to be run by the win32 installer with the -remove switch."""
144 """Routine to be run by the win32 installer with the -remove switch."""
138 pass
145 pass
139
146
140
147
141 # main()
148 # main()
142 if len(sys.argv) > 1:
149 if len(sys.argv) > 1:
143 if sys.argv[1] == '-install':
150 if sys.argv[1] == '-install':
144 try:
151 try:
145 install()
152 install()
146 except OSError:
153 except OSError:
147 print("Failed to create Start Menu items, try running installer as administrator.", file=sys.stderr)
154 print("Failed to create Start Menu items, try running the"
155 " installer as administrator.", file=sys.stderr)
148 elif sys.argv[1] == '-remove':
156 elif sys.argv[1] == '-remove':
149 remove()
157 remove()
150 else:
158 else:
151 print("Script was called with option %s" % sys.argv[1], file=sys.stderr)
159 print("Script was called with option %s" % sys.argv[1],
160 file=sys.stderr)
@@ -1,302 +1,304 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
2 # -*- coding: utf-8 -*-
3 """Setup script for IPython.
3 """Setup script for IPython.
4
4
5 Under Posix environments it works like a typical setup.py script.
5 Under Posix environments it works like a typical setup.py script.
6 Under Windows, the command sdist is not supported, since IPython
6 Under Windows, the command sdist is not supported, since IPython
7 requires utilities which are not available under Windows."""
7 requires utilities which are not available under Windows."""
8
8
9 #-----------------------------------------------------------------------------
9 #-----------------------------------------------------------------------------
10 # Copyright (c) 2008-2011, IPython Development Team.
10 # Copyright (c) 2008-2011, IPython Development Team.
11 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
11 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
12 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
12 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
13 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
13 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
14 #
14 #
15 # Distributed under the terms of the Modified BSD License.
15 # Distributed under the terms of the Modified BSD License.
16 #
16 #
17 # The full license is in the file COPYING.txt, distributed with this software.
17 # The full license is in the file COPYING.txt, distributed with this software.
18 #-----------------------------------------------------------------------------
18 #-----------------------------------------------------------------------------
19
19
20 #-----------------------------------------------------------------------------
20 #-----------------------------------------------------------------------------
21 # Minimal Python version sanity check
21 # Minimal Python version sanity check
22 #-----------------------------------------------------------------------------
22 #-----------------------------------------------------------------------------
23 from __future__ import print_function
23 from __future__ import print_function
24
24
25 import sys
25 import sys
26
26
27 # This check is also made in IPython/__init__, don't forget to update both when
27 # This check is also made in IPython/__init__, don't forget to update both when
28 # changing Python version requirements.
28 # changing Python version requirements.
29 #~ if sys.version[0:3] < '2.6':
29 #~ if sys.version[0:3] < '2.6':
30 #~ error = """\
30 #~ error = """\
31 #~ ERROR: 'IPython requires Python Version 2.6 or above.'
31 #~ ERROR: 'IPython requires Python Version 2.6 or above.'
32 #~ Exiting."""
32 #~ Exiting."""
33 #~ print >> sys.stderr, error
33 #~ print >> sys.stderr, error
34 #~ sys.exit(1)
34 #~ sys.exit(1)
35
35
36 PY3 = (sys.version_info[0] >= 3)
36 PY3 = (sys.version_info[0] >= 3)
37
37
38 # At least we're on the python version we need, move on.
38 # At least we're on the python version we need, move on.
39
39
40 #-------------------------------------------------------------------------------
40 #-------------------------------------------------------------------------------
41 # Imports
41 # Imports
42 #-------------------------------------------------------------------------------
42 #-------------------------------------------------------------------------------
43
43
44 # Stdlib imports
44 # Stdlib imports
45 import os
45 import os
46 import shutil
46 import shutil
47
47
48 from glob import glob
48 from glob import glob
49
49
50 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
50 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
51 # update it when the contents of directories change.
51 # update it when the contents of directories change.
52 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
52 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
53
53
54 from distutils.core import setup
54 from distutils.core import setup
55
55
56 # On Python 3, we need distribute (new setuptools) to do the 2to3 conversion
56 # On Python 3, we need distribute (new setuptools) to do the 2to3 conversion
57 if PY3:
57 if PY3:
58 import setuptools
58 import setuptools
59
59
60 # Our own imports
60 # Our own imports
61 from setupbase import target_update
61 from setupbase import target_update
62
62
63 from setupbase import (
63 from setupbase import (
64 setup_args,
64 setup_args,
65 find_packages,
65 find_packages,
66 find_package_data,
66 find_package_data,
67 find_scripts,
67 find_scripts,
68 find_data_files,
68 find_data_files,
69 check_for_dependencies,
69 check_for_dependencies,
70 record_commit_info,
70 record_commit_info,
71 )
71 )
72 from setupext import setupext
72 from setupext import setupext
73
73
74 isfile = os.path.isfile
74 isfile = os.path.isfile
75 pjoin = os.path.join
75 pjoin = os.path.join
76
76
77 #-----------------------------------------------------------------------------
77 #-----------------------------------------------------------------------------
78 # Function definitions
78 # Function definitions
79 #-----------------------------------------------------------------------------
79 #-----------------------------------------------------------------------------
80
80
81 def cleanup():
81 def cleanup():
82 """Clean up the junk left around by the build process"""
82 """Clean up the junk left around by the build process"""
83 if "develop" not in sys.argv and "egg_info" not in sys.argv:
83 if "develop" not in sys.argv and "egg_info" not in sys.argv:
84 try:
84 try:
85 shutil.rmtree('ipython.egg-info')
85 shutil.rmtree('ipython.egg-info')
86 except:
86 except:
87 try:
87 try:
88 os.unlink('ipython.egg-info')
88 os.unlink('ipython.egg-info')
89 except:
89 except:
90 pass
90 pass
91
91
92 #-------------------------------------------------------------------------------
92 #-------------------------------------------------------------------------------
93 # Handle OS specific things
93 # Handle OS specific things
94 #-------------------------------------------------------------------------------
94 #-------------------------------------------------------------------------------
95
95
96 if os.name == 'posix':
96 if os.name == 'posix':
97 os_name = 'posix'
97 os_name = 'posix'
98 elif os.name in ['nt','dos']:
98 elif os.name in ['nt','dos']:
99 os_name = 'windows'
99 os_name = 'windows'
100 else:
100 else:
101 print('Unsupported operating system:',os.name)
101 print('Unsupported operating system:',os.name)
102 sys.exit(1)
102 sys.exit(1)
103
103
104 # Under Windows, 'sdist' has not been supported. Now that the docs build with
104 # Under Windows, 'sdist' has not been supported. Now that the docs build with
105 # Sphinx it might work, but let's not turn it on until someone confirms that it
105 # Sphinx it might work, but let's not turn it on until someone confirms that it
106 # actually works.
106 # actually works.
107 if os_name == 'windows' and 'sdist' in sys.argv:
107 if os_name == 'windows' and 'sdist' in sys.argv:
108 print('The sdist command is not available under Windows. Exiting.')
108 print('The sdist command is not available under Windows. Exiting.')
109 sys.exit(1)
109 sys.exit(1)
110
110
111 #-------------------------------------------------------------------------------
111 #-------------------------------------------------------------------------------
112 # Things related to the IPython documentation
112 # Things related to the IPython documentation
113 #-------------------------------------------------------------------------------
113 #-------------------------------------------------------------------------------
114
114
115 # update the manuals when building a source dist
115 # update the manuals when building a source dist
116 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
116 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
117 import textwrap
117 import textwrap
118
118
119 # List of things to be updated. Each entry is a triplet of args for
119 # List of things to be updated. Each entry is a triplet of args for
120 # target_update()
120 # target_update()
121 to_update = [
121 to_update = [
122 # FIXME - Disabled for now: we need to redo an automatic way
122 # FIXME - Disabled for now: we need to redo an automatic way
123 # of generating the magic info inside the rst.
123 # of generating the magic info inside the rst.
124 #('docs/magic.tex',
124 #('docs/magic.tex',
125 #['IPython/Magic.py'],
125 #['IPython/Magic.py'],
126 #"cd doc && ./update_magic.sh" ),
126 #"cd doc && ./update_magic.sh" ),
127
127
128 ('docs/man/ipcluster.1.gz',
128 ('docs/man/ipcluster.1.gz',
129 ['docs/man/ipcluster.1'],
129 ['docs/man/ipcluster.1'],
130 'cd docs/man && gzip -9c ipcluster.1 > ipcluster.1.gz'),
130 'cd docs/man && gzip -9c ipcluster.1 > ipcluster.1.gz'),
131
131
132 ('docs/man/ipcontroller.1.gz',
132 ('docs/man/ipcontroller.1.gz',
133 ['docs/man/ipcontroller.1'],
133 ['docs/man/ipcontroller.1'],
134 'cd docs/man && gzip -9c ipcontroller.1 > ipcontroller.1.gz'),
134 'cd docs/man && gzip -9c ipcontroller.1 > ipcontroller.1.gz'),
135
135
136 ('docs/man/ipengine.1.gz',
136 ('docs/man/ipengine.1.gz',
137 ['docs/man/ipengine.1'],
137 ['docs/man/ipengine.1'],
138 'cd docs/man && gzip -9c ipengine.1 > ipengine.1.gz'),
138 'cd docs/man && gzip -9c ipengine.1 > ipengine.1.gz'),
139
139
140 ('docs/man/iplogger.1.gz',
140 ('docs/man/iplogger.1.gz',
141 ['docs/man/iplogger.1'],
141 ['docs/man/iplogger.1'],
142 'cd docs/man && gzip -9c iplogger.1 > iplogger.1.gz'),
142 'cd docs/man && gzip -9c iplogger.1 > iplogger.1.gz'),
143
143
144 ('docs/man/ipython.1.gz',
144 ('docs/man/ipython.1.gz',
145 ['docs/man/ipython.1'],
145 ['docs/man/ipython.1'],
146 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
146 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
147
147
148 ('docs/man/irunner.1.gz',
148 ('docs/man/irunner.1.gz',
149 ['docs/man/irunner.1'],
149 ['docs/man/irunner.1'],
150 'cd docs/man && gzip -9c irunner.1 > irunner.1.gz'),
150 'cd docs/man && gzip -9c irunner.1 > irunner.1.gz'),
151
151
152 ('docs/man/pycolor.1.gz',
152 ('docs/man/pycolor.1.gz',
153 ['docs/man/pycolor.1'],
153 ['docs/man/pycolor.1'],
154 'cd docs/man && gzip -9c pycolor.1 > pycolor.1.gz'),
154 'cd docs/man && gzip -9c pycolor.1 > pycolor.1.gz'),
155 ]
155 ]
156
156
157
157
158 [ target_update(*t) for t in to_update ]
158 [ target_update(*t) for t in to_update ]
159
159
160 #---------------------------------------------------------------------------
160 #---------------------------------------------------------------------------
161 # Find all the packages, package data, and data_files
161 # Find all the packages, package data, and data_files
162 #---------------------------------------------------------------------------
162 #---------------------------------------------------------------------------
163
163
164 packages = find_packages()
164 packages = find_packages()
165 package_data = find_package_data()
165 package_data = find_package_data()
166 data_files = find_data_files()
166 data_files = find_data_files()
167
167
168 setup_args['packages'] = packages
168 setup_args['packages'] = packages
169 setup_args['package_data'] = package_data
169 setup_args['package_data'] = package_data
170 setup_args['data_files'] = data_files
170 setup_args['data_files'] = data_files
171
171
172 #---------------------------------------------------------------------------
172 #---------------------------------------------------------------------------
173 # custom distutils commands
173 # custom distutils commands
174 #---------------------------------------------------------------------------
174 #---------------------------------------------------------------------------
175 # imports here, so they are after setuptools import if there was one
175 # imports here, so they are after setuptools import if there was one
176 from distutils.command.sdist import sdist
176 from distutils.command.sdist import sdist
177 from distutils.command.upload import upload
177 from distutils.command.upload import upload
178
178
179 class UploadWindowsInstallers(upload):
179 class UploadWindowsInstallers(upload):
180
180
181 description = "Upload Windows installers to PyPI (only used from tools/release_windows.py)"
181 description = "Upload Windows installers to PyPI (only used from tools/release_windows.py)"
182 user_options = upload.user_options + [
182 user_options = upload.user_options + [
183 ('files=', 'f', 'exe file (or glob) to upload')
183 ('files=', 'f', 'exe file (or glob) to upload')
184 ]
184 ]
185 def initialize_options(self):
185 def initialize_options(self):
186 upload.initialize_options(self)
186 upload.initialize_options(self)
187 meta = self.distribution.metadata
187 meta = self.distribution.metadata
188 base = '{name}-{version}'.format(
188 base = '{name}-{version}'.format(
189 name=meta.get_name(),
189 name=meta.get_name(),
190 version=meta.get_version()
190 version=meta.get_version()
191 )
191 )
192 self.files = os.path.join('dist', '%s.*.exe' % base)
192 self.files = os.path.join('dist', '%s.*.exe' % base)
193
193
194 def run(self):
194 def run(self):
195 for dist_file in glob(self.files):
195 for dist_file in glob(self.files):
196 self.upload_file('bdist_wininst', 'any', dist_file)
196 self.upload_file('bdist_wininst', 'any', dist_file)
197
197
198 setup_args['cmdclass'] = {
198 setup_args['cmdclass'] = {
199 'build_py': record_commit_info('IPython'),
199 'build_py': record_commit_info('IPython'),
200 'sdist' : record_commit_info('IPython', sdist),
200 'sdist' : record_commit_info('IPython', sdist),
201 'upload_wininst' : UploadWindowsInstallers,
201 'upload_wininst' : UploadWindowsInstallers,
202 }
202 }
203
203
204 #---------------------------------------------------------------------------
204 #---------------------------------------------------------------------------
205 # Handle scripts, dependencies, and setuptools specific things
205 # Handle scripts, dependencies, and setuptools specific things
206 #---------------------------------------------------------------------------
206 #---------------------------------------------------------------------------
207
207
208 # For some commands, use setuptools. Note that we do NOT list install here!
208 # For some commands, use setuptools. Note that we do NOT list install here!
209 # If you want a setuptools-enhanced install, just run 'setupegg.py install'
209 # If you want a setuptools-enhanced install, just run 'setupegg.py install'
210 needs_setuptools = set(('develop', 'release', 'bdist_egg', 'bdist_rpm',
210 needs_setuptools = set(('develop', 'release', 'bdist_egg', 'bdist_rpm',
211 'bdist', 'bdist_dumb', 'bdist_wininst', 'install_egg_info',
211 'bdist', 'bdist_dumb', 'bdist_wininst', 'install_egg_info',
212 'egg_info', 'easy_install', 'upload',
212 'egg_info', 'easy_install', 'upload',
213 ))
213 ))
214 if sys.platform == 'win32':
214 if sys.platform == 'win32':
215 # Depend on setuptools for install on *Windows only*
215 # Depend on setuptools for install on *Windows only*
216 # If we get script-installation working without setuptools,
216 # If we get script-installation working without setuptools,
217 # then we can back off, but until then use it.
217 # then we can back off, but until then use it.
218 # See Issue #369 on GitHub for more
218 # See Issue #369 on GitHub for more
219 needs_setuptools.add('install')
219 needs_setuptools.add('install')
220
220
221 if len(needs_setuptools.intersection(sys.argv)) > 0:
221 if len(needs_setuptools.intersection(sys.argv)) > 0:
222 import setuptools
222 import setuptools
223
223
224 # This dict is used for passing extra arguments that are setuptools
224 # This dict is used for passing extra arguments that are setuptools
225 # specific to setup
225 # specific to setup
226 setuptools_extra_args = {}
226 setuptools_extra_args = {}
227
227
228 if 'setuptools' in sys.modules:
228 if 'setuptools' in sys.modules:
229 setuptools_extra_args['zip_safe'] = False
229 setuptools_extra_args['zip_safe'] = False
230 setuptools_extra_args['entry_points'] = find_scripts(True)
230 setuptools_extra_args['entry_points'] = find_scripts(True)
231 setup_args['extras_require'] = dict(
231 setup_args['extras_require'] = dict(
232 parallel = 'pyzmq>=2.1.4',
232 parallel = 'pyzmq>=2.1.4',
233 qtconsole = 'pygments',
233 qtconsole = 'pygments',
234 zmq = 'pyzmq>=2.1.4',
234 zmq = 'pyzmq>=2.1.4',
235 doc = 'Sphinx>=0.3',
235 doc = 'Sphinx>=0.3',
236 test = 'nose>=0.10.1',
236 test = 'nose>=0.10.1',
237 notebook = 'tornado>=2.0'
237 notebook = 'tornado>=2.0'
238 )
238 )
239 requires = setup_args.setdefault('install_requires', [])
239 requires = setup_args.setdefault('install_requires', [])
240 setupext.display_status = False
240 setupext.display_status = False
241 if not setupext.check_for_readline():
241 if not setupext.check_for_readline():
242 if sys.platform == 'darwin':
242 if sys.platform == 'darwin':
243 requires.append('readline')
243 requires.append('readline')
244 elif sys.platform.startswith('win'):
244 elif sys.platform.startswith('win'):
245 # Pyreadline 64 bit windows issue solved in versions >=1.7.1
245 # Pyreadline 64 bit windows issue solved in versions >=1.7.1
246 # Also solves issues with some older versions of pyreadline that
246 # Also solves issues with some older versions of pyreadline that
247 # satisfy the unconstrained depdendency.
247 # satisfy the unconstrained depdendency.
248 requires.append('pyreadline>=1.7.1')
248 requires.append('pyreadline>=1.7.1')
249 else:
249 else:
250 pass
250 pass
251 # do we want to install readline here?
251 # do we want to install readline here?
252
252
253 # Script to be run by the windows binary installer after the default setup
253 # Script to be run by the windows binary installer after the default setup
254 # routine, to add shortcuts and similar windows-only things. Windows
254 # routine, to add shortcuts and similar windows-only things. Windows
255 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
255 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
256 # doesn't find them.
256 # doesn't find them.
257 if 'bdist_wininst' in sys.argv:
257 if 'bdist_wininst' in sys.argv:
258 if len(sys.argv) > 2 and \
258 if len(sys.argv) > 2 and \
259 ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
259 ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
260 print >> sys.stderr, "ERROR: bdist_wininst must be run alone. Exiting."
260 print >> sys.stderr, "ERROR: bdist_wininst must be run alone. Exiting."
261 sys.exit(1)
261 sys.exit(1)
262 setup_args['data_files'].append(
263 ['Scripts', ('scripts/ipython.ico', 'scripts/ipython_nb.ico')])
262 setup_args['scripts'] = [pjoin('scripts','ipython_win_post_install.py')]
264 setup_args['scripts'] = [pjoin('scripts','ipython_win_post_install.py')]
263 setup_args['options'] = {"bdist_wininst":
265 setup_args['options'] = {"bdist_wininst":
264 {"install_script":
266 {"install_script":
265 "ipython_win_post_install.py"}}
267 "ipython_win_post_install.py"}}
266
268
267 if PY3:
269 if PY3:
268 setuptools_extra_args['use_2to3'] = True
270 setuptools_extra_args['use_2to3'] = True
269 # we try to make a 2.6, 2.7, and 3.1 to 3.3 python compatible code
271 # we try to make a 2.6, 2.7, and 3.1 to 3.3 python compatible code
270 # so we explicitly disable some 2to3 fixes to be sure we aren't forgetting
272 # so we explicitly disable some 2to3 fixes to be sure we aren't forgetting
271 # anything.
273 # anything.
272 setuptools_extra_args['use_2to3_exclude_fixers'] = [
274 setuptools_extra_args['use_2to3_exclude_fixers'] = [
273 'lib2to3.fixes.fix_apply',
275 'lib2to3.fixes.fix_apply',
274 'lib2to3.fixes.fix_except',
276 'lib2to3.fixes.fix_except',
275 'lib2to3.fixes.fix_has_key',
277 'lib2to3.fixes.fix_has_key',
276 'lib2to3.fixes.fix_next',
278 'lib2to3.fixes.fix_next',
277 'lib2to3.fixes.fix_repr',
279 'lib2to3.fixes.fix_repr',
278 'lib2to3.fixes.fix_tuple_params',
280 'lib2to3.fixes.fix_tuple_params',
279 ]
281 ]
280 from setuptools.command.build_py import build_py
282 from setuptools.command.build_py import build_py
281 setup_args['cmdclass'] = {'build_py': record_commit_info('IPython', build_cmd=build_py)}
283 setup_args['cmdclass'] = {'build_py': record_commit_info('IPython', build_cmd=build_py)}
282 setuptools_extra_args['entry_points'] = find_scripts(True, suffix='3')
284 setuptools_extra_args['entry_points'] = find_scripts(True, suffix='3')
283 setuptools._dont_write_bytecode = True
285 setuptools._dont_write_bytecode = True
284 else:
286 else:
285 # If we are running without setuptools, call this function which will
287 # If we are running without setuptools, call this function which will
286 # check for dependencies an inform the user what is needed. This is
288 # check for dependencies an inform the user what is needed. This is
287 # just to make life easy for users.
289 # just to make life easy for users.
288 check_for_dependencies()
290 check_for_dependencies()
289 setup_args['scripts'] = find_scripts(False)
291 setup_args['scripts'] = find_scripts(False)
290
292
291 #---------------------------------------------------------------------------
293 #---------------------------------------------------------------------------
292 # Do the actual setup now
294 # Do the actual setup now
293 #---------------------------------------------------------------------------
295 #---------------------------------------------------------------------------
294
296
295 setup_args.update(setuptools_extra_args)
297 setup_args.update(setuptools_extra_args)
296
298
297 def main():
299 def main():
298 setup(**setup_args)
300 setup(**setup_args)
299 cleanup()
301 cleanup()
300
302
301 if __name__ == '__main__':
303 if __name__ == '__main__':
302 main()
304 main()
General Comments 0
You need to be logged in to leave comments. Login now