Allow specification of output filename to package command
Hi there
I would like to suggest that users can specify a destination filename when executing briefcase package. The reasoning being, that you often would want automated CI scripts to run briefcase, and such scripts needs and easy way to locate file. Instead of these scripts guessing the right format <formal_name>-
For instance, a user would include a line like this in a script:
briefcase package macOS dmg --no-sign --output=dist/mypackage.dmg
and then the script can just assume where it has to look. Currently, a script or a Makefile would have to look up the version number in pyproject.toml, to be able to guess the destination.
Thanks for the suggestion! I can definitely understand the problem you're describing; I guess the question is whether full customization like you describe is the best approach. Customization is always a double edged sword - yes, it gives the end user more control, but at the cost of more complicated internals (which can ultimately lead to more bugs). So, adding new options/features is something we need to consider carefully.
Looking for analogies with other packaging tools: Python's wheel, for example, doesn't give any flexibility over where it outputs wheels - it uses a fixed name that includes a version number, and places the output in the dist directory. However, all output artefacts will appear in the /dist folder, and twine can be told to upload all files in the /dist folder. Would having a single reliable output folder (like dist) improve the CI situation?
Another possible approach: #360 is already tracking a feature request to extract the app's version number from the command line using briefcase project version and/or briefcase app version -a myapp; would exposing other properties (like the output path) briefcase app output_path -a myapp (returning the path to the distributable artefact) satisfy your use case?
I guess the latter approach would work, being able to read the version number is actually enough, as the user can then construct the output path from that. It's hard to parse a pyproject.toml file from commandline, to extract the version number.
However, for anyone else with this issue, here's how I ended up getting Travis to find the file:
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then export DMGFILE=`bash -c "echo macOS/mypackage-*.dmg"`; fi
I use bash to be able to use glob-patterns, in that way I avoided knowing the exact version number, and then I could just do a mv $DMGFILE dist/mypackage.dmg afterwards.
In which case, lets pencil in briefcase app output-path as a solution. @saroad2 is already looking at #360, which should provide most of the infrastructure needed to implement this.
Sounds good, thanks.