Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 34 lines (26 sloc) 882 Bytes
#!/usr/bin/env python
from subprocess import Popen
import os
import pipes
import shlex
import sys
def find_upgrades_script():
directory = os.getcwd()
while directory != os.sep:
path = os.path.join(directory, 'bin', 'upgrade')
if os.path.isfile(path):
return path
directory = os.path.dirname(directory)
return None
def delegate_to_script(upgrade_script):
arg = pipes.quote(' '.join(sys.argv[1:]))
command = ' '.join((upgrade_script, 'create', arg, '--path', os.getcwd()))
print '>', command
exitcode = Popen(shlex.split(command)).wait()
sys.exit(exitcode)
if __name__ == '__main__':
upgrade_script = find_upgrades_script()
if not upgrade_script:
print >>sys.stderr, 'ERROR: could not find a "bin/upgrade" in any parent directories.'
sys.exit(3)
delegate_to_script(upgrade_script)
You can’t perform that action at this time.