updated print funcs

This commit is contained in:
Ronny Abraham 2018-10-17 23:08:51 +03:00
parent dc02488e8b
commit a5677a96a0
11 changed files with 41 additions and 41 deletions

View file

@ -3,7 +3,7 @@ from fabric.operations import run, put
from fabric.api import env, task from fabric.api import env, task
import os import os
from maintenance import _get_configuration_path, load_configuration from .maintenance import _get_configuration_path, load_configuration
@task @task
@ -297,7 +297,7 @@ def edit(param='help'):
else: else:
# if param == 'help': # if param == 'help':
print """ print("""
"fab configuration.edit" automates opening up and editing project "fab configuration.edit" automates opening up and editing project
configuration files configuration files
@ -305,7 +305,7 @@ def edit(param='help'):
parameter parameter
currently editable locations are: currently editable locations are:
""" """)
for k_loc in locations.keys(): for k_loc in locations.keys():
print("\t{0: <20} - {1}".format(k_loc, locations[k_loc]['desc'])) print("\t{0: <20} - {1}".format(k_loc, locations[k_loc]['desc']))

View file

@ -1,8 +1,8 @@
from fabric.api import env, task from fabric.api import env, task
# # from jinja2 import Environment # # from jinja2 import Environment
import os import os
from utils import upload_template as utils_upload_template from .utils import upload_template as utils_upload_template
from utils import loggify, print_console, booleanize from .utils import loggify, print_console, booleanize
# from utils import prompt_continue # from utils import prompt_continue
from getpass import getpass from getpass import getpass
import fabric.operations as fabric_ops import fabric.operations as fabric_ops
@ -554,7 +554,7 @@ def edit(param='help'):
remote_path = locations[param]['path'] remote_path = locations[param]['path']
maintenance_edit(remote_path=remote_path) maintenance_edit(remote_path=remote_path)
else: else:
print """ print("""
"fab database.edit" automates editing files important to django whether "fab database.edit" automates editing files important to django whether
locally or remotely locally or remotely
@ -562,7 +562,7 @@ def edit(param='help'):
parameter parameter
currently editable locations are: currently editable locations are:
""" """)
for k_loc in locations.keys(): for k_loc in locations.keys():
print("\t{0: <20} - {1}".format( print("\t{0: <20} - {1}".format(

View file

@ -5,11 +5,11 @@ from fabric.operations import local
# from fabric.contrib.files import upload_template # from fabric.contrib.files import upload_template
# from utils import print_run # from utils import print_run
from utils import virtualenv_source, booleanize, loggify from .utils import virtualenv_source, booleanize, loggify
from utils import print_console from .utils import print_console
from pip import setup_virtualenv from .pip import setup_virtualenv
from pip import bootstrap_pip from .pip import bootstrap_pip
import os import os
@ -410,7 +410,7 @@ def sync(full=True, extras=False):
# either SYNCING TO OR FROM, then just exit at this point # either SYNCING TO OR FROM, then just exit at this point
if configuration.project.branch == "development": if configuration.project.branch == "development":
print """ print("""
------------------------------------ ------------------------------------
NOTE: this is a hack for the function deploy.sync() NOTE: this is a hack for the function deploy.sync()
@ -435,7 +435,7 @@ def sync(full=True, extras=False):
Right after this message gets printed, the sync function is told to Right after this message gets printed, the sync function is told to
"return" without any arguments "return" without any arguments
------------------------------------\n ------------------------------------\n
""" """)
# #
# exit the function without any arguments # exit the function without any arguments
@ -617,7 +617,7 @@ def remove(full=True):
import sys import sys
if env.branch == "development" and not env.debug and full: if env.branch == "development" and not env.debug and full:
print """ print("""
------------------------------ ------------------------------
WARNING: WARNING:
@ -628,7 +628,7 @@ def remove(full=True):
Exiting NOW. Exiting NOW.
-------------------------------- --------------------------------
""" """)
sys.exit() sys.exit()
# #

View file

@ -5,9 +5,9 @@ import fabric.operations as fabric_ops
from fabric.contrib.files import exists from fabric.contrib.files import exists
from utils import loggify, print_run, booleanize from .utils import loggify, print_run, booleanize
from utils import generate_template_build_path from .utils import generate_template_build_path
from utils import generate_template_files_path from .utils import generate_template_files_path
import os import os
@ -42,11 +42,11 @@ def commandline(args=""):
""" """
configuration = env.config configuration = env.config
commandline = "{djangoroot}/manage.py {args} --pythonpath='{djangoroot}' " \ commandline = "{djangoroot}/manage.py {args} --pythonpath='{djangoroot}'" \
"--settings={djangosettings}".format( " --settings={djangosettings}".format(
djangoroot=configuration.paths.django.root, djangoroot=configuration.paths.django.root,
args=args, args=args,
djangosettings=configuration.imports.settings,) djangosettings=configuration.imports.settings,)
print(commandline) print(commandline)
@ -599,7 +599,7 @@ def edit(param='help'):
else: else:
# if param == 'help': # if param == 'help':
print """ print("""
"fab django.edit" automates editing files important to django whether "fab django.edit" automates editing files important to django whether
locally or remotely locally or remotely
@ -607,7 +607,7 @@ def edit(param='help'):
parameter parameter
currently editable locations are: currently editable locations are:
""" """)
for k_loc in locations.keys(): for k_loc in locations.keys():
print("\t{0: <20} - {1}".format(k_loc, locations[k_loc]['desc'])) print("\t{0: <20} - {1}".format(k_loc, locations[k_loc]['desc']))
@ -618,7 +618,7 @@ def edit(param='help'):
@task @task
def clearmigrations(appname="help"): def clearmigrations(appname="help"):
if appname == "help": if appname == "help":
print """ print("""
"fab django.clearmigration:{appname}" clears out all migrations for the "fab django.clearmigration:{appname}" clears out all migrations for the
specified appname specified appname
@ -627,7 +627,7 @@ def clearmigrations(appname="help"):
Note: if your appname is actually "help" you might want to go into this Note: if your appname is actually "help" you might want to go into this
function and change it up a bit! function and change it up a bit!
""" """)
return return
configuration = env.config configuration = env.config

