webapp_deploy/main.py
def deploy(artifact_s3_url, target_s3_url, exclude_pattern):
    """
    Deploys items from the S3 artifact, which should point to a .tgz
    or .zip file, to the target S3 bucket.

    Returns a list of DeployItem that were uploaded.
    """

    temp_file = tempfile.NamedTemporaryFile()
    get_artifact(artifact_s3_url, temp_file.name)

    temp_dir = tempfile.mkdtemp()

    extract(artifact_s3_url, temp_file.name, temp_dir, exclude_pattern)

    s3_upload_bucket, s3_upload_key_base = parse_s3_url(target_s3_url)

    all_files = construct_all_files(temp_dir, s3_upload_key_base)

    deploy_time = int(time.time())

    # Sync to S3 - exclude html files first, then upload the html files.
    # The ordering ensures that the dependencies are always uploaded before
    # the referencing html file. It also ensures that most failures will not
    # leave the code base in a non-working state.

    upload(s3_upload_bucket, [i for i in all_files if not i[0].endswith(".html")])
    upload(s3_upload_bucket, [i for i in all_files if i[0].endswith(".html")])

    temp_file.close()
    shutil.rmtree(temp_dir)

    return [DeployItem(deploy_time, fname) for [fname, _, _] in all_files]

    Deploys items from the S3 artifact, which should point to a .tgz
    or .zip file, to the target S3 bucket.

    Returns a list of DeployItem that were uploaded.
    
Deploys items from the S3 artifact, which should point to a .tgz
or .zip file, to the target S3 bucket.

Returns a list of DeployItem that were uploaded.
Deploys items from the S3 artifact which should point to a . tgz or . zip file to the target S3 bucket . Returns a list of DeployItem that were uploaded .
def deploy(artifact_s3_url, target_s3_url, exclude_pattern):
    temp_file = tempfile.NamedTemporaryFile()
    get_artifact(artifact_s3_url, temp_file.name)
    temp_dir = tempfile.mkdtemp()
    extract(artifact_s3_url, temp_file.name, temp_dir, exclude_pattern)
    s3_upload_bucket, s3_upload_key_base = parse_s3_url(target_s3_url)
    all_files = construct_all_files(temp_dir, s3_upload_key_base)
    deploy_time = int(time.time())
    upload(s3_upload_bucket, [i for i in all_files if not i[0].endswith(".html")])
    upload(s3_upload_bucket, [i for i in all_files if i[0].endswith(".html")])
    temp_file.close()
    shutil.rmtree(temp_dir)
    return [DeployItem(deploy_time, fname) for [fname, _, _] in all_files]
def deploy ( artifact_s3_url , target_s3_url , exclude_pattern ) : temp_file = tempfile . NamedTemporaryFile ( ) get_artifact ( artifact_s3_url , temp_file . name ) temp_dir = tempfile . mkdtemp ( ) extract ( artifact_s3_url , temp_file . name , temp_dir , exclude_pattern ) s3_upload_bucket , s3_upload_key_base = parse_s3_url ( target_s3_url ) all_files = construct_all_files ( temp_dir , s3_upload_key_base ) deploy_time = int ( time . time ( ) ) upload ( s3_upload_bucket , [ i for i in all_files if not i [ 0 ] . endswith ( ".html" ) ] ) upload ( s3_upload_bucket , [ i for i in all_files if i [ 0 ] . endswith ( ".html" ) ] ) temp_file . close ( ) shutil . rmtree ( temp_dir ) return [ DeployItem ( deploy_time , fname ) for [ fname , _ , _ ] in all_files ]
Deploys items from the S3 artifact, which should point to a .tgz
or .zip file, to the target S3 bucket.
Deploys items from the S3 artifact which should point to a . tgz or . zip file to the target S3 bucket .
"""
    Deploys items from the S3 artifact, which should point to a .tgz
    or .zip file, to the target S3 bucket.

    Returns a list of DeployItem that were uploaded.
    """ # Sync to S3 - exclude html files first, then upload the html files. # The ordering ensures that the dependencies are always uploaded before # the referencing html file. It also ensures that most failures will not # leave the code base in a non-working state.
artifact_s3_url
target_s3_url
exclude_pattern