You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: distribution.rs
    path of file: ./repos/pyapp/src
    
    the code of the file until where you have to start completion: use std::env;
use std::fs;
use std::io::Write;
use std::path::{Path, PathBuf};
use std::process::{exit, Command, ExitStatus};

use anyhow::{bail, Context, Result};
use tempfile::tempdir;

use crate::{app, compression, fs_utils, network, process};

pub fn python_command(python: &PathBuf) -> Command {
    let mut command = Command::new(python);
    command.arg(app::python_isolation_flag());

    command
}

pub fn run_project() -> Result<()> {
    let mut command = python_command(&app::python_path());

    if !app::exec_code().is_empty() {
        command.args(["-c", app::exec_code().as_str()]);
    } else if !app::exec_module().is_empty() {
        command.args(["-m", app::exec_module().as_str()]);
    } else if !app::exec_script().is_empty() {
        let script_path = app::exec_script_path();
        if !script_path.is_file() {
            let script_directory = script_path.parent().unwrap();
            fs::create_dir_all(script_directory).with_context(|| {
                format!(
                    "unable to create script cache directory {}",
                    &script_directory.display()
                )
            })?;
            fs::write(&script_path, app::exec_script()).with_context(|| {
                format!("unable to write project script {}", &script_path.display())
            })?;
        }
        command.arg(script_path)
    
pub fn run_project() -> Result<()> {
    let mut command = python_command(&app::python_path());

    if !app::exec_code().is_empty() {
        command.args(["-c", app::exec_code().as_str()]);
    } else if !app::exec_module().is_empty() {
        command.args(["-m", app::exec_module().as_str()]);
    } else if !app::exec_script().is_empty() {
        let script_path = app::exec_script_path();
        if !script_path.is_file() {
            let script_directory = script_path.parent().unwrap();
            fs::create_dir_all(script_directory).with_context(|| {
                format!(
                    "unable to create script cache directory {}",
                    &script_directory.display()
                )
            })?;
            fs::write(&script_path, app::exec_script()).with_context(|| {
                format!("unable to write project script {}", &script_path.display())
            })?;
        }
        command.arg(script_path);
    } else {
        let notebook_path = app::exec_notebook_path();
        if !notebook_path.is_file() {
            let notebook_directory = notebook_path.parent().unwrap();
            fs::create_dir_all(notebook_directory).with_context(|| {
                format!(
                    "unable to create notebook cache directory {}",
                    &notebook_directory.display()
                )
            })?;
            fs::write(&notebook_path, app::exec_notebook()).with_context(|| {
                format!(
                    "unable to write project notebook {}",
                    &notebook_path.display()
                )
            })?;
        }
        command
            .arg("-m")
            .arg("notebook")
            .arg(notebook_path.to_str().unwrap());
    }
    command.args(env::args().skip(1));

    if !app::pass_location() {
        command.env("PYAPP", "1");
    } else if let Ok(exe_path) = env::current_exe() {
        command.env("PYAPP", exe_path);
    } else {
        command.env("PYAPP", "");
    }

    if !app::exposed_command().is_empty() {
        command.env("PYAPP_COMMAND_NAME", app::exposed_command());
    }

    process::exec(command)
        .with_context(|| "project execution failed, consider restoring from scratch")
}