Repository: spyder-ide/spyder
Pull request: PR: debugpy is not zip compatible (macOS app)
## Description of Changes

Ensured that `debugpy` is bundled outside zip folder in macOS application.

### Issue(s) Resolved

<!--- List the issue(s) below, in the form "Fixes #1234"; one per line --->

Fixes #16336


### Affirmation

By submitting this Pull Request or typing my (user)name below,
I affirm the [Developer Certificate of Origin](https://developercertificate.org)
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.

<!--- TYPE YOUR USER/NAME AFTER THE FOLLOWING: --->
I certify the above statement is true and correct: @mrclary 

<!--- Thanks for your help making Spyder better for everyone! --->


Problem statement:
5.1.2 Mac installer broken?
### What steps will reproduce the problem?

<!--- You can use Markdown here --->

I installed the update (my first update after installing and working with Spyder for the last 2 days). In the update, the kernel will not load (macOS Catalina):

NotADirectoryError: [Errno 20] Not a directory: '/Applications/Spyder.app/Contents/Resources/lib/python39.zip/debugpy/_vendored'

Hints from issue discussion:
Hey @gctwnl, thanks for reporting. That's a problem with the Mac installer only.

@mrclary, could you take a look at this one? 
installs fine but fails 'cannot load kernel'.

Commit message: * debugpy is not zip compatible. "NotADirectoryError: [Errno 20] Not a directory: '.../Spyder.app/Contents/Resources/lib/python39.zip/debugpy/_vendored'"

Patch to review:
diff --git a/installers/macOS/setup.py b/installers/macOS/setup.py
index bb06b1b293f..35ca976f738 100644
--- a/installers/macOS/setup.py
+++ b/installers/macOS/setup.py
@@ -68,6 +68,9 @@ def make_app_bundle(dist_dir, make_lite=False):
         File "<frozen zipimport>", line 177, in get_data
         KeyError: 'blib2to3/Users/rclary/Library/Caches/black/20.8b1/
         Grammar3.8.6.final.0.pickle'
+    debugpy :
+        NotADirectoryError: [Errno 20] Not a directory:
+        '<path>/Resources/lib/python39.zip/debugpy/_vendored'
     docutils :
         [Errno 20] Not a directory: '<path>/Resources/lib/python39.zip/
         docutils/writers/latex2e/docutils.sty'
@@ -150,6 +153,7 @@ def make_app_bundle(dist_dir, make_lite=False):
                 'pylsp', 'pylsp_black', 'pyls_spyder', 'qtawesome',
                 'setuptools', 'sphinx', 'spyder', 'spyder_kernels',
                 'textdistance',
+                'debugpy',
                 ]
     INCLUDES = ['_sitebuiltins',  # required for IPython help()
                 # required for sphinx


Code review comments:
diff_hunk: @@ -150,6 +153,7 @@ def make_app_bundle(dist_dir, make_lite=False):
                 'pylsp', 'pylsp_black', 'pyls_spyder', 'qtawesome',
                 'setuptools', 'sphinx', 'spyder', 'spyder_kernels',
                 'textdistance',
+                'debugpy',
path: installers/macOS/setup.py
text: @user1:
```suggestion
                'textdistance', 'debugpy',
```