Repository: napari/napari

Issue:
mac thinks that napari is named "__main__.py" in bundled app
## 🐛 Bug

My mac seems to think that napari is named "__main__.py" in bundled app

## To Reproduce

Steps to reproduce the behavior:

1. Launch napari bundled app on mac
2. Click "napari" on menu bar
3. See the menu items "Hide __main__.py" and "Close __main__.py"

![image](https://user-images.githubusercontent.com/1245615/110528081-f6626e00-80d4-11eb-867b-2b3955d13957.png)

## Expected behavior

menu items include "Hide napari" and "Close napari", similar to Chrome...

<!-- A clear and concise description of what you expected to happen. -->
![image](https://user-images.githubusercontent.com/1245615/110528760-bc459c00-80d5-11eb-8ca8-0f04c3247ea1.png)

## Environment

napari: 0.4.6
Platform: macOS-10.15.7-x86_64-i386-64bit
System: MacOS 10.15.7
Python: 3.8.7 (default, Jan 2 2021, 04:16:43) [Clang 11.0.0 (clang-1100.0.33.17)]
Qt: 5.15.2
PySide2: 5.15.2
NumPy: 1.19.3
SciPy: 1.6.1
Dask: 2021.03.0
VisPy: 0.6.6

OpenGL:
- GL version: 2.1 ATI-3.10.19
- MAX_TEXTURE_SIZE: 16384

Screens:
- screen 1: resolution 1792x1120, scale 2.0
- screen 2: resolution 2560x1440, scale 1.0

Plugins:
- affinder: 0.1.0
- aicsimageio: 0.2.0
- aicsimageio_delayed: 0.2.0
- brainreg: 0.2.3
- brainreg_standard: 0.2.3
- cellfinder: 0.2.1
- console: 0.0.3
- napari-hdf5-labels-io: 0.2.dev1
- ndtiffs: 0.1.1
- svg: 0.1.4



Discussion:

Resolving patch:
diff --git a/bundle.py b/bundle.py
--- a/bundle.py
+++ b/bundle.py
@@ -87,9 +87,9 @@ def patched_toml():
     toml['tool']['briefcase']['app'][APP]['requires'] = requirements
     toml['tool']['briefcase']['version'] = VERSION
 
-    print("patching pyroject.toml to version: ", VERSION)
+    print("patching pyproject.toml to version: ", VERSION)
     print(
-        "patching pyroject.toml requirements to : \n",
+        "patching pyproject.toml requirements to : \n",
         "\n".join(toml['tool']['briefcase']['app'][APP]['requires']),
     )
     with open(PYPROJECT_TOML, 'w') as f:
@@ -107,15 +107,14 @@ def patch_dmgbuild():
         return
     from dmgbuild import core
 
-    # will not be required after dmgbuild > v1.3.3
-    # see https://github.com/al45tair/dmgbuild/pull/18
     with open(core.__file__) as f:
         src = f.read()
     with open(core.__file__, 'w') as f:
         f.write(
             src.replace(
                 "shutil.rmtree(os.path.join(mount_point, '.Trashes'), True)",
-                "shutil.rmtree(os.path.join(mount_point, '.Trashes'), True);time.sleep(30)",
+                "shutil.rmtree(os.path.join(mount_point, '.Trashes'), True)"
+                ";time.sleep(30)",
             )
         )
         print("patched dmgbuild.core")
@@ -201,6 +200,7 @@ def bundle():
     # smoke test, and build resources
     subprocess.check_call([sys.executable, '-m', APP, '--info'])
 
+    # the briefcase calls need to happen while the pyproject toml is patched
     with patched_toml():
         # create
         cmd = ['briefcase', 'create'] + (['--no-docker'] if LINUX else [])
@@ -213,20 +213,20 @@ def bundle():
         if WINDOWS:
             patch_wxs()
 
-    # build
-    cmd = ['briefcase', 'build'] + (['--no-docker'] if LINUX else [])
-    subprocess.check_call(cmd)
+        # build
+        cmd = ['briefcase', 'build'] + (['--no-docker'] if LINUX else [])
+        subprocess.check_call(cmd)
 
-    # package
-    cmd = ['briefcase', 'package']
-    cmd += ['--no-sign'] if MACOS else (['--no-docker'] if LINUX else [])
-    subprocess.check_call(cmd)
+        # package
+        cmd = ['briefcase', 'package']
+        cmd += ['--no-sign'] if MACOS else (['--no-docker'] if LINUX else [])
+        subprocess.check_call(cmd)
 
-    # compress
-    dest = make_zip()
-    clean()
+        # compress
+        dest = make_zip()
+        clean()
 
-    return dest
+        return dest
 
 
 if __name__ == "__main__":


Test patch: