From 4eba2cbf5a364464749fe42c113af7e004bd735c Mon Sep 17 00:00:00 2001 From: Ronny Abraham Date: Thu, 18 Oct 2018 12:45:07 +0300 Subject: [PATCH] updating for python3 --- modules/deploy.py | 2 -- modules/django.py | 10 +++++----- modules/pip.py | 12 ++++++------ modules/supervisor.py | 2 +- share/templates/conf/django/files/local.jinja2 | 2 +- share/templates/conf/django/files/settings.jinja2 | 3 +-- share/templates/conf/gunicorn/files/local.jinja2 | 2 +- share/templates/conf/gunicorn/files/settings.jinja2 | 3 +-- 8 files changed, 16 insertions(+), 20 deletions(-) diff --git a/modules/deploy.py b/modules/deploy.py index 8862511..18bcfb5 100644 --- a/modules/deploy.py +++ b/modules/deploy.py @@ -76,8 +76,6 @@ def setup_rootpath(): @task def bootstrap(): - import database as db - configuration = env.config if env.debug: diff --git a/modules/django.py b/modules/django.py index 66e31fd..ffbc1bf 100644 --- a/modules/django.py +++ b/modules/django.py @@ -8,6 +8,7 @@ from fabric.contrib.files import exists from .utils import loggify, print_run, booleanize from .utils import generate_template_build_path from .utils import generate_template_files_path +from .utils import handle_help import os @@ -145,7 +146,6 @@ def startapp(appname='help'): \tappname - the name of the app you want to start """ - from utils import handle_help import sys if handle_help(appname, msg_help, 'help'): @@ -317,7 +317,7 @@ def generate_scripts(template_name, make_copy=False): backup_cmd = "cp {copy_full_path} " \ "{copy_full_path}.bak".format(copy_full_path=copy_full_path) - from utils import upload_template as utils_upload_template + from .utils import upload_template as utils_upload_template if env.debug: logger.debug("template_name : %s" % template_name) @@ -501,7 +501,7 @@ def generate_gunicorn(make_link=True): logger.debug('\n%s' % print_run(msg_link_gunicorn)) - from utils import upload_template as utils_upload_template + from .utils import upload_template as utils_upload_template upload_msg = utils_upload_template( filename=configuration.templates.gunicorn.conf.src, @@ -538,7 +538,7 @@ def edit(param='help'): calls up mvim on the gunicorn conf file """ - from maintenance import edit as maintenance_edit + from .maintenance import edit as maintenance_edit configuration = env.config @@ -712,7 +712,7 @@ def fixtures(appname=None, backup=False): print("debug - path_fixture: %s" % path_fixture) - from utils import ensure_dir + from .utils import ensure_dir ensure_dir(path_data) ensure_dir(path_backup) diff --git a/modules/pip.py b/modules/pip.py index 6cc8438..69a774e 100644 --- a/modules/pip.py +++ b/modules/pip.py @@ -21,8 +21,8 @@ def setup_virtualenv(): format='\n%(levelname)s: deploy.setup_virtualenv %(message)s', level=logging.DEBUG) - mkvirtualenv_cmd = "mkvirtualenv --no-site-packages --python=`which python3` " \ - "{virtualenv_name}".format( + mkvirtualenv_cmd = "mkvirtualenv --no-site-packages " \ + "--python=`which python3` {virtualenv_name}".format( virtualenv_name=configuration.virtualenv.name) if env.debug: @@ -147,7 +147,7 @@ def freeze(param='help'): \tFalse (default) - print the freeze output to the console """ - from utils import booleanize, handle_help + from .utils import booleanize, handle_help if handle_help(param, msg_help, 'help'): sys.exit() @@ -209,7 +209,7 @@ def copyto(branch): "This will simply copy over \n\tthe requirements file for " "this branch with itself", ERROR_BAD_BRANCH_PARAM) - from initialize import get_config + from .initialize import get_config branch_config = get_config(branch) @@ -228,10 +228,10 @@ def copyto(branch): "destination branch '{branch_dst}'. Continue? Y/n ".format( branch_src=configuration.project.branch, branch_dst=branch) - from utils import prompt_continue + from .utils import prompt_continue prompt_continue(message=message) - from utils import upload_template + from .utils import upload_template upload_template( filename=configuration.virtualenv.requirements.filename, destination=branch_local_path, diff --git a/modules/supervisor.py b/modules/supervisor.py index 53da1f7..f2ef637 100644 --- a/modules/supervisor.py +++ b/modules/supervisor.py @@ -224,7 +224,7 @@ def upload(): logger.debug("run(%s)" % copy_command) else: - import utils + from . import utils utils.printvar("files_path", files_path) upload_template( diff --git a/share/templates/conf/django/files/local.jinja2 b/share/templates/conf/django/files/local.jinja2 index 4454550..76255b9 100644 --- a/share/templates/conf/django/files/local.jinja2 +++ b/share/templates/conf/django/files/local.jinja2 @@ -3,7 +3,7 @@ BRANCH = '{{ project_branch }}' from {{ project_name }}.settings import * -import initialize +from modules import initialize import logging LOCAL_LOGGING_PREFIX = "%s %%(message)s" % BRANCH diff --git a/share/templates/conf/django/files/settings.jinja2 b/share/templates/conf/django/files/settings.jinja2 index 6086845..a771b3c 100644 --- a/share/templates/conf/django/files/settings.jinja2 +++ b/share/templates/conf/django/files/settings.jinja2 @@ -23,7 +23,7 @@ PROJECT_ROOT = os.path.abspath(os.path.join(BASE_DIR, os.pardir)) # infomration for the settings file sys.path.insert(0, os.path.join( - PROJECT_ROOT, 'usr', 'bin', 'fabric', 'modules')) + PROJECT_ROOT, 'usr', 'bin', 'fabric')) # # add an "apps" directory to this project, which is where all the apps @@ -60,7 +60,6 @@ MIDDLEWARE = [ 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] diff --git a/share/templates/conf/gunicorn/files/local.jinja2 b/share/templates/conf/gunicorn/files/local.jinja2 index 4454550..76255b9 100644 --- a/share/templates/conf/gunicorn/files/local.jinja2 +++ b/share/templates/conf/gunicorn/files/local.jinja2 @@ -3,7 +3,7 @@ BRANCH = '{{ project_branch }}' from {{ project_name }}.settings import * -import initialize +from modules import initialize import logging LOCAL_LOGGING_PREFIX = "%s %%(message)s" % BRANCH diff --git a/share/templates/conf/gunicorn/files/settings.jinja2 b/share/templates/conf/gunicorn/files/settings.jinja2 index 6086845..a771b3c 100644 --- a/share/templates/conf/gunicorn/files/settings.jinja2 +++ b/share/templates/conf/gunicorn/files/settings.jinja2 @@ -23,7 +23,7 @@ PROJECT_ROOT = os.path.abspath(os.path.join(BASE_DIR, os.pardir)) # infomration for the settings file sys.path.insert(0, os.path.join( - PROJECT_ROOT, 'usr', 'bin', 'fabric', 'modules')) + PROJECT_ROOT, 'usr', 'bin', 'fabric')) # # add an "apps" directory to this project, which is where all the apps @@ -60,7 +60,6 @@ MIDDLEWARE = [ 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ]