예제 #1
0
def main(argv):
    # check python version is high enough
    ve_mgr.check_python_version(2, 6, __file__)

    force_update = False
    full_rebuild = False
    fake_update = False
    clean_ve = False

    if argv:
        try:
            opts, args = getopt.getopt(argv[1:], 'hfqr',
                ['help', 'force', 'quiet', 'full-rebuild'])
        except getopt.error, msg:
            return print_error_msg('Bad options: %s' % msg)
        # process options
        for o, a in opts:
            if o in ("-h", "--help"):
                print_help_text()
                return 0
            if o in ("-f", "--force"):
                force_update = True
            if o in ("-r", "--full-rebuild"):
                full_rebuild = True
                clean_ve = True
        if len(args) > 1:
            return print_error_msg(
                    "Can only have one argument - you had %s" % (' '.join(args)))
        if len(args) == 1:
            if args[0] == 'fake':
                fake_update = True
            elif args[0] == 'clean':
                clean_ve = True

        # check for incompatible flags
        if force_update and fake_update:
            return print_error_msg("Cannot use --force with fake")
        if full_rebuild and fake_update:
            return print_error_msg("Cannot use --full-rebuild with fake")
        if full_rebuild and clean_ve:
            return print_error_msg("Cannot use --full-rebuild with clean")
예제 #2
0
파일: fab.py 프로젝트: birdsarah/dye
#!/usr/bin/env python
# a script to set up the virtualenv so we can use fabric and tasks

import os
from os import path
import sys
import subprocess
from ve_mgr import check_python_version, find_package_dir_in_ve

# check python version is high enough
check_python_version(2, 6, __file__)

if 'VIRTUAL_ENV' in os.environ:
    ve_dir = os.environ['VIRTUAL_ENV']
else:
    from project_settings import local_vcs_root, relative_ve_dir
    ve_dir = path.join(local_vcs_root, relative_ve_dir)

if not path.exists(ve_dir):
    print "Expected virtualenv does not exist"
    print "(required for correct version of fabric and dye)"
    print "Please run './bootstrap.py' to create virtualenv"
    sys.exit(1)

fab_bin = path.join(ve_dir, 'bin', 'fab')

dye_pkg_dir = find_package_dir_in_ve(ve_dir, 'dye')
if not dye_pkg_dir:
    sys.exit('Could not find fabfile in dye package')
fabfile = path.join(dye_pkg_dir, 'dye', 'fabfile.py')
예제 #3
0
파일: manage.py 프로젝트: birdsarah/dye
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from os import path

PROJECT_ROOT = path.abspath(path.dirname(__file__))
DEPLOY_DIR = path.abspath(path.join(PROJECT_ROOT, os.pardir, os.pardir, 'deploy'))
sys.path.append(DEPLOY_DIR)
import ve_mgr

# check python version is high enough
ve_mgr.check_python_version(2, 6, __file__)

# ignore the usual virtualenv
# note that for runserver Django will start a child process, so that it
# can kill and restart the child process. So we use the environment to pass
# the argument along.
if '--ignore-ve' in sys.argv:
    sys.argv.remove('--ignore-ve')
    os.environ['IGNORE_DOTVE'] = 'true'

# VIRTUAL_ENV will be set if we are already inside a virtualenv (either because
# of standard virtualenv activate, or because go_to_ve() set it).
if 'IGNORE_DOTVE' not in os.environ and 'VIRTUAL_ENV' not in os.environ:
    # if it appears that the virtualenv is out of date then stop here
    updater = ve_mgr.UpdateVE()
    if updater.virtualenv_needs_update():
        print "VirtualEnv needs to be updated"
        print 'Run "deploy/bootstrap.py'
        sys.exit(1)
예제 #4
0
#!/usr/bin/env python
# a script to set up the virtualenv so we can use fabric and tasks

import os
from os import path
import re
import sys
import subprocess
from ve_mgr import check_python_version, UpdateVE
from project_settings import server_home

# check python version is high enough
check_python_version(2, 6, __file__)

if 'VIRTUAL_ENV' in os.environ:
    ve_dir = os.environ['VIRTUAL_ENV']
else:
    from project_settings import local_vcs_root, relative_ve_dir
    ve_dir = path.join(local_vcs_root, relative_ve_dir)

if not os.path.exists(ve_dir):
    print "Expected virtualenv does not exist"
    print "(required for correct version of fabric and dye)"
    print "Please run './bootstrap.py' to create virtualenv"
    sys.exit(1)

updater = UpdateVE(ve_dir=ve_dir)
if updater.virtualenv_needs_update():
    print "VirtualEnv needs to be updated"
    print 'Run deploy/bootstrap.py'
    sys.exit(1)
예제 #5
0
파일: manage.py 프로젝트: oriel-hub/api
# ignore the usual virtualenv
# note that for runserver Django will start a child process, so that it
# can kill and restart the child process. So we use the environment to pass
# the argument along.
if '--ignore-ve' in sys.argv:
    sys.argv.remove('--ignore-ve')
    os.environ['IGNORE_DOTVE'] = 'true'

# VIRTUAL_ENV will be set if we are already inside a virtualenv (either because
# of standard virtualenv activate, or because go_to_ve() set it).
if 'IGNORE_DOTVE' not in os.environ and 'VIRTUAL_ENV' not in os.environ:
    import ve_mgr

    # check python version is high enough
    ve_mgr.check_python_version(2, 6, __file__)

    # if it appears that the virtualenv is out of date then stop here
    updater = ve_mgr.UpdateVE()
    if updater.virtualenv_needs_update():
        print("VirtualEnv needs to be updated")
        print('Run deploy/bootstrap.py')
        sys.exit(1)

    # now we should enter the virtualenv. We will only get
    # this far if the virtualenv is up to date.
    updater.go_to_ve(__file__, sys.argv[1:])

# run django - the usual manage.py stuff
if __name__ == "__main__":
    sys.path.append(DEPLOY_DIR)