briefcase icon indicating copy to clipboard operation
briefcase copied to clipboard

Allow specification of output filename to package command

Open dybber opened this issue 5 years ago • 4 comments

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>-.dmg for example, it would be nice if they could just specify where they wanted the output to be located and with what 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.

dybber avatar Jun 13 '20 18:06 dybber

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?

freakboy3742 avatar Jun 13 '20 23:06 freakboy3742

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.

dybber avatar Jun 14 '20 05:06 dybber

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.

freakboy3742 avatar Jun 14 '20 23:06 freakboy3742

Sounds good, thanks.

dybber avatar Jun 15 '20 16:06 dybber