/usr/share/pyshared/twill/extensions/dirstack.py is in python-twill 0.9-3.
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 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | """
Extension functions for manipulating the current working directory (cwd).
Commands:
chdir -- push the cwd onto the directory stack & change to the new location.
popd -- change to the last directory on the directory stack.
"""
import os
_dirstack = []
def chdir(where):
"""
>> chdir <where>
Change to the new location, after saving the current directory onto
the directory stack. The global variable __dir__ is set to the cwd.
"""
from twill import commands
cwd = os.getcwd()
_dirstack.append(cwd)
print cwd
os.chdir(where)
print>>commands.OUT, 'changed directory to "%s"' % (where,)
commands.setglobal('__dir__', where)
def popd():
"""
>> popd
Change back to the last directory on the directory stack. The global
variable __dir__ is set to the cwd.
"""
from twill import commands
where = _dirstack.pop()
os.chdir(where)
print>>commands.OUT, 'popped back to directory "%s"' % (where,)
commands.setglobal('__dir__', where)
|