Add pythemis_uninstall target to Makefile. Fixes #948#949
Add pythemis_uninstall target to Makefile. Fixes #948#949sashimanu-san wants to merge 1 commit intocossacklabs:masterfrom
Conversation
|
does it work? :D |
it does indeed! |
| @echo -n "pythemis install " | ||
| @$(BUILD_CMD_) | ||
|
|
||
| pythemis_uninstall: CMD = cd src/wrappers/themis/python/ && xargs rm -rf < files3.txt |
There was a problem hiding this comment.
I think will be safer to uninstall it with pip3 uninstall pythemis
Plus, we should test that it works. Can you add uninstall steps for our tests in github actions - https://github.com/cossacklabs/themis/blob/master/.github/workflows/test-python.yaml#L47? After finishing tests we can call pythemis_uninstall to be sure that this command works
There was a problem hiding this comment.
additionally, will be great to delete files3.txt too. Due to this file generated by our Makefile, we should clean it too.
There was a problem hiding this comment.
but we install it manually here cd src/wrappers/themis/python/ && python3 setup.py install --record files3.txt, should we uninstall via pip3?
There was a problem hiding this comment.
Yes, I revised one more time and your are right. System may haven't pip but be able to install packets with only python binary. So yes, probably we should delete with rm. But also we should delete files3.txt too. To return system to same state as it was before installation.
There was a problem hiding this comment.
Despite a rather common approach: to record created / to remove created, there are couple of thoughts:
- do we actually need
-rflag forrm? as far as I can see there only files are expected, correct me please if I miss something - the clause
xargs rm -rf < files3.txtlooks a bit dangerous for me; due to a mistake or even execution/write fault, we might get shorter path in thefiles3.txtthan expected, which may lead torm -rf /instead ofrm -rf /usr/local/...; if we'd remove-rflag, as suggested above, I think it would be safely enough; if we cannot do that and expect deep directory structures, I'd add filter to prevent removing unexpected paths (for example, we may expect, that prefix would be always/usr/local/lib/python)
There was a problem hiding this comment.
Given that setup.py does not really have an uninstaller other that removing files recorded with --record, I think this will be an acceptable improvement. Better than having to remove files manually.
Normally, this installs an egg – just one file with an archive. However, I agree with @shadinua's concerns about removing stuff enumerated in some file. I'd suggest to improve the call by doing xargs -n 1 unlink. This should be portable between various UNIX-like systems and it shorter than, say, checking with shell that we remove files.
Another way would be to throw in --preserve-root, but that's a GNU-specific option. Since we expect only files to be removed, unlink fits the job well (removes one file, cannot remove directories). Still, xargs does not work for paths with spaces and newlines. But who uses those, right?
Ignore me. Simply not setting -r should be enough to remove only files.
I tend to think that python_uninstall should not remove files3.txt since that's just a part of the build, which should probably be removed by some clean instead. However, I wouldn't mind python_uninstall cleaning up the directory. Keep in mind though that python_install writes a bunch of other things as well besides files3.txt.
|
unrelated to the PR look, @ilammy oh no, rust has updated? or clippy? rust tests are failing 😱 |
|
As a long-term solution, we should think about migrating from For |
|
@sashimanu-san could you please take a look at the discussion? |
Added a
pythemis_uninstalltarget toMakefile.Checklist