avoid calling external processes

Python already offers functions for chowning and chmodding files in its
standard library. The os module is even already imported. This commit removes
external process calls in favor of using these built-in Python functions.
1 job for master in 2 minutes and 9 seconds (queued for 2 seconds)
Status Job ID Name Coverage
  Test
passed #7117822
build_stable

00:02:09