1#-----------------------------------------------------------------------------
2# Copyright (c) 2013-2019, PyInstaller Development Team.
3#
4# Distributed under the terms of the GNU General Public License with exception
5# for distributing bootloader.
6#
7# The full license is in the file COPYING.txt, distributed with this software.
8#-----------------------------------------------------------------------------
9
10from __future__ import print_function
11
12import sys
13print("Argv from python:", sys.argv)
14
15
16# Testing the argv capturing capability on the Mac is not that easy, but doable.  First, build the app bundle
17# with PyInstaller, like this:
18#
19# python $path_to_your_pyinstaller/pyinstaller.py -w -d test_argv_emulation.py
20#
21# The result should be test_argv_emulation.app.  Then, create a file called Info.plist and place the attached
22# text into it, and copy it to test_argv_emulation.app/Contents/.  Finally, create a file called "a.foo", and drag/drop that
23# file onto the test_argv_emulation.app's icon in the Finder.  The app will very briefly run, and should print an output to
24# stdout, which is viewable in the Mac's Console app.  The output should read something like:
25#
26#   Argv from python: ['/the/path/to/the/app','/the/path/to/the/file/a.foo']
27#
28# The Mac's Console app is not terminal. Mac's Console app is a log viewer of system's messages.
29# This app can be found in your Applications (icon in the taskbar), then utilities, then Console.app.
30#   http://en.wikipedia.org/wiki/Console_(OS_X)
31
32
33"""
34<?xml version="1.0" encoding="UTF-8"?>
35<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
36<plist version="1.0">
37<dict>
38        <key>CFBundleDevelopmentRegion</key>
39        <string>English</string>
40        <key>CFBundleDisplayName</key>
41        <string>test_argv_emulation</string>
42        <key>CFBundleDocumentTypes</key>
43        <array>
44                <dict>
45                        <key>CFBundleTypeExtensions</key>
46                        <array>
47                                <string>foo</string>
48                        </array>
49                        <key>CFBundleTypeName</key><string>Foo Test Document</string>
50                        <key>CFBundleTypeRole</key>
51                        <string>Viewer</string>
52                </dict>
53        </array>
54        <key>CFBundleExecutable</key>
55        <string>test_argv_emulation</string>
56        <key>CFBundleIdentifier</key>
57        <string>org.pythonmac.unspecified.test_argv_emulation</string>
58        <key>CFBundleInfoDictionaryVersion</key>
59        <string>6.0</string>
60        <key>CFBundleName</key>
61        <string>test_argv_emulation</string>
62        <key>CFBundlePackageType</key>
63        <string>APPL</string>
64        <key>CFBundleShortVersionString</key>
65        <string>0.0.0</string>
66        <key>CFBundleSignature</key>
67        <string>????</string>
68        <key>CFBundleVersion</key>
69        <string>0.0.0</string>
70        <key>LSHasLocalizedDisplayName</key>
71        <false/>
72        <key>NSHumanReadableCopyright</key>
73        <string>Copyright not specified</string>
74        <key>NSMainNibFile</key>
75        <string>MainMenu</string>
76        <key>NSPrincipalClass</key>
77        <string>NSApplication</string>
78</dict>
79</plist>
80"""
81