Skip to content

Commit 43bf232

Browse files
committed
setup.py: code cleaning (moved .ico files to a dedicaded folder in 'spyderlib')
Also fixing this error when building Spyder on Py3: SyntaxError: invalid or missing encoding declaration for 'scripts\\spyder.ico'
1 parent cba1fee commit 43bf232

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

scripts/spyder_win_post_install.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,21 @@ def install():
2222
python = osp.join(sys.prefix, 'python.exe')
2323
script = osp.join(sys.prefix, 'scripts', 'spyder')
2424
workdir = "%HOMEDRIVE%%HOMEPATH%"
25+
import distutils.sysconfig
26+
lib_dir = distutils.sysconfig.get_python_lib(plat_specific=1)
27+
ico_dir = osp.join(lib_dir, 'spyderlib', 'windows')
2528

2629
desc = 'Scientific Python Development EnvironmEnt, an alternative to IDLE'
2730
fname = osp.join(start_menu, 'Spyder (full).lnk')
28-
iconpath = osp.join(sys.prefix, 'scripts', 'spyder.ico')
29-
create_shortcut(python, desc, fname, '"%s"' % script, workdir, iconpath)
31+
create_shortcut(python, desc, fname, '"%s"' % script, workdir,
32+
osp.join(ico_dir, 'spyder.ico'))
3033
file_created(fname)
3134

3235
desc += '. Light configuration: console and variable explorer only.'
3336
fname = osp.join(start_menu, 'Spyder (light).lnk')
34-
iconpath = osp.join(sys.prefix, 'scripts', 'spyder_light.ico')
3537
create_shortcut(python, desc, fname,
36-
'"%s" --light' % script, workdir, iconpath)
38+
'"%s" --light' % script, workdir,
39+
osp.join(ico_dir, 'spyder_light.ico'))
3740
file_created(fname)
3841

3942
fname = osp.join(start_menu, 'Spyder-Reset all settings.lnk')

setup.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,14 @@ def get_packages():
8585
if osp.isdir(name):
8686
packages += get_subpackages(name)
8787
return packages
88-
8988

9089
# Note: the '[...]_win_post_install.py' script is installed even on non-Windows
9190
# platforms due to a bug in pip installation process (see Issue 1158)
9291
SCRIPTS = ['spyder', '%s_win_post_install.py' % NAME]
92+
EXTLIST = ['.mo', '.svg', '.png', '.css', '.html', '.js']
9393
if os.name == 'nt':
94-
SCRIPTS += ['spyder.bat', 'spyder.ico', 'spyder_light.ico']
94+
SCRIPTS += ['spyder.bat']
95+
EXTLIST += ['.ico']
9596

9697
# Adding a message for the bdist_wininst installer
9798
WININST_MSG = ""
@@ -118,12 +119,9 @@ def get_packages():
118119
keywords='PyQt4 PySide editor shell console widgets IDE',
119120
platforms=['any'],
120121
packages=get_packages(),
121-
package_data={LIBNAME:
122-
get_package_data(LIBNAME, ('.mo', '.svg', '.png', '.css',
123-
'.html', '.js')),
122+
package_data={LIBNAME: get_package_data(LIBNAME, EXTLIST),
124123
'spyderplugins':
125-
get_package_data('spyderplugins',
126-
('.mo', '.svg', '.png'))},
124+
get_package_data('spyderplugins', EXTLIST)},
127125
requires=["rope (>=0.9.2)", "sphinx (>=0.6.0)", "PyQt4 (>=4.4)"],
128126
scripts=[osp.join('scripts', fname) for fname in SCRIPTS],
129127
options={"bdist_wininst":
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)