2121
2222from __future__ import print_function
2323
24+ # Standard library imports
25+ from distutils .command .install_data import install_data
2426import io
2527import os
2628import os .path as osp
2729import subprocess
2830import sys
2931import shutil
3032
31- from distutils .core import setup
32- from distutils .command .install_data import install_data
33+ # Third party imports
34+ from setuptools import setup , find_packages
35+ from setuptools .command .install import install
3336
3437
35- #= =============================================================================
38+ # =============================================================================
3639# Check for Python 3
37- #= =============================================================================
40+ # =============================================================================
3841PY3 = sys .version_info [0 ] == 3
3942
4043
41- #= =============================================================================
44+ # =============================================================================
4245# Minimal Python version sanity check
4346# Taken from the notebook setup.py -- Modified BSD License
44- #= =============================================================================
47+ # =============================================================================
4548v = sys .version_info
4649if v [0 ] >= 3 and v [:2 ] < (3 , 6 ):
4750 error = "ERROR: Spyder 5 requires Python version 3.6 or above."
4851 print (error , file = sys .stderr )
4952 sys .exit (1 )
5053
5154
52- #= =============================================================================
55+ # =============================================================================
5356# Constants
54- #= =============================================================================
57+ # =============================================================================
5558NAME = 'spyder'
5659LIBNAME = 'spyder'
5760from spyder import __version__ , __website_url__ #analysis:ignore
5861
5962
60- #= =============================================================================
63+ # =============================================================================
6164# Auxiliary functions
62- #= =============================================================================
65+ # =============================================================================
6366def get_package_data (name , extlist ):
64- """Return data files for package *name* with extensions in *extlist*"""
67+ """
68+ Return data files for package *name* with extensions in *extlist*.
69+ """
6570 flist = []
6671 # Workaround to replace os.path.relpath (not available until Python 2.6):
6772 offset = len (name )+ len (os .pathsep )
@@ -75,17 +80,22 @@ def get_package_data(name, extlist):
7580
7681
7782def get_subpackages (name ):
78- """Return subpackages of package *name*"""
83+ """
84+ Return subpackages of package *name*.
85+ """
7986 splist = []
8087 for dirpath , _dirnames , _filenames in os .walk (name ):
8188 if 'tests' not in dirpath :
8289 if osp .isfile (osp .join (dirpath , '__init__.py' )):
8390 splist .append ("." .join (dirpath .split (os .sep )))
91+
8492 return splist
8593
8694
8795def get_data_files ():
88- """Return data_files in a platform dependent manner"""
96+ """
97+ Return data_files in a platform dependent manner.
98+ """
8999 if sys .platform .startswith ('linux' ):
90100 if PY3 :
91101 data_files = [('share/applications' , ['scripts/spyder3.desktop' ]),
@@ -99,19 +109,23 @@ def get_data_files():
99109 'img_src/spyder_reset.ico' ])]
100110 else :
101111 data_files = []
112+
102113 return data_files
103114
104115
105116def get_packages ():
106- """Return package list"""
117+ """
118+ Return package list.
119+ """
107120 packages = get_subpackages (LIBNAME )
108121 return packages
109122
110123
111- #==============================================================================
112- # Make Linux detect Spyder desktop file
113- #==============================================================================
114- class MyInstallData (install_data ):
124+ # =============================================================================
125+ # Make Linux detect Spyder desktop file (will not work with wheels)
126+ # =============================================================================
127+ class CustomInstallData (install_data ):
128+
115129 def run (self ):
116130 install_data .run (self )
117131 if sys .platform .startswith ('linux' ):
@@ -120,12 +134,14 @@ def run(self):
120134 except :
121135 print ("ERROR: unable to update desktop database" ,
122136 file = sys .stderr )
123- CMDCLASS = {'install_data' : MyInstallData }
124137
125138
126- #==============================================================================
139+ CMDCLASS = {'install_data' : CustomInstallData }
140+
141+
142+ # =============================================================================
127143# Main scripts
128- #= =============================================================================
144+ # =============================================================================
129145# NOTE: the '[...]_win_post_install.py' script is installed even on non-Windows
130146# platforms due to a bug in pip installation process
131147# See spyder-ide/spyder#1158.
@@ -139,17 +155,18 @@ def run(self):
139155if os .name == 'nt' :
140156 SCRIPTS += ['spyder.bat' ]
141157
142- #==============================================================================
158+
159+ # =============================================================================
143160# Files added to the package
144- #= =============================================================================
161+ # =============================================================================
145162EXTLIST = ['.pot' , '.po' , '.mo' , '.svg' , '.png' , '.css' , '.html' , '.js' ,
146163 '.ini' , '.txt' , '.qss' , '.ttf' , '.json' , '.rst' , '.bloom' ,
147164 '.ico' , '.gif' , '.mp3' , '.ogg' , '.sfd' , '.bat' , '.sh' ]
148165
149166
150- #= =============================================================================
167+ # =============================================================================
151168# Use Readme for long description
152- #= =============================================================================
169+ # =============================================================================
153170with io .open ('README.md' , encoding = 'utf-8' ) as f :
154171 LONG_DESCRIPTION = f .read ()
155172
@@ -165,7 +182,7 @@ def run(self):
165182 long_description_content_type = 'text/markdown' ,
166183 download_url = __website_url__ + "#fh5co-download" ,
167184 author = "The Spyder Project Contributors" ,
168- author_email = "spyderlib@googlegroups.com " ,
185+ author_email = "info@spyder-ide.org " ,
169186 url = __website_url__ ,
170187 license = 'MIT' ,
171188 keywords = 'PyQt5 editor console widgets IDE science data analysis IPython' ,
@@ -174,32 +191,26 @@ def run(self):
174191 package_data = {LIBNAME : get_package_data (LIBNAME , EXTLIST )},
175192 scripts = [osp .join ('scripts' , fname ) for fname in SCRIPTS ],
176193 data_files = get_data_files (),
177- classifiers = ['License :: OSI Approved :: MIT License' ,
178- 'Operating System :: MacOS ' ,
179- 'Operating System :: Microsoft :: Windows ' ,
180- 'Operating System :: POSIX :: Linux ' ,
181- 'Programming Language :: Python :: 2 ' ,
182- 'Programming Language :: Python :: 2.7 ' ,
183- 'Programming Language :: Python :: 3' ,
184- 'Programming Language :: Python :: 3.4 ' ,
185- 'Programming Language :: Python :: 3.5 ' ,
186- 'Programming Language :: Python :: 3.6 ' ,
187- 'Programming Language :: Python :: 3.7 ' ,
188- 'Development Status :: 5 - Production/Stable ' ,
189- 'Intended Audience :: Education ' ,
190- 'Intended Audience :: Science/Research ' ,
191- 'Intended Audience :: Developers ' ,
192- 'Topic :: Scientific/Engineering' ,
193- 'Topic :: Software Development :: Widget Sets' ] ,
194- cmdclass = CMDCLASS )
194+ classifiers = [
195+ 'License :: OSI Approved :: MIT License ' ,
196+ 'Operating System :: MacOS ' ,
197+ 'Operating System :: Microsoft :: Windows ' ,
198+ 'Operating System :: POSIX :: Linux ' ,
199+ 'Programming Language :: Python :: 3 ' ,
200+ 'Programming Language :: Python :: 3.6 ' ,
201+ 'Programming Language :: Python :: 3.7 ' ,
202+ 'Programming Language :: Python :: 3.8 ' ,
203+ 'Development Status :: 5 - Production/Stable ' ,
204+ 'Intended Audience :: Education ' ,
205+ 'Intended Audience :: Science/Research ' ,
206+ 'Intended Audience :: Developers ' ,
207+ 'Topic :: Scientific/Engineering ' ,
208+ 'Topic :: Software Development :: Widget Sets ' ,
209+ ] ,
210+ cmdclass = CMDCLASS ,
211+ )
195212
196213
197- #==============================================================================
198- # Setuptools deps
199- #==============================================================================
200- if any (arg == 'bdist_wheel' for arg in sys .argv ):
201- import setuptools # analysis:ignore
202-
203214install_requires = [
204215 'applaunchservices>=0.1.7;platform_system=="Darwin"' ,
205216 'atomicwrites>=1.2.0' ,
@@ -264,21 +275,49 @@ def run(self):
264275 ],
265276}
266277
267- if 'setuptools' in sys .modules :
268- setup_args ['install_requires' ] = install_requires
269- setup_args ['extras_require' ] = extras_require
270278
271- setup_args ['entry_points' ] = {
272- 'gui_scripts' : [
273- '{} = spyder.app.start:main' .format (
274- 'spyder3' if PY3 else 'spyder' )
275- ]
276- }
279+ spyder_plugins_entry_points = [
280+ 'appearance = spyder.plugins.appearance.plugin:Appearance' ,
281+ 'breakpoints = spyder.plugins.breakpoints.plugin:Breakpoints' ,
282+ 'code_completion = spyder.plugins.completions.plugin:CodeCompletion' ,
283+ 'core = spyder.plugins.core.plugin:Core' ,
284+ 'editor = spyder.plugins.editor.plugin:Editor' ,
285+ 'explorer = spyder.plugins.explorer.plugin:Explorer' ,
286+ 'fallback_completion = spyder.plugins.fallback.plugin:FallbackCompletion' ,
287+ 'findinfiles = spyder.plugins.findinfiles.plugin:FindInFiles' ,
288+ 'help = spyder.plugins.help.plugin:Help' ,
289+ 'history = spyder.plugins.history.plugin:HistoryLog' ,
290+ 'ipythonconsole = spyder.plugins.ipythonconsole.plugin:IPythonConsole' ,
291+ 'kite_completion = spyder.plugins.kite.plugin:LanguageServerCompletion' ,
292+ 'onlinehelp = spyder.plugins.onlinehelp.plugin:OnlineHelp' ,
293+ 'outlineexplorer = spyder.plugins.outlineexplorer.plugin:OutlineExplorer' ,
294+ 'plots = spyder.plugins.plots.plugin:Plots' ,
295+ 'profiler = spyder.plugins.profiler.plugin:Profiler' ,
296+ 'projects = spyder.plugins.projects.plugin:Projects' ,
297+ 'pylint = spyder.plugins.pylint.plugin:Pylint' ,
298+ ('lsp_completion = spyder.plugins.languageserver.plugin:'
299+ 'LanguageServerCompletion' ),
300+ 'python = spyder.plugins.python.plugin:Python' ,
301+ ('variableexplorer = spyder.plugins.variableexplorer.plugin:'
302+ 'VariableExplorer' ),
303+ ('workingdirectory = spyder.plugins.workingdirectory.plugin:'
304+ 'WorkingDirectory' ),
305+ ]
306+
277307
278- setup_args .pop ('scripts' , None )
308+ setup_args ['install_requires' ] = install_requires
309+ setup_args ['extras_require' ] = extras_require
310+ setup_args ['entry_points' ] = {
311+ 'gui_scripts' : [
312+ '{} = spyder.app.start:main' .format (
313+ 'spyder3' if PY3 else 'spyder' )
314+ ],
315+ 'spyder.plugins' : spyder_plugins_entry_points ,
316+ }
317+ setup_args .pop ('scripts' , None )
279318
280319
281- #= =============================================================================
320+ # =============================================================================
282321# Main setup
283- #= =============================================================================
322+ # =============================================================================
284323setup (** setup_args )
0 commit comments