##// END OF EJS Templates
Normalize line endings for ipexec_validate, fix for #2315....
Normalize line endings for ipexec_validate, fix for #2315. Make sure line endings are the same both in the ipexec result and in the expected result.

File last commit:

r7762:c8fdc6e5
r8288:ced21cc9
Show More
ipython_win_post_install.py
151 lines | 5.2 KiB | text/x-python | PythonLexer
/ scripts / ipython_win_post_install.py
Ville M. Vainio
crlf -> lf
r1032 #!python
"""Windows-specific part of the installation"""
MinRK
py3 fixes for win_post_install.py
r5680 from __future__ import print_function
Ville M. Vainio
crlf -> lf
r1032 import os, sys, shutil
Brian Granger
Tried to fix the windows post install script. It now creates...
r1611 pjoin = os.path.join
Ville M. Vainio
crlf -> lf
r1032
Min RK
wininst post install script updated and requires setuptools...
r4094 # import setuptools if we can
try:
import setuptools
except ImportError:
pass
Fernando Perez
Disable PDF manual building for distribution and installation....
r4453
Ville M. Vainio
crlf -> lf
r1032 def mkshortcut(target,description,link_file,*args,**kw):
"""make a shortcut if it doesn't exist, and register its creation"""
create_shortcut(target, description, link_file,*args,**kw)
file_created(link_file)
MinRK
py3 fixes for win_post_install.py
r5680 def suffix(s):
"""add '3' suffix to programs for Python 3"""
if sys.version_info[0] == 3:
s = s+'3'
return s
Fernando Perez
Disable PDF manual building for distribution and installation....
r4453
Ville M. Vainio
crlf -> lf
r1032 def install():
"""Routine to be run by the win32 installer with the -install switch."""
Brian Granger
Tried to fix the windows post install script. It now creates...
r1611
# Get some system constants
prefix = sys.prefix
python = pjoin(prefix, 'python.exe')
Min RK
wininst post install script updated and requires setuptools...
r4094 pythonw = pjoin(prefix, 'pythonw.exe')
have_setuptools = 'setuptools' in sys.modules
if not have_setuptools:
# This currently doesn't work without setuptools,
# so don't bother making broken links
MinRK
display message if wininst is run without setuptools
r7762 print("Distribute (setuptools) is required to create Start Menu items.", file=sys.stderr)
print("Re-run this installer after installing distribute to get Start Menu items.", file=sys.stderr)
Min RK
wininst post install script updated and requires setuptools...
r4094 return
Brian Granger
Tried to fix the windows post install script. It now creates...
r1611
# Lookup path to common startmenu ...
Christoph Gohlke
Windows install fixes...
r4175 ip_start_menu = pjoin(get_special_folder_path('CSIDL_COMMON_PROGRAMS'),
'IPython (Py%i.%i %i bit)' % (sys.version_info[0],
sys.version_info[1],
8*tuple.__itemsize__))
Ville M. Vainio
crlf -> lf
r1032 # Create IPython entry ...
Brian Granger
Tried to fix the windows post install script. It now creates...
r1611 if not os.path.isdir(ip_start_menu):
os.mkdir(ip_start_menu)
directory_created(ip_start_menu)
# Create .py and .bat files to make things available from
Brian Granger
Added test in ipcluster.py to see if the platform is win32. If so,...
r1613 # the Windows command line. Thanks to the Twisted project
# for this logic!
Brian Granger
Completely fixed the ipython_win_post_install.py script. It now ...
r1612 programs = [
'ipython',
'iptest',
'ipcontroller',
'ipengine',
'ipcluster',
'irunner'
]
MinRK
py3 fixes for win_post_install.py
r5680 programs = [ suffix(p) for p in programs ]
Brian Granger
Tried to fix the windows post install script. It now creates...
r1611 scripts = pjoin(prefix,'scripts')
Min RK
wininst post install script updated and requires setuptools...
r4094 if not have_setuptools:
# only create .bat files if we don't have setuptools
for program in programs:
raw = pjoin(scripts, program)
bat = raw + '.bat'
py = raw + '.py'
# Create .py versions of the scripts
shutil.copy(raw, py)
# Create .bat files for each of the scripts
bat_file = file(bat,'w')
bat_file.write("@%s %s %%*" % (python, py))
bat_file.close()
Brian Granger
Tried to fix the windows post install script. It now creates...
r1611 # Now move onto setting the Start Menu up
MinRK
py3 fixes for win_post_install.py
r5680 ipybase = suffix(pjoin(scripts, 'ipython'))
Min RK
wininst post install script updated and requires setuptools...
r4094 if have_setuptools:
Darren Dale
fix windows post-installation routines with setuptools installed
r3228 # let setuptools take care of the scripts:
ipybase = ipybase + '-script.py'
Darren Dale
specify windows working directory...
r3227 workdir = "%HOMEDRIVE%%HOMEPATH%"
Ville M. Vainio
crlf -> lf
r1032
Brian Granger
Completely fixed the ipython_win_post_install.py script. It now ...
r1612 link = pjoin(ip_start_menu, 'IPython.lnk')
cmd = '"%s"' % ipybase
Darren Dale
specify windows working directory...
r3227 mkshortcut(python, 'IPython', link, cmd, workdir)
Brian Granger
Completely fixed the ipython_win_post_install.py script. It now ...
r1612
MinRK
restore interactive/shell doc with warning...
r4148 # Disable pysh Start item until the profile restores functionality
# Most of this code is in IPython/deathrow, and needs to be updated
# to 0.11 APIs
# link = pjoin(ip_start_menu, 'pysh.lnk')
# cmd = '"%s" profile=pysh --init' % ipybase
# mkshortcut(python, 'IPython (command prompt mode)', link, cmd, workdir)
Brian Granger
Completely fixed the ipython_win_post_install.py script. It now ...
r1612
Min RK
wininst post install script updated and requires setuptools...
r4094 link = pjoin(ip_start_menu, 'pylab.lnk')
MinRK
fix pylab StartMenu item
r5685 cmd = '"%s" --pylab' % ipybase
mkshortcut(python, 'IPython (pylab mode)', link, cmd, workdir)
Fernando Perez
Remove test suite from win32 start menu....
r2114
Brian Granger
Completely fixed the ipython_win_post_install.py script. It now ...
r1612 link = pjoin(ip_start_menu, 'ipcontroller.lnk')
MinRK
py3 fixes for win_post_install.py
r5680 cmdbase = suffix(pjoin(scripts, 'ipcontroller'))
Min RK
wininst post install script updated and requires setuptools...
r4094 if have_setuptools:
cmdbase += '-script.py'
cmd = '"%s"' % cmdbase
Darren Dale
specify windows working directory...
r3227 mkshortcut(python, 'IPython controller', link, cmd, workdir)
Brian Granger
Tried to fix the windows post install script. It now creates...
r1611
Brian Granger
Completely fixed the ipython_win_post_install.py script. It now ...
r1612 link = pjoin(ip_start_menu, 'ipengine.lnk')
MinRK
py3 fixes for win_post_install.py
r5680 cmdbase = suffix(pjoin(scripts, 'ipengine'))
Min RK
wininst post install script updated and requires setuptools...
r4094 if have_setuptools:
cmdbase += '-script.py'
cmd = '"%s"' % cmdbase
Darren Dale
specify windows working directory...
r3227 mkshortcut(python, 'IPython engine', link, cmd, workdir)
Min RK
wininst post install script updated and requires setuptools...
r4094
link = pjoin(ip_start_menu, 'ipythonqt.lnk')
MinRK
remove `ipython-qtconsole` gui-script...
r7676 cmdbase = suffix(pjoin(scripts, 'ipython'))
Min RK
wininst post install script updated and requires setuptools...
r4094 if have_setuptools:
MinRK
remove `ipython-qtconsole` gui-script...
r7676 cmdbase += '-script.py'
cmd = '"%s" qtconsole' % cmdbase
Min RK
wininst post install script updated and requires setuptools...
r4094 mkshortcut(pythonw, 'IPython Qt Console', link, cmd, workdir)
Fernando Perez
Keep mention of HTML docs shortcut but commented out as a FIXME....
r6609
# FIXME: These below are commented out because we don't ship the html built
# docs anymore. We should make the shortcut to continue existing, but as a
# URL to the online the docs for the right version of IPython. The stable
# URLs have the pattern:
# http://ipython.org/ipython-doc/rel-X.Y.Z/html
# For IPython version X.Y.Z.
Brian Granger
Tried to fix the windows post install script. It now creates...
r1611
Fernando Perez
Keep mention of HTML docs shortcut but commented out as a FIXME....
r6609 ## # Create documentation shortcuts ...
## t = prefix + r'\share\doc\ipython\manual\index.html'
## f = ip_start_menu + r'\Manual in HTML.lnk'
## mkshortcut(t,'IPython Manual - HTML-Format',f)
Ville M. Vainio
crlf -> lf
r1032
def remove():
"""Routine to be run by the win32 installer with the -remove switch."""
pass
Fernando Perez
Disable PDF manual building for distribution and installation....
r4453
Ville M. Vainio
crlf -> lf
r1032 # main()
if len(sys.argv) > 1:
if sys.argv[1] == '-install':
MinRK
py3 fixes for win_post_install.py
r5680 try:
install()
except OSError:
print("Failed to create Start Menu items, try running installer as administrator.", file=sys.stderr)
Ville M. Vainio
crlf -> lf
r1032 elif sys.argv[1] == '-remove':
remove()
else:
MinRK
py3 fixes for win_post_install.py
r5680 print("Script was called with option %s" % sys.argv[1], file=sys.stderr)