Debian Codegraph @

tests/scripts/tar

raw
1 #!/usr/bin/env python
2 """
3 <description>
4 this is a mock tar command written to provide portability
5 to non-unix platforms that don't have the tar command. It
6 uses tarfile to replace the very baseline functionality used
7 within the in-toto test suite.
8
9 <Usage>
10 You will probably find a couple of tests decorated as follows:
11
12 @mock.patch.dict(os.environ, $PATH_TO_THIS FOLDER)
13 def test_that_requires_to_execute_tar(...)
14 ...
15
16 This will automatically make it so that in-toto popens this tar executable
17 instead of the system's tar.
18
19 This script is *not* meant to do thorough checking of its inputs, so use
20 it with care.
21
22 <Author>
23 Santiago Torres-Arias <[email protected]>
24
25 <Date>
26 1527623020
27 """
28 import sys
29 import tarfile
30
31 tarfile.open(sys.argv[2], "r:*").extractall()
32 sys.exit(0)