updated django.manage so that if working dir is false, then the second section only gets executed under the elese, whereas if working dir was true, the second section got executed anyway
This commit is contained in:
parent
4fbf259f69
commit
c3f680d3c9
1 changed files with 26 additions and 20 deletions
|
|
@ -126,7 +126,9 @@ def manage(args="help", workingdir=None, prefix="", suffix=""):
|
|||
from fabric.context_managers import cd
|
||||
|
||||
with virtualenv():
|
||||
|
||||
if workingdir:
|
||||
|
||||
with cd(workingdir):
|
||||
fabcommand = "{prefix} {djangoroot}/manage.py {args} " \
|
||||
"--pythonpath='{djangoroot}' " \
|
||||
|
|
@ -147,29 +149,33 @@ def manage(args="help", workingdir=None, prefix="", suffix=""):
|
|||
# MAKE SURE THIS IS ALWAYS HERE!
|
||||
shell='/bin/bash')
|
||||
|
||||
with cd(configuration.paths.django.root):
|
||||
cmd = "{prefix} {djangoroot}/manage.py {args} " \
|
||||
" --pythonpath='{djangoroot}' " \
|
||||
"--settings={djangosettings} {suffix}".format(
|
||||
prefix=prefix,
|
||||
djangoroot=configuration.paths.django.root,
|
||||
args=args,
|
||||
djangosettings=configuration.imports.settings,
|
||||
suffix=suffix)
|
||||
else:
|
||||
with cd(configuration.paths.django.root):
|
||||
cmd = "{prefix} {djangoroot}/manage.py {args} " \
|
||||
" --pythonpath='{djangoroot}' " \
|
||||
"--settings={djangosettings} {suffix}".format(
|
||||
prefix=prefix,
|
||||
djangoroot=configuration.paths.django.root,
|
||||
args=args,
|
||||
djangosettings=configuration.imports.settings,
|
||||
suffix=suffix)
|
||||
|
||||
if env.debug:
|
||||
print("command: with cd(%s)" % configuration.paths.django.root)
|
||||
print("command: fabric_ops.run(%s)" % cmd)
|
||||
else:
|
||||
if env.debug:
|
||||
print("command: with cd(%s)" %
|
||||
configuration.paths.django.root)
|
||||
|
||||
output = fabric_ops.run(
|
||||
cmd,
|
||||
# MAKE SURE THIS IS ALWAYS HERE!
|
||||
shell='/bin/bash'
|
||||
)
|
||||
print("command: fabric_ops.run(%s)" % cmd)
|
||||
|
||||
# fabric.run has the ability to give me back the output
|
||||
return output
|
||||
else:
|
||||
|
||||
output = fabric_ops.run(
|
||||
cmd,
|
||||
# MAKE SURE THIS IS ALWAYS HERE!
|
||||
shell='/bin/bash'
|
||||
)
|
||||
|
||||
# fabric.run has the ability to give me back the output
|
||||
return output
|
||||
|
||||
# NOTE:
|
||||
# there was a major problem using fabric commands of "local" or "prefix"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue