/usr/lib/python2.7/dist-packages/spur/files.py is in python-spur 0.3.17-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import os
class FileOperations(object):
def __init__(self, shell):
self._shell = shell
def copy_file(self, source, destination=None, dir=None):
if destination is None and dir is None:
raise TypeError("Destination required for copy")
if destination is not None:
self._shell.run(["cp", "-T", source, destination])
elif dir is not None:
self._shell.run(["cp", source, "-t", dir])
def write_file(self, path, contents):
self._shell.run(["mkdir", "-p", os.path.dirname(path)])
file = self._shell.open(path, "w")
try:
file.write(contents)
finally:
file.close()
|