Skip to content

Commit c502a48

Browse files
committed
Use Apple's preferred capitalization where possible.
1 parent ea895e1 commit c502a48

21 files changed

+226
-128
lines changed

docs/background/quickstart.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ http://setuptools.readthedocs.io/en/latest/setuptools.html#dynamic-discovery-of-
9696

9797
On Windows and Linux this allows for multiple executables to be defined.
9898
macOS will use the entry point with the same name as your `formal_name` as the
99-
main application, any others will be available in the Contents/MacOS folder inside the
99+
main application, any others will be available in the Contents/macOS folder inside the
100100
application bundle.
101101

102102
For other platforms the entry point is defined in the platform template, typically

setup.cfg

+14-14
Original file line numberDiff line numberDiff line change
@@ -72,34 +72,34 @@ console_scripts =
7272
briefcase.platforms =
7373
android = briefcase.platforms.android
7474
django = briefcase.platforms.django
75-
ios = briefcase.platforms.ios
75+
iOS = briefcase.platforms.iOS
7676
linux = briefcase.platforms.linux
77-
macos = briefcase.platforms.macos
78-
tvos = briefcase.platforms.tvos
79-
watchos = briefcase.platforms.watchos
77+
macOS = briefcase.platforms.macOS
78+
tvOS = briefcase.platforms.tvOS
79+
watchOS = briefcase.platforms.watchOS
8080
wearos = briefcase.platforms.wearos
8181
windows = briefcase.platforms.windows
8282
briefcase.formats.android =
8383
apk = briefcase.platforms.android.apk
8484
briefcase.formats.django =
8585
project = briefcase.platforms.django.project
8686
app = briefcase.platforms.django.app
87-
briefcase.formats.ios =
88-
xcode = briefcase.platforms.ios.xcode
87+
briefcase.formats.iOS =
88+
xcode = briefcase.platforms.iOS.xcode
8989
briefcase.formats.linux =
9090
appimage = briefcase.platforms.linux.appimage
9191
deb = briefcase.platforms.linux.deb
9292
flatpak = briefcase.platforms.linux.flatpak
9393
rpm = briefcase.platforms.linux.rpm
9494
snap = briefcase.platforms.linux.snap
95-
briefcase.formats.macos =
96-
app = briefcase.platforms.macos.app
97-
dmg = briefcase.platforms.macos.dmg
98-
homebrew = briefcase.platforms.macos.homebrew
99-
briefcase.formats.tvos =
100-
xcode = briefcase.platforms.tvos.xcode
101-
briefcase.formats.watchos =
102-
xcode = briefcase.platforms.watchos.xcode
95+
briefcase.formats.macOS =
96+
app = briefcase.platforms.macOS.app
97+
dmg = briefcase.platforms.macOS.dmg
98+
homebrew = briefcase.platforms.macOS.homebrew
99+
briefcase.formats.tvOS =
100+
xcode = briefcase.platforms.tvOS.xcode
101+
briefcase.formats.watchOS =
102+
xcode = briefcase.platforms.watchOS.xcode
103103
briefcase.formats.wearos =
104104
apk = briefcase.platforms.wearos.apk
105105
briefcase.formats.windows =

src/briefcase/cmdline.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,29 @@ def parse_cmdline(args):
4848
)
4949

5050
# <platform> *is* optional, with the default value based on the platform
51-
# that you're on. It also normalizes case so "macOS" can be used to find
52-
# the "macos" backend.
51+
# that you're on.
5352
platforms = get_platforms()
53+
54+
# To make the UX a little forgiving, we normalize *any* case to the case
55+
# actually used to register the platform. This function maps the lower-case
56+
# version of the registered name to the actual registered name.
57+
def normalize(name):
58+
return {
59+
n.lower(): n
60+
for n in platforms.keys()
61+
}.get(name.lower(), name)
62+
5463
parser.add_argument(
5564
'platform',
5665
choices=list(platforms.keys()),
5766
default={
58-
'darwin': 'macos',
67+
'darwin': 'macOS',
5968
'linux': 'linux',
6069
'win32': 'windows',
6170
}[sys.platform],
6271
metavar='platform',
6372
nargs='?',
64-
type=str.lower,
73+
type=normalize,
6574
help='The platform to target (one of %(choices)s; default: %(default)s',
6675
)
6776

src/briefcase/commands/create.py

