예제 #1
0
    def test_should_not_make_directory_if_it_already_exists(self):
        os.mkdir(self.any_directory)

        mkdir(self.any_directory)

        self.assertTrue(os.path.exists(self.any_directory))
        self.assertTrue(os.path.isdir(self.any_directory))
예제 #2
0
    def test_should_make_directory_with_parents_if_it_does_not_exist(self):
        self.any_directory = os.path.join(self.any_directory, "any_child")

        mkdir(self.any_directory)

        self.assertTrue(os.path.exists(self.any_directory))
        self.assertTrue(os.path.isdir(self.any_directory))
예제 #3
0
    def test_should_make_directory_with_parents_if_it_does_not_exist(self):
        self.any_directory = os.path.join(self.any_directory, "any_child")

        mkdir(self.any_directory)

        self.assertTrue(os.path.exists(self.any_directory))
        self.assertTrue(os.path.isdir(self.any_directory))
예제 #4
0
    def test_should_not_make_directory_if_it_already_exists(self):
        os.mkdir(self.any_directory)

        mkdir(self.any_directory)

        self.assertTrue(os.path.exists(self.any_directory))
        self.assertTrue(os.path.isdir(self.any_directory))
예제 #5
0
def create_venvs(logger, project, reactor):
    log_dir = project.expand_path("$dir_install_logs")
    logger.debug("Creating log directory '%s'", log_dir)
    mkdir(log_dir)

    per = reactor.python_env_registry
    system_env = per["system"]
    if not project.no_venvs:
        venv_dependencies_map = project.get_property("venv_dependencies")
        if "build" not in venv_dependencies_map:
            venv_dependencies_map["build"] = as_list(project.build_dependencies) + as_list(project.dependencies)
        if "test" not in venv_dependencies_map:
            venv_dependencies_map["test"] = as_list(project.dependencies)

        clear = project.get_property("refresh_venvs") or system_env.is_pypy
        for venv_name in project.get_property("venv_names"):
            venv_dir = project.expand_path("$dir_target/venv", venv_name,
                                           system_env.versioned_dir_name)
            logger.info("Creating target '%s' VEnv in '%s'%s", venv_name, venv_dir, " (refreshing)" if clear else "")
            per[venv_name] = current_env = PythonEnv(venv_dir, reactor).create_venv(with_pip=True,
                                                                                    symlinks=system_env.venv_symlinks,
                                                                                    clear=clear,
                                                                                    offline=project.offline)
            venv_dependencies = venv_dependencies_map.get(venv_name)
            if venv_dependencies:
                install_log_path = project.expand_path("$dir_install_logs", "venv_%s_install_logs" % venv_name)
                constraints_file_name = project.get_property("install_dependencies_constraints")
                current_env.install_dependencies(venv_dependencies,
                                                 install_log_path=install_log_path,
                                                 local_mapping={},
                                                 constraints_file_name=constraints_file_name)
    else:
        for venv_name in project.get_property("venv_names"):
            per[venv_name] = system_env
def create_install_log_directory(logger, project):
    log_dir = project.expand_path("$dir_install_logs")
    logger.debug("Creating log directory %r", log_dir)
    mkdir(log_dir)

    target_dir = project.expand_path("$dir_target")
    logger.debug("Creating target directory %r", target_dir)
    mkdir(target_dir)
예제 #7
0
def copy_scripts(project, logger):
    scripts_target = project.expand_path("$" + DISTRIBUTION_PROPERTY)
    if project.get_property(SCRIPTS_TARGET_PROPERTY):
        scripts_target = project.expand_path("$" + DISTRIBUTION_PROPERTY + "/$" + SCRIPTS_TARGET_PROPERTY)

    if not exists(scripts_target):
        mkdir(scripts_target)

    logger.info("Copying scripts to %s", scripts_target)

    scripts_source = project.expand_path("$" + SCRIPTS_SOURCES_PROPERTY)
    if not exists(scripts_source):
        return
    for script in project.list_scripts():
        logger.debug("Copying script %s", script)
        source_file = project.expand_path("$" + SCRIPTS_SOURCES_PROPERTY, script)
        shutil.copy(source_file, scripts_target)
def create_install_log_directory(logger, project):
    log_dir = project.expand("$dir_install_logs")

    logger.debug("Creating log directory '%s'", log_dir)
    mkdir(log_dir)
예제 #9
0
    def test_should_make_directory_if_it_does_not_exist(self):
        mkdir(self.any_directory)

        self.assertTrue(os.path.exists(self.any_directory))
        self.assertTrue(os.path.isdir(self.any_directory))
예제 #10
0
    def test_should_make_directory_if_it_does_not_exist(self):
        mkdir(self.any_directory)

        self.assertTrue(os.path.exists(self.any_directory))
        self.assertTrue(os.path.isdir(self.any_directory))
def create_install_log_directory(logger, project):
    log_dir = project.expand("$dir_install_logs")

    logger.debug("Creating log directory '%s'", log_dir)
    mkdir(log_dir)