From 3d48451dd773c2d3dd715f2d04f925a978e2096e Mon Sep 17 00:00:00 2001 From: David Ames Date: Fri, 19 Apr 2019 08:32:52 -0700 Subject: [PATCH] Remove old .pyc files Avoid Byte code errors: bad magic number in 'ceph': b'\x03\xf3\r\n' Change-Id: I156803991b2b3783ef633837a3945f50a86ef0dc Closes-Bug: #1825392 --- hooks/upgrade-charm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hooks/upgrade-charm b/hooks/upgrade-charm index 14948004..71a85b0a 100755 --- a/hooks/upgrade-charm +++ b/hooks/upgrade-charm @@ -1,4 +1,9 @@ #!/bin/bash -e -# Re-install dependencies to deal with py2->py3 switch for charm +# Wrapper to ensure that old python bytecode isn't hanging around +# after we upgrade the charm with newer libraries +find . -iname '*.pyc' -delete +find . -name '__pycache__' -prune -exec rm -rf "{}" \; + +# Re-install dependencies to deal with py2->py3 switch for charm ./hooks/install_deps