3a6a64cdd6623597dbb64c85b44dd9ea0cf1516c,luminoth/tools/cloud/gcloud.py,,build_package,#,39

Before Change


        package_path
    ))

    with tempfile.TemporaryDirectory() as temp_dir:
        output_dir = os.path.join(temp_dir, "output")

        devnull = open(os.devnull, "w")
        subprocess.call(
            [
                "python", "setup.py", "egg_info", "--egg-base", temp_dir,
                "build", "--build-base", temp_dir, "--build-temp", temp_dir,
                "sdist", "--dist-dir", output_dir
            ],
            cwd=package_path, stdout=devnull, stderr=devnull
        )
        subprocess.call(
            [
                "python", "setup.py", "build", "--build-base", temp_dir,
                "--build-temp", temp_dir, "sdist", "--dist-dir", output_dir
            ],
            cwd=package_path, stdout=devnull, stderr=devnull
        )
        subprocess.call(
            ["python", "setup.py", "sdist", "--dist-dir", output_dir],
            cwd=package_path, stdout=devnull, stderr=devnull
        )

        tarball_filename = os.listdir(output_dir)[0]
        tarball_path = os.path.join(
            output_dir, tarball_filename
        )

        path = upload_file(
            bucket, "{}/packages".format(base_path), tarball_path
        )

        return path


def get_account_attribute(service_account_json, attr):
    return json.load(
        tf.gfile.GFile(service_account_json, "r")
    ).get(attr)

After Change


    temp_dir = tempfile.mkdtemp()
    output_dir = os.path.join(temp_dir, "output")

    devnull = open(os.devnull, "w")
    subprocess.call(
        [
            "python", "setup.py", "egg_info", "--egg-base", temp_dir,
            "build", "--build-base", temp_dir, "--build-temp", temp_dir,
            "sdist", "--dist-dir", output_dir
        ],
        cwd=package_path, stdout=devnull, stderr=devnull
    )
    subprocess.call(
        [
            "python", "setup.py", "build", "--build-base", temp_dir,
            "--build-temp", temp_dir, "sdist", "--dist-dir", output_dir
        ],
        cwd=package_path, stdout=devnull, stderr=devnull
    )
    subprocess.call(
        ["python", "setup.py", "sdist", "--dist-dir", output_dir],
        cwd=package_path, stdout=devnull, stderr=devnull
    )
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: tryolabs/luminoth
Commit Name: 3a6a64cdd6623597dbb64c85b44dd9ea0cf1516c
Time: 2017-10-20
Author: javirey@gmail.com
File Name: luminoth/tools/cloud/gcloud.py
Class Name:
Method Name: build_package