+1
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,7 @@ def create_app(self, app: BaseConfig):
659659
app=app
660660
))
661661
shutil.rmtree(bundle_path)
662+
662663
print()
663664
print('[{app.name}] Generating application template...'.format(
664665
app=app

src/briefcase/platforms/__init__.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ def get_platforms():
1010

1111

1212
def get_output_formats(platform):
13+
# Entry point section identifiers (briefcase.formats.macos) are always
14+
# in lower case, regardless of how they're registered. However, the
15+
# actual entry point names preserve case.
1316
return {
1417
entry_point.name: entry_point.load()
1518
for entry_point
1619
in pkg_resources.iter_entry_points('briefcase.formats.{platform}'.format(
17-
platform=platform
20+
platform=platform.lower()
1821
))
1922
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
DEFAULT_OUTPUT_FORMAT = 'xcode'
3+
4+
5+
class iOSMixin:
6+
def __init__(self, output_format, *args, **kwargs):
7+
super().__init__(*args, platform='iOS', output_format=output_format, **kwargs)
8+
9+
def verify_tools(self):
10+
pass

src/briefcase/platforms/iOS/xcode.py

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import subprocess
2+
3+
from briefcase.config import BaseConfig
4+
from briefcase.commands import (
5+
BuildCommand,
6+
CreateCommand,
7+
PublishCommand,
8+
RunCommand,
9+
UpdateCommand
10+
)
11+
from briefcase.exceptions import BriefcaseCommandError
12+
from briefcase.platforms.iOS import iOSMixin
13+
14+
15+
class iOSAppMixin(iOSMixin):
16+
def __init__(self, *args, **kwargs):
17+
super().__init__(*args, output_format='app', **kwargs)
18+
19+
def binary_path(self, app):
20+
return self.platform_path / '{app.formal_name} / {app.formal_name}.xcodeproj'.format(app=app)
21+
22+
def bundle_path(self, app):
23+
return self.platform_path / '{app.formal_name}'.format(app=app)
24+
25+
26+
class iOSAppCreateCommand(iOSAppMixin, CreateCommand):
27+
description = "Create and populate a iOS Xcode project."
28+
29+
30+
class iOSAppUpdateCommand(iOSAppMixin, UpdateCommand):
31+
description = "Update an existing iOS Xcode project."
32+
33+
34+
class iOSAppBuildCommand(iOSAppMixin, BuildCommand):
35+
description = "Build an iOS Xcode project."
36+
37+
38+
class iOSAppRunCommand(iOSAppMixin, RunCommand):
39+
description = "Run an iOS Xcode project."
40+
41+
def run_app(self, app: BaseConfig):
42+
"""
43+
Start the application.
44+
45+
:param app: The config object for the app
46+
:param base_path: The path to the project directory.
47+
"""
48+
print()
49+
print('[{app.name}] Starting app...'.format(
50+
app=app
51+
))
52+
try:
53+
print()
54+
self.subprocess.run(
55+
[
56+
'open',
57+
self.binary_path(app),
58+
],
59+
check=True,
60+
)
61+
except subprocess.CalledProcessError:
62+
print()
63+
raise BriefcaseCommandError(
64+
"Unable to start app {app.name}.".format(app=app)
65+
)
66+
67+
68+
class iOSAppPublishCommand(iOSAppMixin, PublishCommand):
69+
description = "Publish an iOS app."
70+
publication_channels = ['ios_appstore']
71+
default_publication_channel = 'ios_appstore'
72+
73+
74+
# Declare the briefcase command bindings
75+
create = iOSAppCreateCommand # noqa
76+
update = iOSAppUpdateCommand # noqa
77+
build = iOSAppBuildCommand # noqa
78+
run = iOSAppRunCommand # noqa
79+
publish = iOSAppPublishCommand # noqa

src/briefcase/platforms/macos/__init__.py src/briefcase/platforms/macOS/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
DEFAULT_OUTPUT_FORMAT = 'app'
33

44

5-
class MacOSMixin:
5+
class macOSMixin:
66
def __init__(self, output_format, *args, **kwargs):
7-
super().__init__(*args, platform='macos', output_format=output_format, **kwargs)
7+
super().__init__(*args, platform='macOS', output_format=output_format, **kwargs)
88

99
def verify_tools(self):
1010
pass

src/briefcase/platforms/macos/app.py src/briefcase/platforms/macOS/app.py

+12-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import subprocess
2-
from pathlib import Path
32

43
from briefcase.config import BaseConfig
54
from briefcase.commands import (
@@ -10,10 +9,10 @@
109
UpdateCommand
1110
)
1211
from briefcase.exceptions import BriefcaseCommandError
13-
from briefcase.platforms.macos import MacOSMixin
12+
from briefcase.platforms.macOS import macOSMixin
1413

1514

16-
class MacOSAppMixin(MacOSMixin):
15+
class macOSAppMixin(macOSMixin):
1716
def __init__(self, *args, **kwargs):
1817
super().__init__(*args, output_format='app', **kwargs)
1918

@@ -24,19 +23,19 @@ def bundle_path(self, app):
2423
return self.platform_path / '{app.formal_name}.app'.format(app=app)
2524

2625

27-
class MacOSAppCreateCommand(MacOSAppMixin, CreateCommand):
26+
class macOSAppCreateCommand(macOSAppMixin, CreateCommand):
2827
description = "Create and populate a macOS .app bundle."
2928

3029

31-
class MacOSAppUpdateCommand(MacOSAppMixin, UpdateCommand):
30+
class macOSAppUpdateCommand(macOSAppMixin, UpdateCommand):
3231
description = "Update an existing macOS .app bundle."
3332

3433

35-
class MacOSAppBuildCommand(MacOSAppMixin, BuildCommand):
34+
class macOSAppBuildCommand(macOSAppMixin, BuildCommand):
3635
description = "Build a macOS .app bundle."
3736

3837

39-
class MacOSAppRunCommand(MacOSAppMixin, RunCommand):
38+
class macOSAppRunCommand(macOSAppMixin, RunCommand):
4039
description = "Run a macOS .app bundle."
4140

4241
def run_app(self, app: BaseConfig):
@@ -66,13 +65,13 @@ def run_app(self, app: BaseConfig):
6665
)
6766

6867

69-
class MacOSAppPublishCommand(MacOSAppMixin, PublishCommand):
68+
class macOSAppPublishCommand(macOSAppMixin, PublishCommand):
7069
description = "Publish a macOS .app bundle."
7170

7271

7372
# Declare the briefcase command bindings
74-
create = MacOSAppCreateCommand # noqa
75-
update = MacOSAppUpdateCommand # noqa
76-
build = MacOSAppBuildCommand # noqa
77-
run = MacOSAppRunCommand # noqa
78-
publish = MacOSAppPublishCommand # noqa
73+
create = macOSAppCreateCommand # noqa
74+
update = macOSAppUpdateCommand # noqa
75+
build = macOSAppBuildCommand # noqa
76+
run = macOSAppRunCommand # noqa
77+
publish = macOSAppPublishCommand # noqa

src/briefcase/platforms/macos/dmg.py src/briefcase/platforms/macOS/dmg.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
RunCommand,
66
UpdateCommand
77
)
8-
from briefcase.platforms.macos import MacOSMixin
8+
from briefcase.platforms.macOS import macOSMixin
99

1010

11-
class MacOSDmgMixin(MacOSMixin):
11+
class macOSDmgMixin(macOSMixin):
1212
def __init__(self, *args, **kwargs):
1313
super().__init__(*args, output_format='dmg', **kwargs)
1414

@@ -19,23 +19,23 @@ def bundle_path(self, app):
1919
return self.platform_path / '{app.formal_name}.app'.format(app=app)
2020

2121

22-
class MacOSDmgCreateCommand(MacOSDmgMixin, CreateCommand):
22+
class macOSDmgCreateCommand(macOSDmgMixin, CreateCommand):
2323
description = "Create and populate a macOS .dmg bundle."
2424

2525

26-
class MacOSDmgUpdateCommand(MacOSDmgMixin, UpdateCommand):
26+
class macOSDmgUpdateCommand(macOSDmgMixin, UpdateCommand):
2727
description = "Update an existing macOS .dmg bundle."
2828

2929

30-
class MacOSDmgBuildCommand(MacOSDmgMixin, BuildCommand):
30+
class macOSDmgBuildCommand(macOSDmgMixin, BuildCommand):
3131
description = "Build a macOS .dmg bundle."
3232

3333

34-
class MacOSDmgRunCommand(MacOSDmgMixin, RunCommand):
34+
class macOSDmgRunCommand(macOSDmgMixin, RunCommand):
3535
description = "Run a macOS .dmg bundle."
3636

3737

38-
class MacOSDmgPublishCommand(MacOSDmgMixin, PublishCommand):
38+
class macOSDmgPublishCommand(macOSDmgMixin, PublishCommand):
3939
description = "Publish a macOS .dmg bundle."
4040

4141
def add_options(self):
@@ -50,8 +50,8 @@ def add_options(self):
5050

5151

5252
# Declare the briefcase command bindings
53-
create = MacOSDmgCreateCommand # noqa
54-
update = MacOSDmgUpdateCommand # noqa
55-
build = MacOSDmgBuildCommand # noqa
56-
run = MacOSDmgRunCommand # noqa
57-
publish = MacOSDmgPublishCommand # noqa
53+
create = macOSDmgCreateCommand # noqa
54+
update = macOSDmgUpdateCommand # noqa
55+
build = macOSDmgBuildCommand # noqa
56+
run = macOSDmgRunCommand # noqa
57+
publish = macOSDmgPublishCommand # noqa
File renamed without changes.
File renamed without changes.

src/briefcase/platforms/watchos/__init__.py

-2
This file was deleted.

src/briefcase/platforms/watchos/xcode.py

-1
This file was deleted.

0 commit comments

Comments
 (0)