Skip to content

Commit

Permalink
Merge pull request #291 from freakboy3742/paths
Browse files Browse the repository at this point in the history
Updates to packaging metadata following usage in Toga
  • Loading branch information
freakboy3742 authored Jan 1, 2020
2 parents d6625f5 + 6cf09e6 commit 3d7d97a
Show file tree
Hide file tree
Showing 25 changed files with 162 additions and 162 deletions.
4 changes: 2 additions & 2 deletions src/briefcase/commands/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,11 @@ def app_module_path(self, app):
path = Path(str(self.base_path), *app_home[0])
else:
raise BriefcaseCommandError(
"Multiple paths in sources found for application '{app.name}'".format(app=app)
"Multiple paths in sources found for application '{app.app_name}'".format(app=app)
)
except IndexError:
raise BriefcaseCommandError(
"Unable to find code for application '{app.name}'".format(app=app)
"Unable to find code for application '{app.app_name}'".format(app=app)
)

return path
Expand Down
2 changes: 1 addition & 1 deletion src/briefcase/commands/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _build_app(self, app: BaseConfig, update: bool, **kwargs):
state = self.build_app(app, **full_kwargs(state, kwargs))

print()
print("[{app.name}] Built {filename}".format(
print("[{app.app_name}] Built {filename}".format(
app=app,
filename=self.binary_path(app).relative_to(self.base_path),
))
Expand Down
24 changes: 12 additions & 12 deletions src/briefcase/commands/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ def write_dist_info(app: BaseConfig, dist_info_path: Path):
f.write('briefcase\n')
with (dist_info_path / 'METADATA').open('w') as f:
f.write('Metadata-Version: 2.1\n')
f.write('Name: {app.name}\n'.format(app=app))
f.write('Name: {app.app_name}\n'.format(app=app))
f.write('Formal-Name: {app.formal_name}\n'.format(app=app))
f.write('Bundle: {app.bundle}\n'.format(app=app))
f.write('App-ID: {app.bundle}.{app.app_name}\n'.format(app=app))
f.write('Version: {app.version}\n'.format(app=app))
if app.url:
f.write('Home-page: {app.url}\n'.format(app=app))
Expand Down Expand Up @@ -488,7 +488,7 @@ def install_app_code(self, app: BaseConfig):
else:
self.shutil.copy(str(original), str(target))
else:
print("No sources defined for {app.name}.".format(app=app))
print("No sources defined for {app.app_name}.".format(app=app))

# Write the dist-info folder for the application.
write_dist_info(
Expand Down Expand Up @@ -588,52 +588,52 @@ def create_app(self, app: BaseConfig, **kwargs):
bundle_path = self.bundle_path(app)
if bundle_path.exists():
print()
confirm = self.input('Application {app.name} already exists; overwrite (y/N)? '.format(
confirm = self.input('Application {app.app_name} already exists; overwrite (y/N)? '.format(
app=app
))
if confirm.lower() != 'y':
print("Aborting creation of app {app.name}".format(
print("Aborting creation of app {app.app_name}".format(
app=app
))
return
print()
print("[{app.name}] Removing old application bundle...".format(
print("[{app.app_name}] Removing old application bundle...".format(
app=app
))
self.shutil.rmtree(str(bundle_path))

print()
print('[{app.name}] Generating application template...'.format(
print('[{app.app_name}] Generating application template...'.format(
app=app
))
self.generate_app_template(app=app)

print()
print('[{app.name}] Installing support package...'.format(
print('[{app.app_name}] Installing support package...'.format(
app=app
))
self.install_app_support_package(app=app)

print()
print('[{app.name}] Installing dependencies...'.format(
print('[{app.app_name}] Installing dependencies...'.format(
app=app
))
self.install_app_dependencies(app=app)

print()
print('[{app.name}] Installing application code...'.format(
print('[{app.app_name}] Installing application code...'.format(
app=app
))
self.install_app_code(app=app)

print()
print('[{app.name}] Installing application resources...'.format(
print('[{app.app_name}] Installing application resources...'.format(
app=app
))
self.install_app_resources(app=app)
print()

print("[{app.name}] Created {filename}".format(
print("[{app.app_name}] Created {filename}".format(
app=app,
filename=self.bundle_path(app).relative_to(self.base_path),
))
Expand Down
6 changes: 3 additions & 3 deletions src/briefcase/commands/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def run_dev_app(self, app: BaseConfig, **kwargs):
except subprocess.CalledProcessError:
print()
raise BriefcaseCommandError(
"Unable to start application '{app.name}'".format(
"Unable to start application '{app.app_name}'".format(
app=app
))

Expand Down Expand Up @@ -132,14 +132,14 @@ def __call__(
dist_info_path = self.app_module_path(app).parent / '{app.module_name}.dist-info'.format(app=app)
if update_dependencies or not dist_info_path.exists():
print()
print('[{app.name}] Installing dependencies...'.format(
print('[{app.app_name}] Installing dependencies...'.format(
app=app
))
self.install_dev_dependencies(app, **kwargs)
write_dist_info(app, dist_info_path)

print()
print('[{app.name}] Starting in dev mode...'.format(
print('[{app.app_name}] Starting in dev mode...'.format(
app=app
))
state = self.run_dev_app(app, **kwargs)
Expand Down
10 changes: 5 additions & 5 deletions src/briefcase/commands/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,33 @@ def update_app(self, app: BaseConfig, update_dependencies=False, update_resource
bundle_path = self.bundle_path(app)
if not bundle_path.exists():
print()
print("[{app.name}] Application does not exist; call create first!".format(
print("[{app.app_name}] Application does not exist; call create first!".format(
app=app
))
return

if update_dependencies:
print()
print('[{app.name}] Updating dependencies...'.format(
print('[{app.app_name}] Updating dependencies...'.format(
app=app
))
self.install_app_dependencies(app=app)

print()
print('[{app.name}] Updating application code...'.format(
print('[{app.app_name}] Updating application code...'.format(
app=app
))
self.install_app_code(app=app)

if update_resources:
print()
print('[{app.name}] Updating extra application resources...'.format(
print('[{app.app_name}] Updating extra application resources...'.format(
app=app
))
self.install_app_resources(app=app)

print()
print('[{app.name}] Application updated.'.format(
print('[{app.app_name}] Application updated.'.format(
app=app
))

Expand Down
22 changes: 11 additions & 11 deletions src/briefcase/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __repr__(self):
class AppConfig(BaseConfig):
def __init__(
self,
name,
app_name,
version,
bundle,
description,
Expand All @@ -92,12 +92,12 @@ def __init__(
):
super().__init__(**kwargs)

self.name = name
self.app_name = app_name
self.version = version
self.bundle = bundle
self.description = description
self.sources = sources
self.formal_name = name if formal_name is None else formal_name
self.formal_name = app_name if formal_name is None else formal_name
self.url = url
self.author = author
self.author_email = author_email
Expand All @@ -108,9 +108,9 @@ def __init__(
self.template = template

# Validate that the app name is valid.
if not PEP508_NAME_RE.match(self.name):
if not PEP508_NAME_RE.match(self.app_name):
raise BriefcaseConfigError(
"{self.name!r} is not a valid app name.\n\n"
"{self.app_name!r} is not a valid app name.\n\n"
"App names must be PEP508 compliant (i.e., they can only "
"include letters, numbers, '-' and '_'; must start with a "
"letter; and cannot end with '-' or '_'.".format(self=self)
Expand All @@ -119,7 +119,7 @@ def __init__(
# Version number is PEP440 compliant:
if not is_pep440_canonical_version(self.version):
raise BriefcaseConfigError(
"Version number for {self.name} ({self.version}) is not valid.\n\n"
"Version number for {self.app_name} ({self.version}) is not valid.\n\n"
"Version numbers must be PEP440 compliant; "
"see https://www.python.org/dev/peps/pep-0440/ for details.".format(
self=self
Expand All @@ -130,19 +130,19 @@ def __init__(
source_modules = {source.rsplit('/', 1)[-1] for source in self.sources}
if len(self.sources) != len(source_modules):
raise BriefcaseConfigError(
"The `sources` list for {self.name} contains duplicated "
"The `sources` list for {self.app_name} contains duplicated "
"package names.".format(self=self)
)

# There is, at least, a source for the app module
if self.module_name not in source_modules:
raise BriefcaseConfigError(
"The `sources` list for {self.name} does not include a "
"The `sources` list for {self.app_name} does not include a "
"package named '{self.module_name}'.".format(self=self)
)

def __repr__(self):
return "<{self.bundle}.{self.name} v{self.version} AppConfig>".format(
return "<{self.bundle}.{self.app_name} v{self.version} AppConfig>".format(
self=self,
)

Expand All @@ -154,7 +154,7 @@ def module_name(self):
This is derived from the name, but:
* all `-` have been replaced with `_`.
"""
return self.name.replace('-', '_')
return self.app_name.replace('-', '_')


def merge_config(config, data):
Expand Down Expand Up @@ -278,7 +278,7 @@ def parse_config(config_file, platform, output_format):
config = copy.deepcopy(global_config)

# The app name is both the key, and a property of the configuration
config['name'] = app_name
config['app_name'] = app_name

# Merge the app-specific requirements
merge_config(config, app_data)
Expand Down
18 changes: 9 additions & 9 deletions src/briefcase/platforms/iOS/xcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def build_app(self, app: BaseConfig, udid=None, **kwargs):
))

print()
print('[{app.name}] Building XCode project...'.format(
print('[{app.app_name}] Building XCode project...'.format(
app=app
))

Expand Down Expand Up @@ -262,7 +262,7 @@ def build_app(self, app: BaseConfig, udid=None, **kwargs):
except subprocess.CalledProcessError:
print()
raise BriefcaseCommandError(
"Unable to build app {app.name}.".format(app=app)
"Unable to build app {app.app_name}.".format(app=app)
)

# Preserve the device selection as state.
Expand Down Expand Up @@ -352,8 +352,8 @@ def run_app(self, app: BaseConfig, udid=None, **kwargs):

# Try to uninstall the app first. If the app hasn't been installed
# before, this will still succeed.
app_identifier = '.'.join([app.bundle, app.name])
print('[{app.name}] Uninstalling old app version...'.format(
app_identifier = '.'.join([app.bundle, app.app_name])
print('[{app.app_name}] Uninstalling old app version...'.format(
app=app
))
try:
Expand All @@ -363,13 +363,13 @@ def run_app(self, app: BaseConfig, udid=None, **kwargs):
)
except subprocess.CalledProcessError:
raise BriefcaseCommandError(
"Unable to uninstall old version of app {app.name}.".format(
"Unable to uninstall old version of app {app.app_name}.".format(
app=app
)
)

# Install the app.
print('[{app.name}] Installing new app version...'.format(
print('[{app.app_name}] Installing new app version...'.format(
app=app
))
try:
Expand All @@ -379,12 +379,12 @@ def run_app(self, app: BaseConfig, udid=None, **kwargs):
)
except subprocess.CalledProcessError:
raise BriefcaseCommandError(
"Unable to install new version of app {app.name}.".format(
"Unable to install new version of app {app.app_name}.".format(
app=app
)
)

print('[{app.name}] Starting app...'.format(
print('[{app.app_name}] Starting app...'.format(
app=app
))
try:
Expand All @@ -394,7 +394,7 @@ def run_app(self, app: BaseConfig, udid=None, **kwargs):
)
except subprocess.CalledProcessError:
raise BriefcaseCommandError(
"Unable to launch app {app.name}.".format(
"Unable to launch app {app.app_name}.".format(
app=app
)
)
Expand Down
10 changes: 5 additions & 5 deletions src/briefcase/platforms/linux/appimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def build_app(self, app: BaseConfig, **kwargs):
:param app: The application to build
"""
print()
print("[{app.name}] Building AppImage...".format(app=app))
print("[{app.app_name}] Building AppImage...".format(app=app))

try:
print()
Expand All @@ -104,7 +104,7 @@ def build_app(self, app: BaseConfig, **kwargs):
str(self.linuxdeploy_appimage),
"--appdir={appdir_path}".format(appdir_path=appdir_path),
"-d", str(
appdir_path / "{app.bundle}.{app.name}.desktop".format(
appdir_path / "{app.bundle}.{app.app_name}.desktop".format(
app=app,
)
),
Expand All @@ -120,7 +120,7 @@ def build_app(self, app: BaseConfig, **kwargs):
except subprocess.CalledProcessError:
print()
raise BriefcaseCommandError(
"Error while building app {app.name}.".format(app=app)
"Error while building app {app.app_name}.".format(app=app)
)


Expand All @@ -135,7 +135,7 @@ def run_app(self, app: BaseConfig, **kwargs):
:param base_path: The path to the project directory.
"""
print()
print('[{app.name}] Starting app...'.format(
print('[{app.app_name}] Starting app...'.format(
app=app
))
try:
Expand All @@ -149,7 +149,7 @@ def run_app(self, app: BaseConfig, **kwargs):
except subprocess.CalledProcessError:
print()
raise BriefcaseCommandError(
"Unable to start app {app.name}.".format(app=app)
"Unable to start app {app.app_name}.".format(app=app)
)


Expand Down
6 changes: 3 additions & 3 deletions src/briefcase/platforms/macOS/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def run_app(self, app: BaseConfig, **kwargs):
:param base_path: The path to the project directory.
"""
print()
print('[{app.name}] Starting app...'.format(
print('[{app.app_name}] Starting app...'.format(
app=app
))
try:
Expand All @@ -64,7 +64,7 @@ def run_app(self, app: BaseConfig, **kwargs):
except subprocess.CalledProcessError:
print()
raise BriefcaseCommandError(
"Unable to start app {app.name}.".format(app=app)
"Unable to start app {app.app_name}.".format(app=app)
)


Expand Down Expand Up @@ -184,7 +184,7 @@ def package_app(self, app: BaseConfig, sign_app=True, identity=None, **kwargs):
identity = self.select_identity(identity=identity)

print()
print("[{app.name}] Signing app with identity {identity}...".format(
print("[{app.app_name}] Signing app with identity {identity}...".format(
app=app,
identity=identity
))
Expand Down
Loading

0 comments on commit 3d7d97a

Please sign in to comment.