Skip to content

Commit

Permalink
Merge from 3.x: PR #3541
Browse files Browse the repository at this point in the history
Fixes #2284
Fixes #3454
  • Loading branch information
ccordoba12 committed Oct 15, 2016
2 parents fde0388 + 5d39c55 commit ec05a07
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 17 deletions.
51 changes: 35 additions & 16 deletions create_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from IPython.core.completerlib import module_list

from spyder import __version__ as spy_version
from spyder.config.main import EDIT_EXT
from spyder.config.utils import EDIT_FILETYPES, _get_extensions
from spyder.config.base import MAC_APP_NAME
from spyder.utils.programs import find_program

Expand Down Expand Up @@ -64,6 +64,26 @@ def get_stdlib_modules():
return modules


#==============================================================================
# Main message
#==============================================================================
main_message = """
IMPORTANT NOTE
==============
Before running this script, please be sure of following the instructions
present in
https://github.com/spyder-ide/mac-application/blob/master/How to build the app.md
This script only runs succesfully with those instructions!
------
"""

print(main_message)


#==============================================================================
# App creation
#==============================================================================
Expand All @@ -73,17 +93,18 @@ def get_stdlib_modules():
APP = [APP_MAIN_SCRIPT]
DEPS = ['pylint', 'logilab', 'astroid', 'pep8', 'setuptools']
EXCLUDES = DEPS + ['mercurial']
PACKAGES = ['spyder', 'spyderplugins', 'sphinx', 'jinja2', 'docutils',
PACKAGES = ['spyder', 'spyder_breakpoints', 'spyder_io_dcm', 'spyder_io_hdf5',
'spyder_profiler', 'spyder_pylint', 'sphinx', 'jinja2', 'docutils',
'alabaster', 'babel', 'snowballstemmer', 'sphinx_rtd_theme',
'IPython', 'ipykernel', 'ipython_genutils', 'jupyter_client',
'jupyter_core', 'traitlets', 'qtconsole', 'pexpect',
'jsonschema', 'nbconvert', 'nbformat',
'zmq', 'pygments', 'rope', 'distutils', 'PIL', 'PyQt4',
'jupyter_core', 'traitlets', 'qtconsole', 'pexpect', 'jedi',
'jsonschema', 'nbconvert', 'nbformat', 'qtpy', 'qtawesome',
'zmq', 'pygments', 'rope', 'distutils', 'PIL', 'PyQt5',
'sklearn', 'skimage', 'pandas', 'sympy', 'pyflakes', 'psutil',
'nose', 'patsy','statsmodels', 'seaborn', 'networkx']

INCLUDES = get_stdlib_modules()
EDIT_EXT = [ext[1:] for ext in EDIT_EXT]
EDIT_EXT = [ext[1:] for ext in _get_extensions(EDIT_FILETYPES)]

OPTIONS = {
'argv_emulation': True,
Expand Down Expand Up @@ -130,7 +151,8 @@ def get_stdlib_modules():
# inside the app.
minimal_lib = osp.join(app_python_lib, 'minimal-lib')
os.mkdir(minimal_lib)
minlib_pkgs = ['spyder', 'spyderplugins']
minlib_pkgs = ['spyder', 'spyder_breakpoints', 'spyder_io_dcm',
'spyder_io_hdf5', 'spyder_profiler', 'spyder_pylint']
for p in minlib_pkgs:
shutil.copytree(osp.join(app_python_lib, p), osp.join(minimal_lib, p))

Expand All @@ -156,10 +178,10 @@ def get_stdlib_modules():
shutil.copy2(osp.join(system_python_lib, i),
osp.join(app_python_lib, i))

# Copy dependencies for IPython/Jupyter
IPYDEPS = ['path.py', 'simplegeneric.py', 'decorator.py', 'mistune.py',
'mistune.so', 'pickleshare.py']
for dep in IPYDEPS:
# Single file dependencies
SINGLE_DEPS = ['path.py', 'simplegeneric.py', 'decorator.py', 'mistune.py',
'mistune.so', 'pickleshare.py', 'sip.so']
for dep in SINGLE_DEPS:
if osp.isfile(osp.join(system_python_lib, dep)):
shutil.copyfile(osp.join(system_python_lib, dep),
osp.join(app_python_lib, dep))
Expand All @@ -176,9 +198,9 @@ def _change_interpreter(program):
try:
for line in fileinput.input(program, inplace=True):
if line.startswith('#!'):
print('#!' + sys.executable)
print('#!' + sys.executable, end='')
else:
print(line)
print(line, end='')
except:
pass
Expand Down Expand Up @@ -250,9 +272,6 @@ def _get_env():
else:
print(line, end='')

# To use the app's own Qt framework
subprocess.call(['macdeployqt', 'dist/%s' % MAC_APP_NAME])

# Workaround for what appears to be a bug with py2app and Homebrew
# See https://bitbucket.org/ronaldoussoren/py2app/issue/26#comment-2092445
PF_dir = get_config_var('PYTHONFRAMEWORKINSTALLDIR')
Expand Down
2 changes: 1 addition & 1 deletion spyder/utils/site/sitecustomize.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def write(self, text):
if sys.platform == 'darwin':
from spyder.config.base import MAC_APP_NAME
if MAC_APP_NAME in __file__:
if IS_EXT_INTERPRETER.lower() == "true":
if IS_EXT_INTERPRETER:
# Add a minimal library (with spyder) at the end of sys.path to
# be able to connect our monitor to the external console
py_ver = '%s.%s' % (sys.version_info[0], sys.version_info[1])
Expand Down

0 comments on commit ec05a07

Please sign in to comment.