View file

@ -4,8 +4,8 @@ from fabric.operations import run
from fabric.contrib.files import upload_template from fabric.contrib.files import upload_template
from utils import loggify, generate_template_files_path, booleanize from .utils import loggify, generate_template_files_path, booleanize
from utils import generate_template_build_path, print_console from .utils import generate_template_build_path, print_console
@task @task

View file

@ -51,7 +51,7 @@ def environment(branchname):
host = env.config.server.database.host host = env.config.server.database.host
from docker import docker_ip from .docker import docker_ip
if host == 'docker': if host == 'docker':
env.config.server.database.host = docker_ip() env.config.server.database.host = docker_ip()

View file

@ -4,7 +4,7 @@ import os
import sys import sys
from . import utils from . import utils
from utils import executize, virtualenv, loggify from .utils import executize, virtualenv, loggify
def command(program=None, cmd=None, extra_param=None): def command(program=None, cmd=None, extra_param=None):
@ -210,7 +210,7 @@ def load_configuration(name, branch):
elif name == "layout": elif name == "layout":
file_path = _get_configuration_path('layout', branch) file_path = _get_configuration_path('layout', branch)
configuration_file = yaml.load(file(file_path, 'r')) configuration_file = yaml.load(open(file_path, 'r'))
return configuration_file return configuration_file

View file

@ -6,10 +6,10 @@ from fabric.operations import sudo
import os import os
# import sys # import sys
from maintenance import command as maintenance_command from .maintenance import command as maintenance_command
from maintenance import edit as maintenance_edit from .maintenance import edit as maintenance_edit
from utils import loggify from .utils import loggify
@task @task

View file

@ -5,8 +5,8 @@ import sys
import os import os
import logging import logging
from utils import virtualenv_source, virtualenv from .utils import virtualenv_source, virtualenv
from utils import print_console, printerr from .utils import print_console, printerr
ERROR_BAD_BRANCH_PARAM = -3 ERROR_BAD_BRANCH_PARAM = -3
ERROR_BAD_PARAM = -2 ERROR_BAD_PARAM = -2

View file

@ -5,10 +5,10 @@ from fabric.operations import sudo, run
import os import os
from maintenance import command as maintenance_command from .maintenance import command as maintenance_command
from maintenance import edit as maintenance_edit from .maintenance import edit as maintenance_edit
from utils import loggify from .utils import loggify
def _initialize(configuration): def _initialize(configuration):

View file

@ -148,7 +148,7 @@ def ensure_dir(directory):
print("creating directory: %s" % directory) print("creating directory: %s" % directory)
os.makedirs(directory) os.makedirs(directory)
except OSError, e: except OSError as e:
if e.errno != errno.EEXIST: if e.errno != errno.EEXIST:
print("Error occurred while creating directory: %s" print("Error occurred while creating directory: %s"
% directory) % directory)