示例#1
0
def create_app(argv):
    """
    Check if an app name and the domain were specified and whether the
    skeleton project exists. If so, create the new project, else print
    an error message.
    """
    if len(argv) != 2:
        print "Error: Invalid argument count: got %d instead of 2." % len(argv)
        print "Syntax: ./pydroid app_name domain"
        sys.exit(1)
    elif not os.path.exists(skeleton_dir()):
        print "Error: Could not find the template for creating the project."
        print "Expected the template at:", skeleton_dir()
        sys.exit(1)
    else:
        create_example.create_example_project(EXAMPLE_NAME, argv[0], argv[1])
示例#2
0
def create_app(argv):
    """
    Check if an app name and the domain were specified and whether the
    skeleton project exists. If so, create the new project, else print
    an error message.
    """
    if len(argv) != 2:
        print "Error: Invalid argument count: got %d instead of 2." % len(argv)
        print "Syntax: ./pydroid app_name domain"
        sys.exit(1)
    elif not os.path.exists(skeleton_dir()):
        print "Error: Could not find the template for creating the project."
        print "Expected the template at:", skeleton_dir()
        sys.exit(1)
    else:
        create_example.create_example_project(EXAMPLE_NAME, argv[0], argv[1])
示例#3
0
def setup_project(app_name, domain, override_existing=False):
    """
    Create a new project with name 'app_name' from the skeleton project.
    Returns True if the project could have been created successfully.
    """
    dst = os.path.join(os.getcwd(), app_name)
    if override_existing:
        try:
            shutil.rmtree(dst)
        except OSError:
            pass

    if os.path.exists(dst):
        print "A directory with name %s already exists." % app_name
        return False
    else:
        shutil.copytree(skeleton_dir(), dst, symlinks=True)
        os.chdir(dst)
        rename.rename_project(app_name, domain)
        return True
示例#4
0
def setup_project(app_name, domain, override_existing=False):
    """
    Create a new project with name 'app_name' from the skeleton project.
    Returns True if the project could have been created successfully.
    """
    dst = os.path.join(os.getcwd(), app_name)
    if override_existing:
        try:
            shutil.rmtree(dst)
        except OSError:
            pass

    if os.path.exists(dst):
        print "A directory with name %s already exists." % app_name
        return False
    else:
        shutil.copytree(skeleton_dir(), dst, symlinks=True)
        os.chdir(dst)
        rename.rename_project(app_name, domain)
        return True