installer
installer copied to clipboard
Add --force option that overwrites existing files
Took a stab at implementing what I suggested in #215.
Implement the --force option that, if supplied, will make installer overwrite any already existing package files instead of failing. With this flag, installer can be used in an idempotent manner, i.e. the same command can be executed multiple times with the same result:
python -m installer --force --destdir=tmp dist/*.whl
python -m installer --force --destdir=tmp dist/*.whl
python -m installer --force --destdir=tmp dist/*.whl
One other candidate for the option name I have in mind is --overwrite which I think is more mechanically descriptive, but it might be less ubiquitous, as tools like mv and cp use -f/--force.
Resolves #215
(I originally made this comment on the attached issue, but meant to make it here)
--force is a pretty generic name. There are other causes of installation failures - such as problems with the RECORD file - that won't be ignored by --force. Maybe rename to something more specific like --overwrite-existing?
That's a much better name, thanks. Changed it in 829b4839aaacefa53ae64411b953bba34f22276c.
~~Could this be added as an arg to install as well?~~
Not needed - update the destination instance instead.
Oh nevermind, I see that I'll be able to set it on the dest.
destination = SchemeDictionaryDestination(..., overwrite_existing=True)
installer.install(
source=wheel_source,
destination=destination,
additional_metadata={"INSTALLER": "me"},
overwrite_existing=True, # New
)
Sorry for the noise!
Is there anything that I can do to help get this merged? I'm looking forward to being able to use this in https://github.com/bazelbuild/rules_python
Echoing @dougthor42, is there anything I can do to have this merged and eventually released? Thanks!
@carlsmedstad please rebase your changes and ping me once it's ready and I will review
@Secrus Thank you! Rebase done.
Let me know if you'd like me to squash the commits.