From 7bec950c02fc5facb1db416963c165c885d39d39 Mon Sep 17 00:00:00 2001 From: Andre Smit Date: Mon, 28 Feb 2022 11:31:27 -0600 Subject: [PATCH 01/19] add clean command --- app/main.f90 | 5 ++++- src/fpm.f90 | 27 +++++++++++++++++++--- src/fpm_command_line.f90 | 48 ++++++++++++++++++++++++++++++++++------ 3 files changed, 69 insertions(+), 11 deletions(-) diff --git a/app/main.f90 b/app/main.f90 index c7c9258b61..21cd1b90e3 100644 --- a/app/main.f90 +++ b/app/main.f90 @@ -8,10 +8,11 @@ program main fpm_test_settings, & fpm_install_settings, & fpm_update_settings, & + fpm_clean_settings, & get_command_line_settings use fpm_error, only: error_t use fpm_filesystem, only: exists, parent_dir, join_path -use fpm, only: cmd_build, cmd_run +use fpm, only: cmd_build, cmd_run, cmd_clean use fpm_cmd_install, only: cmd_install use fpm_cmd_new, only: cmd_new use fpm_cmd_update, only : cmd_update @@ -73,6 +74,8 @@ program main call cmd_install(settings) type is (fpm_update_settings) call cmd_update(settings) +type is (fpm_clean_settings) + call cmd_clean(settings) end select if (allocated(project_root)) then diff --git a/src/fpm.f90 b/src/fpm.f90 index 7291247993..899d232829 100644 --- a/src/fpm.f90 +++ b/src/fpm.f90 @@ -1,8 +1,9 @@ module fpm -use fpm_strings, only: string_t, operator(.in.), glob, join, string_cat, fnv_1a +use fpm_strings, only: string_t, operator(.in.), glob, join, string_cat, fnv_1a, lower use fpm_backend, only: build_package use fpm_command_line, only: fpm_build_settings, fpm_new_settings, & - fpm_run_settings, fpm_install_settings, fpm_test_settings + fpm_run_settings, fpm_install_settings, fpm_test_settings, & + fpm_clean_settings use fpm_dependency, only : new_dependency_tree use fpm_environment, only: get_env use fpm_filesystem, only: is_dir, join_path, number_of_rows, list_files, exists, & @@ -24,7 +25,7 @@ module fpm & stderr=>error_unit implicit none private -public :: cmd_build, cmd_run +public :: cmd_build, cmd_run, cmd_clean public :: build_model, check_modules_for_duplicates contains @@ -502,4 +503,24 @@ end subroutine compact_list end subroutine cmd_run +subroutine cmd_clean(settings) + class(fpm_clean_settings), intent(in) :: settings + character(len=1) :: response + if (is_dir("build")) then + write(stdout, '(A)', advance='no') "Delete the build directory (y/n)? " + read(stdin, '(A1)') response + if (lower(response) == 'y') then + if(settings%unix) then + call run('rm -rf build', .false.) + else + call run('rmdir /s/q build', .false.) + end if + else + write (stdout, '(A)') "fpm: The response was not affirmative, build directory was not deleted." + end if + else + write (stdout, '(A)') "fpm: No build directory found." + end if +end subroutine cmd_clean + end module fpm diff --git a/src/fpm_command_line.f90 b/src/fpm_command_line.f90 index 836c1a9d4a..4fce224cf5 100644 --- a/src/fpm_command_line.f90 +++ b/src/fpm_command_line.f90 @@ -23,7 +23,7 @@ !> ``fpm-help`` and ``fpm --list`` help pages below to make sure the help output !> is complete and consistent as well. module fpm_command_line -use fpm_environment, only : get_os_type, get_env, & +use fpm_environment, only : get_os_type, get_env, os_is_unix, & OS_UNKNOWN, OS_LINUX, OS_MACOS, OS_WINDOWS, & OS_CYGWIN, OS_SOLARIS, OS_FREEBSD, OS_OPENBSD use M_CLI2, only : set_args, lget, sget, unnamed, remaining, specified @@ -47,6 +47,7 @@ module fpm_command_line fpm_run_settings, & fpm_test_settings, & fpm_update_settings, & + fpm_clean_settings, & get_command_line_settings type, abstract :: fpm_cmd_settings @@ -104,6 +105,10 @@ module fpm_command_line logical :: clean end type +type, extends(fpm_cmd_settings) :: fpm_clean_settings + logical :: unix +end type + character(len=:),allocatable :: name character(len=:),allocatable :: os_type character(len=ibug),allocatable :: names(:) @@ -113,9 +118,10 @@ module fpm_command_line character(len=:), allocatable :: help_new(:), help_fpm(:), help_run(:), & & help_test(:), help_build(:), help_usage(:), help_runner(:), & & help_text(:), help_install(:), help_help(:), help_update(:), & - & help_list(:), help_list_dash(:), help_list_nodash(:) + & help_list(:), help_list_dash(:), help_list_nodash(:), & + & help_clean(:) character(len=20),parameter :: manual(*)=[ character(len=20) ::& -& ' ', 'fpm', 'new', 'build', 'run', & +& ' ', 'fpm', 'new', 'build', 'run', 'clean', & & 'test', 'runner', 'install', 'update', 'list', 'help', 'version' ] character(len=:), allocatable :: val_runner, val_compiler, val_flag, val_cflag, val_ldflag, & @@ -174,6 +180,8 @@ subroutine get_command_line_settings(cmd_settings) character(len=4096) :: cmdarg integer :: i integer :: widest + integer :: os + logical :: unix type(fpm_install_settings), allocatable :: install_settings character(len=:), allocatable :: common_args, compiler_args, run_args, working_dir, & & c_compiler, archiver @@ -184,8 +192,9 @@ subroutine get_command_line_settings(cmd_settings) type(error_t), allocatable :: error call set_help() + os = get_os_type() ! text for --version switch, - select case (get_os_type()) + select case (os) case (OS_LINUX); os_type = "OS Type: Linux" case (OS_MACOS); os_type = "OS Type: macOS" case (OS_WINDOWS); os_type = "OS Type: Windows" @@ -196,6 +205,7 @@ subroutine get_command_line_settings(cmd_settings) case (OS_UNKNOWN); os_type = "OS Type: Unknown" case default ; os_type = "OS Type: UNKNOWN" end select + unix = os_is_unix(os) version_text = [character(len=80) :: & & 'Version: 0.5.0, alpha', & & 'Program: fpm(1)', & @@ -321,7 +331,7 @@ subroutine get_command_line_settings(cmd_settings) select case(size(unnamed)) case(1) if(lget('backfill'))then - name='.' + name='.' else write(stderr,'(*(7x,g0,/))') & & ' fpm new NAME [[--lib|--src] [--app] [--test] [--example]]|[--full|--bare] [--backfill]' @@ -424,6 +434,8 @@ subroutine get_command_line_settings(cmd_settings) help_text=[character(len=widest) :: help_text, help_help] case('version' ) help_text=[character(len=widest) :: help_text, version_text] + case('clean' ) + help_text=[character(len=widest) :: help_text, help_clean] case default help_text=[character(len=widest) :: help_text, & & ' unknown help topic "'//trim(unnamed(i))//'"'] @@ -528,6 +540,11 @@ subroutine get_command_line_settings(cmd_settings) fetch_only=lget('fetch-only'), verbose=lget('verbose'), & clean=lget('clean')) + case('clean') + call set_args(common_args, help_clean) + allocate(fpm_clean_settings :: cmd_settings) + cmd_settings=fpm_clean_settings(unix=unix) + case default if(which('fpm-'//cmdarg).ne.'')then @@ -607,6 +624,7 @@ subroutine set_help() ' test Run the test programs ', & ' update Update and manage project dependencies ', & ' install Install project ', & + ' clean Delete the "build" directory ', & ' ', & ' Enter "fpm --list" for a brief list of subcommand options. Enter ', & ' "fpm --help" or "fpm SUBCOMMAND --help" for detailed descriptions. ', & @@ -728,6 +746,7 @@ subroutine set_help() ' + help Alternate to the --help switch for displaying help text. ', & ' + list Display brief descriptions of all subcommands. ', & ' + install Install project ', & + ' + clean Delete the "build" directory ', & ' ', & ' Their syntax is ', & ' ', & @@ -743,7 +762,8 @@ subroutine set_help() ' help [NAME(s)] ', & ' list [--list] ', & ' install [--profile PROF] [--flag FFLAGS] [--no-rebuild] [--prefix PATH] ', & - ' [options] ', & + ' [options] ', & + ' clean ', & ' ', & 'SUBCOMMAND OPTIONS ', & ' -C, --directory PATH', & @@ -809,6 +829,7 @@ subroutine set_help() ' fpm new --help ', & ' fpm run myprogram --profile release -- -x 10 -y 20 --title "my title" ', & ' fpm install --prefix ~/.local ', & + ' fpm clean ', & ' ', & 'SEE ALSO ', & ' ', & @@ -1219,7 +1240,20 @@ subroutine set_help() '', & ' fpm install --prefix $PWD --bindir exe', & '' ] - end subroutine set_help + help_clean=[character(len=80) :: & + 'NAME', & + ' clean(1) - delete the "build" directory', & + '', & + 'SYNOPSIS', & + ' fpm clean', & + '', & + 'DESCRIPTION', & + ' Prompts the user to confirm deletion of the "build" directory. If affirmative,', & + ' the "build" directory in the project root is deleted using os system specific', & + ' commands, forcing the recursive removal of all files and directories,', & + ' including dependencies.', & + '' ] + end subroutine set_help subroutine get_char_arg(var, arg) character(len=:), allocatable, intent(out) :: var From 9bc544815a8938bccbe35719cf5f310faf15bb6b Mon Sep 17 00:00:00 2001 From: Andre Smit Date: Mon, 28 Feb 2022 11:51:06 -0600 Subject: [PATCH 02/19] delete pasted tabs --- src/fpm.f90 | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/fpm.f90 b/src/fpm.f90 index 899d232829..e53478246f 100644 --- a/src/fpm.f90 +++ b/src/fpm.f90 @@ -505,21 +505,21 @@ end subroutine cmd_run subroutine cmd_clean(settings) class(fpm_clean_settings), intent(in) :: settings - character(len=1) :: response - if (is_dir("build")) then - write(stdout, '(A)', advance='no') "Delete the build directory (y/n)? " - read(stdin, '(A1)') response - if (lower(response) == 'y') then - if(settings%unix) then - call run('rm -rf build', .false.) - else - call run('rmdir /s/q build', .false.) - end if - else - write (stdout, '(A)') "fpm: The response was not affirmative, build directory was not deleted." - end if - else - write (stdout, '(A)') "fpm: No build directory found." + character(len=1) :: response + if (is_dir("build")) then + write(stdout, '(A)', advance='no') "Delete the build directory (y/n)? " + read(stdin, '(A1)') response + if (lower(response) == 'y') then + if(settings%unix) then + call run('rm -rf build', .false.) + else + call run('rmdir /s/q build', .false.) + end if + else + write (stdout, '(A)') "fpm: The response was not affirmative, build directory was not deleted." + end if + else + write (stdout, '(A)') "fpm: No build directory found." end if end subroutine cmd_clean From 4e13822d5cc89d831c84375a0da19755abc6188f Mon Sep 17 00:00:00 2001 From: Andre Smit Date: Mon, 28 Feb 2022 19:16:31 -0600 Subject: [PATCH 03/19] Update src/fpm.f90 Brevity is the soul of wit. - WS Co-authored-by: Ivan Pribec --- src/fpm.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fpm.f90 b/src/fpm.f90 index e53478246f..9cda674c4a 100644 --- a/src/fpm.f90 +++ b/src/fpm.f90 @@ -516,7 +516,7 @@ subroutine cmd_clean(settings) call run('rmdir /s/q build', .false.) end if else - write (stdout, '(A)') "fpm: The response was not affirmative, build directory was not deleted." + write (stdout, '(A)') "fpm: Build directory was not deleted." end if else write (stdout, '(A)') "fpm: No build directory found." From d9b272fedab91ae06b48b665bbd0837f533571aa Mon Sep 17 00:00:00 2001 From: Andre Smit Date: Fri, 4 Mar 2022 08:49:34 -0600 Subject: [PATCH 04/19] add clean calling directory --- src/fpm.f90 | 1 + src/fpm_command_line.f90 | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/fpm.f90 b/src/fpm.f90 index 9cda674c4a..7c78c5080d 100644 --- a/src/fpm.f90 +++ b/src/fpm.f90 @@ -506,6 +506,7 @@ end subroutine cmd_run subroutine cmd_clean(settings) class(fpm_clean_settings), intent(in) :: settings character(len=1) :: response + write(stdout, '(*(a))') "fpm: Clean calling directory '"//settings%calling_dir//"'" if (is_dir("build")) then write(stdout, '(A)', advance='no') "Delete the build directory (y/n)? " read(stdin, '(A1)') response diff --git a/src/fpm_command_line.f90 b/src/fpm_command_line.f90 index 4fce224cf5..a6d3fec473 100644 --- a/src/fpm_command_line.f90 +++ b/src/fpm_command_line.f90 @@ -106,7 +106,8 @@ module fpm_command_line end type type, extends(fpm_cmd_settings) :: fpm_clean_settings - logical :: unix + logical :: unix ! is the system os unix? + character(len=:), allocatable :: calling_dir ! directory clean called from end type character(len=:),allocatable :: name @@ -481,6 +482,7 @@ subroutine get_command_line_settings(cmd_settings) if(lget('list'))then call printhelp(help_list_dash) endif + case('test') call set_args(common_args // compiler_args // run_args // ' --', & help_test,version_text) @@ -543,7 +545,8 @@ subroutine get_command_line_settings(cmd_settings) case('clean') call set_args(common_args, help_clean) allocate(fpm_clean_settings :: cmd_settings) - cmd_settings=fpm_clean_settings(unix=unix) + call get_current_directory(working_dir, error) + cmd_settings=fpm_clean_settings(unix=unix, calling_dir=working_dir) case default From 8185a8a72790a9b566ba60c3a06ce6bb2aab9378 Mon Sep 17 00:00:00 2001 From: Andre Smit Date: Fri, 4 Mar 2022 09:04:02 -0600 Subject: [PATCH 05/19] fix clean tests --- test/help_test/help_test.f90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/help_test/help_test.f90 b/test/help_test/help_test.f90 index 4f23bcb830..1a032e3fcb 100644 --- a/test/help_test/help_test.f90 +++ b/test/help_test/help_test.f90 @@ -33,6 +33,7 @@ program help_test ' help install >> fpm_scratch_help.txt',& ' help list >> fpm_scratch_help.txt',& ' help help >> fpm_scratch_help.txt',& +' help clean >> fpm_scratch_help.txt',& ' --version >> fpm_scratch_help.txt',& ! generate manual ' help manual > fpm_scratch_manual.txt'] @@ -41,7 +42,7 @@ program help_test !'fpm run -- --list >> fpm_scratch_help.txt',& !'fpm run -- list --list >> fpm_scratch_help.txt',& character(len=*),parameter :: names(*)=[character(len=10) ::& - 'fpm','new','update','build','run','test','runner','install','list','help'] + 'fpm','new','update','build','run','test','runner','install','list','help','clean'] character(len=:), allocatable :: prog integer :: length From 7c3c36fbdf8130b0c4af0f6cb4029c801f3c0454 Mon Sep 17 00:00:00 2001 From: Andre Smit Date: Wed, 16 Mar 2022 11:38:13 -0500 Subject: [PATCH 06/19] update clean subcommand adding --skip and --all flags --- src/fpm.f90 | 47 ++++++++++++++++++++++++++---------- src/fpm_command_line.f90 | 51 ++++++++++++++++++++++++++-------------- src/fpm_filesystem.F90 | 19 +++++++++++---- 3 files changed, 83 insertions(+), 34 deletions(-) diff --git a/src/fpm.f90 b/src/fpm.f90 index 7c78c5080d..82bb055f81 100644 --- a/src/fpm.f90 +++ b/src/fpm.f90 @@ -7,7 +7,7 @@ module fpm use fpm_dependency, only : new_dependency_tree use fpm_environment, only: get_env use fpm_filesystem, only: is_dir, join_path, number_of_rows, list_files, exists, & - basename, filewrite, mkdir, run + basename, filewrite, mkdir, run, os_delete_dir use fpm_model, only: fpm_model_t, srcfile_t, show_model, & FPM_SCOPE_UNKNOWN, FPM_SCOPE_LIB, FPM_SCOPE_DEP, & FPM_SCOPE_APP, FPM_SCOPE_EXAMPLE, FPM_SCOPE_TEST @@ -23,6 +23,7 @@ module fpm use,intrinsic :: iso_fortran_env, only : stdin=>input_unit, & & stdout=>output_unit, & & stderr=>error_unit +use iso_c_binding, only: c_char, c_ptr, c_int, c_null_char, c_associated, c_f_pointer implicit none private public :: cmd_build, cmd_run, cmd_clean @@ -503,22 +504,42 @@ end subroutine compact_list end subroutine cmd_run +subroutine delete_skip(unix) + !> delete directories in the build folder, skipping dependencies + logical, intent(in) :: unix + character(len=:), allocatable :: dir + type(string_t), allocatable :: files(:) + integer :: i + call list_files('build', files, .false.) + do i = 1, size(files) + if (is_dir(files(i)%s)) then + dir = files(i)%s + if (dir /= 'build/dependencies') call os_delete_dir(unix, dir) + end if + end do +end subroutine delete_skip + subroutine cmd_clean(settings) + !> fpm clean called class(fpm_clean_settings), intent(in) :: settings + ! character(len=:), allocatable :: dir + ! type(string_t), allocatable :: files(:) character(len=1) :: response - write(stdout, '(*(a))') "fpm: Clean calling directory '"//settings%calling_dir//"'" - if (is_dir("build")) then - write(stdout, '(A)', advance='no') "Delete the build directory (y/n)? " - read(stdin, '(A1)') response - if (lower(response) == 'y') then - if(settings%unix) then - call run('rm -rf build', .false.) - else - call run('rmdir /s/q build', .false.) - end if - else - write (stdout, '(A)') "fpm: Build directory was not deleted." + if (is_dir('build')) then + ! remove the entire build directory + if (settings%clean_call) then + call os_delete_dir(settings%unix, 'build') + return end if + ! remove the build directory but skip dependencies + if (settings%clean_skip) then + call delete_skip(settings%unix) + return + end if + ! prompt to remove the build directory but skip dependencies + write(stdout, '(A)', advance='no') "Delete build, excluding dependencies (y/n)? " + read(stdin, '(A1)') response + if (lower(response) == 'y') call delete_skip(settings%unix) else write (stdout, '(A)') "fpm: No build directory found." end if diff --git a/src/fpm_command_line.f90 b/src/fpm_command_line.f90 index a6d3fec473..a4319f32ac 100644 --- a/src/fpm_command_line.f90 +++ b/src/fpm_command_line.f90 @@ -105,9 +105,11 @@ module fpm_command_line logical :: clean end type -type, extends(fpm_cmd_settings) :: fpm_clean_settings - logical :: unix ! is the system os unix? +type, extends(fpm_cmd_settings) :: fpm_clean_settings + logical :: unix character(len=:), allocatable :: calling_dir ! directory clean called from + logical :: clean_skip=.false. + logical :: clean_call=.false. end type character(len=:),allocatable :: name @@ -543,10 +545,17 @@ subroutine get_command_line_settings(cmd_settings) clean=lget('clean')) case('clean') - call set_args(common_args, help_clean) + call set_args(common_args // & + & ' --skip' // & + & ' --all', & + help_install, version_text) allocate(fpm_clean_settings :: cmd_settings) call get_current_directory(working_dir, error) - cmd_settings=fpm_clean_settings(unix=unix, calling_dir=working_dir) + cmd_settings=fpm_clean_settings( & + & unix=unix, & + & calling_dir=working_dir, & + & clean_skip=lget('skip'), & + clean_call=lget('all')) case default @@ -627,7 +636,7 @@ subroutine set_help() ' test Run the test programs ', & ' update Update and manage project dependencies ', & ' install Install project ', & - ' clean Delete the "build" directory ', & + ' clean Delete the build ', & ' ', & ' Enter "fpm --list" for a brief list of subcommand options. Enter ', & ' "fpm --help" or "fpm SUBCOMMAND --help" for detailed descriptions. ', & @@ -647,6 +656,7 @@ subroutine set_help() ' [--list] [--compiler COMPILER_NAME] [-- ARGS] ', & ' install [--profile PROF] [--flag FFLAGS] [--no-rebuild] [--prefix PATH] ', & ' [options] ', & + ' clean [--skip] [--all] ', & ' '] help_usage=[character(len=80) :: & '' ] @@ -743,13 +753,14 @@ subroutine set_help() ' + build Compile the packages into the "build/" directory. ', & ' + new Create a new Fortran package directory with sample files. ', & ' + update Update the project dependencies. ', & - ' + run Run the local package binaries. defaults to all binaries ', & + ' + run Run the local package binaries. Defaults to all binaries ', & ' for that release. ', & ' + test Run the tests. ', & ' + help Alternate to the --help switch for displaying help text. ', & ' + list Display brief descriptions of all subcommands. ', & - ' + install Install project ', & - ' + clean Delete the "build" directory ', & + ' + install Install project. ', & + ' + clean Delete directories in the build/ directory, except ', & + ' dependencies. Prompts for confirmation to delete. ', & ' ', & ' Their syntax is ', & ' ', & @@ -766,7 +777,7 @@ subroutine set_help() ' list [--list] ', & ' install [--profile PROF] [--flag FFLAGS] [--no-rebuild] [--prefix PATH] ', & ' [options] ', & - ' clean ', & + ' clean [--skip] [-all] ', & ' ', & 'SUBCOMMAND OPTIONS ', & ' -C, --directory PATH', & @@ -782,6 +793,10 @@ subroutine set_help() ' the fpm(1) command this shows a brief list of subcommands.', & ' --runner CMD Provides a command to prefix program execution paths. ', & ' -- ARGS Arguments to pass to executables. ', & + ' --skip Delete directories in the build/ directory without ', & + ' prompting, but skip dependencies. ', & + ' --all Delete directories in the build/ directory without ', & + ' prompting, including dependencies. ', & ' ', & 'VALID FOR ALL SUBCOMMANDS ', & ' --help Show help text and exit ', & @@ -832,7 +847,7 @@ subroutine set_help() ' fpm new --help ', & ' fpm run myprogram --profile release -- -x 10 -y 20 --title "my title" ', & ' fpm install --prefix ~/.local ', & - ' fpm clean ', & + ' fpm clean --all ', & ' ', & 'SEE ALSO ', & ' ', & @@ -1022,8 +1037,8 @@ subroutine set_help() 'NAME ', & ' new(1) - the fpm(1) subcommand to initialize a new project ', & 'SYNOPSIS ', & - ' fpm new NAME [[--lib|--src] [--app] [--test] [--example]]| ', & - ' [--full|--bare][--backfill] ', & + ' fpm new NAME [[--lib|--src] [--app] [--test] [--example]]| ', & + ' [--full|--bare][--backfill] ', & ' fpm new --help|--version ', & ' ', & 'DESCRIPTION ', & @@ -1245,16 +1260,18 @@ subroutine set_help() '' ] help_clean=[character(len=80) :: & 'NAME', & - ' clean(1) - delete the "build" directory', & + ' clean(1) - delete the build', & '', & 'SYNOPSIS', & ' fpm clean', & '', & 'DESCRIPTION', & - ' Prompts the user to confirm deletion of the "build" directory. If affirmative,', & - ' the "build" directory in the project root is deleted using os system specific', & - ' commands, forcing the recursive removal of all files and directories,', & - ' including dependencies.', & + ' Prompts the user to confirm deletion of the build. If affirmative,', & + ' directories in the build/ directory are deleted, except dependencies.', & + '', & + 'OPTIONS', & + ' --skip delete the build without prompting but skip dependencies.', & + ' --all delete the build without prompting including dependencies.', & '' ] end subroutine set_help diff --git a/src/fpm_filesystem.F90 b/src/fpm_filesystem.F90 index 15292ec99f..57c9a06053 100644 --- a/src/fpm_filesystem.F90 +++ b/src/fpm_filesystem.F90 @@ -17,6 +17,7 @@ module fpm_filesystem public :: is_hidden_file public :: read_lines, read_lines_expanded public :: which, run, LINE_BUFFER_LEN + public :: os_delete_dir integer, parameter :: LINE_BUFFER_LEN = 1000 @@ -365,7 +366,7 @@ subroutine mkdir(dir, echo) integer :: stat logical :: echo_local - + if(present(echo))then echo_local=echo else @@ -384,7 +385,7 @@ subroutine mkdir(dir, echo) case (OS_WINDOWS) call execute_command_line("mkdir " // windows_path(dir), exitstat=stat) - + if (echo_local) then write (*, '(" + ",2a)') 'mkdir ' // windows_path(dir) end if @@ -885,7 +886,7 @@ subroutine run(cmd,echo,exitstat,verbose,redirect) else verbose_local=.true. end if - + if (present(redirect)) then redirect_str = ">"//redirect//" 2>&1" else @@ -917,7 +918,7 @@ subroutine run(cmd,echo,exitstat,verbose,redirect) close(fh) end if - + if (present(exitstat)) then exitstat = stat else @@ -928,5 +929,15 @@ subroutine run(cmd,echo,exitstat,verbose,redirect) end subroutine run +!> delete dir using system os remove directory commands +subroutine os_delete_dir(unix, dir) + logical, intent(in) :: unix + character(len=*), intent(in) :: dir + if (unix) then + call run('rm -rf ' // dir, .false.) + else + call run('rmdir /s/q ' // dir, .false.) + end if +end subroutine os_delete_dir end module fpm_filesystem From 4eab3f1a20933093cbbd5f24b1d042e53cef94e4 Mon Sep 17 00:00:00 2001 From: Andre Smit Date: Thu, 17 Mar 2022 09:56:38 -0500 Subject: [PATCH 07/19] add - to all flag --- src/fpm_command_line.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fpm_command_line.f90 b/src/fpm_command_line.f90 index a4319f32ac..247e3d9f44 100644 --- a/src/fpm_command_line.f90 +++ b/src/fpm_command_line.f90 @@ -777,7 +777,7 @@ subroutine set_help() ' list [--list] ', & ' install [--profile PROF] [--flag FFLAGS] [--no-rebuild] [--prefix PATH] ', & ' [options] ', & - ' clean [--skip] [-all] ', & + ' clean [--skip] [--all] ', & ' ', & 'SUBCOMMAND OPTIONS ', & ' -C, --directory PATH', & @@ -826,8 +826,8 @@ subroutine set_help() ' # my build options ', & ' options build ', & ' options --compiler gfortran ', & - ' options --flag "-pg -static -pthread -Wunreachable-code -Wunused \', & - ' -Wuninitialized -g -O -fbacktrace -fdump-core -fno-underscoring \', & + ' options --flag "-pg -static -pthread -Wunreachable-code -Wunused ', & + ' -Wuninitialized -g -O -fbacktrace -fdump-core -fno-underscoring ', & ' -frecord-marker=4 -L/usr/X11R6/lib -L/usr/X11R6/lib64 -lX11" ', & ' ', & ' Note --flag would have to be on one line as response files do not ', & From 1fb3deb9a47abf325120547e4869133a76837acf Mon Sep 17 00:00:00 2001 From: Andre Smit Date: Wed, 30 Mar 2022 08:43:51 -0500 Subject: [PATCH 08/19] Update fpm_command_line.f90 add missing dash to clean all option --- src/fpm_command_line.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fpm_command_line.f90 b/src/fpm_command_line.f90 index a4319f32ac..a19ff1f23a 100644 --- a/src/fpm_command_line.f90 +++ b/src/fpm_command_line.f90 @@ -777,7 +777,7 @@ subroutine set_help() ' list [--list] ', & ' install [--profile PROF] [--flag FFLAGS] [--no-rebuild] [--prefix PATH] ', & ' [options] ', & - ' clean [--skip] [-all] ', & + ' clean [--skip] [--all] ', & ' ', & 'SUBCOMMAND OPTIONS ', & ' -C, --directory PATH', & From a559c129122ee32bb7521a7d4a6415a52ee6079d Mon Sep 17 00:00:00 2001 From: Andre Smit Date: Fri, 15 Apr 2022 08:35:13 -0500 Subject: [PATCH 09/19] wyphan's patches --- src/fpm/installer.f90 | 30 +++++++++- src/fpm_command_line.f90 | 2 +- src/fpm_filesystem.F90 | 29 +++++++-- test/cli_test/cli_test.f90 | 24 ++++++-- test/fpm_test/test_filesystem.f90 | 99 ++++++++++++++++++++++++++++++- 5 files changed, 170 insertions(+), 14 deletions(-) diff --git a/src/fpm/installer.f90 b/src/fpm/installer.f90 index d01bd27348..4e138d10e3 100644 --- a/src/fpm/installer.f90 +++ b/src/fpm/installer.f90 @@ -31,6 +31,8 @@ module fpm_installer integer :: verbosity = 1 !> Command to copy objects into the installation prefix character(len=:), allocatable :: copy + !> Command to move objects into the installation prefix + character(len=:), allocatable :: move !> Cached operating system integer :: os contains @@ -69,11 +71,18 @@ module fpm_installer !> Copy command on Windows platforms character(len=*), parameter :: default_copy_win = "copy" + !> Move command on Unix platforms + character(len=*), parameter :: default_move_unix = "mv" + + !> Move command on Windows platforms + character(len=*), parameter :: default_move_win = "move" + + contains !> Create a new instance of an installer subroutine new_installer(self, prefix, bindir, libdir, includedir, verbosity, & - copy) + copy, move) !> Instance of the installer type(installer_t), intent(out) :: self !> Path to installation directory @@ -88,6 +97,8 @@ subroutine new_installer(self, prefix, bindir, libdir, includedir, verbosity, & integer, intent(in), optional :: verbosity !> Copy command character(len=*), intent(in), optional :: copy + !> Move command + character(len=*), intent(in), optional :: move self%os = get_os_type() @@ -101,6 +112,16 @@ subroutine new_installer(self, prefix, bindir, libdir, includedir, verbosity, & end if end if + if (present(move)) then + self%move = move + else + if (os_is_unix(self%os)) then + self%move = default_move_unix + else + self%move = default_move_win + end if + end if + if (present(includedir)) then self%includedir = includedir else @@ -238,7 +259,12 @@ subroutine install(self, source, destination, error) end if end if - call self%run(self%copy//' "'//source//'" "'//install_dest//'"', error) + ! move instead of copy if already installed + if (exists(install_dest)) then + call self%run(self%move//' "'//source//'" "'//install_dest//'"', error) + else + call self%run(self%copy//' "'//source//'" "'//install_dest//'"', error) + end if if (allocated(error)) return end subroutine install diff --git a/src/fpm_command_line.f90 b/src/fpm_command_line.f90 index 247e3d9f44..1bf9244b1f 100644 --- a/src/fpm_command_line.f90 +++ b/src/fpm_command_line.f90 @@ -759,7 +759,7 @@ subroutine set_help() ' + help Alternate to the --help switch for displaying help text. ', & ' + list Display brief descriptions of all subcommands. ', & ' + install Install project. ', & - ' + clean Delete directories in the build/ directory, except ', & + ' + clean Delete directories in the "build/" directory, except ', & ' dependencies. Prompts for confirmation to delete. ', & ' ', & ' Their syntax is ', & diff --git a/src/fpm_filesystem.F90 b/src/fpm_filesystem.F90 index 57c9a06053..66e7d66230 100644 --- a/src/fpm_filesystem.F90 +++ b/src/fpm_filesystem.F90 @@ -369,9 +369,9 @@ subroutine mkdir(dir, echo) if(present(echo))then echo_local=echo - else + else echo_local=.true. - end if + end if if (is_dir(dir)) return @@ -929,15 +929,36 @@ subroutine run(cmd,echo,exitstat,verbose,redirect) end subroutine run -!> delete dir using system os remove directory commands -subroutine os_delete_dir(unix, dir) +!> Delete directory using system OS remove directory commands +subroutine os_delete_dir(unix, dir, echo) logical, intent(in) :: unix character(len=*), intent(in) :: dir + logical, intent(in), optional :: echo + + logical :: echo_local + + if(present(echo))then + echo_local=echo + else + echo_local=.true. + end if + if (unix) then call run('rm -rf ' // dir, .false.) + + if (echo_local) then + write (*, '(" + ",2a)') 'rm -rf ' // dir + end if + else call run('rmdir /s/q ' // dir, .false.) + + if (echo_local) then + write (*, '(" + ",2a)') 'rmdir /s/q ' // dir + end if + end if + end subroutine os_delete_dir end module fpm_filesystem diff --git a/test/cli_test/cli_test.f90 b/test/cli_test/cli_test.f90 index e23afde2bf..855c7503c7 100644 --- a/test/cli_test/cli_test.f90 +++ b/test/cli_test/cli_test.f90 @@ -27,10 +27,12 @@ program main integer :: i, ios logical :: w_e,act_w_e ; namelist/act_cli/act_w_e logical :: w_t,act_w_t ; namelist/act_cli/act_w_t +logical :: c_s,act_c_s ; namelist/act_cli/act_c_s +logical :: c_a,act_c_a ; namelist/act_cli/act_c_a character(len=63) :: profile,act_profile ; namelist/act_cli/act_profile character(len=:),allocatable :: args,act_args ; namelist/act_cli/act_args -namelist/expected/cmd,cstat,estat,w_e,w_t,name,profile,args +namelist/expected/cmd,cstat,estat,w_e,w_t,c_s,c_a,name,profile,args integer :: lun logical,allocatable :: tally(:) logical,allocatable :: subtally(:) @@ -42,7 +44,7 @@ program main 'CMD="new", ESTAT=1,', & !'CMD="new -unknown", ESTAT=2,', & 'CMD="new my_project another yet_another -test", ESTAT=2,', & -'CMD="new my_project --app", W_E=T, NAME="my_project",', & +'CMD="new my_project --app", W_E=T, NAME="my_project",', & 'CMD="new my_project --app --test", W_E=T,W_T=T, NAME="my_project",', & 'CMD="new my_project --test", W_T=T, NAME="my_project",', & 'CMD="new my_project", W_E=T,W_T=T, NAME="my_project",', & @@ -64,7 +66,11 @@ program main &NAME="proj1","p2","project3",profile="release" ARGS="""arg1"" ""-x"" ""and a long one""", ', & 'CMD="build", NAME= profile="",ARGS="",', & -'CMD="build --profile release", NAME= profile="release",ARGS="",', & +'CMD="build --profile release", NAME= profile="release",ARGS="",', & + +'CMD="clean", NAME= ARGS="",', & +'CMD="clean --skip", C_S=T, NAME= ARGS="",', & +'CMD="clean --all", C_A=T, NAME= ARGS="",', & ' ' ] character(len=256) :: readme(3) @@ -95,6 +101,8 @@ program main profile="" ! --profile PROF w_e=.false. ! --app w_t=.false. ! --test + c_s=.false. ! --skip + c_a=.false. ! --all args=repeat(' ',132) ! -- ARGS cmd=repeat(' ',132) ! the command line arguments to test cstat=0 ! status values from EXECUTE_COMMAND_LINE() @@ -112,6 +120,8 @@ program main act_profile='' act_w_e=.false. act_w_t=.false. + act_c_s=.false. + act_c_a=.false. act_args=repeat(' ',132) read(lun,nml=act_cli,iostat=ios,iomsg=message) if(ios.ne.0)then @@ -193,9 +203,10 @@ subroutine parse() fpm_build_settings, & fpm_run_settings, & fpm_test_settings, & + fpm_clean_settings, & fpm_install_settings, & get_command_line_settings -use fpm, only: cmd_build, cmd_run +use fpm, only: cmd_build, cmd_run, cmd_clean use fpm_cmd_install, only: cmd_install use fpm_cmd_new, only: cmd_new class(fpm_cmd_settings), allocatable :: cmd_settings @@ -206,6 +217,8 @@ subroutine parse() act_args='' act_w_e=.false. act_w_t=.false. +act_c_s=.false. +act_c_a=.false. act_profile='' select type(settings=>cmd_settings) @@ -223,6 +236,9 @@ subroutine parse() act_profile=settings%profile act_name=settings%name act_args=settings%args +type is (fpm_clean_settings) + act_c_s=settings%clean_skip + act_c_a=settings%clean_call type is (fpm_install_settings) end select diff --git a/test/fpm_test/test_filesystem.f90 b/test/fpm_test/test_filesystem.f90 index 94eadda9ed..92ab3d6c37 100644 --- a/test/fpm_test/test_filesystem.f90 +++ b/test/fpm_test/test_filesystem.f90 @@ -1,6 +1,7 @@ module test_filesystem use testsuite, only : new_unittest, unittest_t, error_t, test_failed - use fpm_filesystem, only: canon_path + use fpm_filesystem, only: canon_path, is_dir, mkdir, os_delete_dir + use fpm_environment, only: OS_WINDOWS, get_os_type, os_is_unix implicit none private @@ -16,7 +17,8 @@ subroutine collect_filesystem(testsuite) type(unittest_t), allocatable, intent(out) :: testsuite(:) testsuite = [ & - & new_unittest("canon-path", test_canon_path) & + & new_unittest("canon-path", test_canon_path), & + & new_unittest("create-delete-directory", test_mkdir_rmdir) & ] end subroutine collect_filesystem @@ -96,11 +98,102 @@ subroutine check_string(error, actual, expected) if (actual /= expected) then call test_failed(error, & - "Character value missmatch "//& + "Character value mismatch "//& "expected '"//expected//"' but got '"//actual//"'") end if end subroutine check_string + subroutine test_mkdir_rmdir(error) + + !> Error handling + type(error_t), allocatable, intent(out) :: error + + logical :: is_win + + is_win = (get_os_type() == OS_WINDOWS) + + if (is_win) then + call check_mkdir(error, "tmpdir\subdir") + else + call check_mkdir(error, "tmpdir/subdir") + end if + if (allocated(error)) return + + if (is_win) then + call check_rmdir(error, "tmpdir\subdir") + else + call check_rmdir(error, "tmpdir/subdir") + end if + if (allocated(error)) return + + call check_rmdir(error, "tmpdir") + if (allocated(error)) return + + end subroutine test_mkdir_rmdir + + + !> Create a directory and verify its existence + subroutine check_mkdir(error, path) + + !> Error handling + type(error_t), allocatable, intent(out) :: error + + !> Directory path + character(len=*), intent(in) :: path + + logical :: stat + + ! Directory shouldn't exist before it's created + stat = (is_dir(path) .eqv. .false.) + if (.not. stat) then + call test_failed(error, & + "Directory path "//path//" already exists before its creation") + end if + + ! Create directory + call mkdir(path) + + ! Check that directory is indeed created + stat = (is_dir(path) .eqv. .true.) + if (.not. stat) then + call test_failed(error, & + "Directory path "//path//" cannot be created") + end if + + end subroutine check_mkdir + + + !> Create a directory and verify its existence + subroutine check_rmdir(error, path) + + !> Error handling + type(error_t), allocatable, intent(out) :: error + + !> Directory path + character(len=*), intent(in) :: path + + logical :: stat + + ! Directory should exist before it's deleted + stat = (is_dir(path) .eqv. .true.) + if (.not. stat) then + call test_failed(error, & + "Directory path "//path//" doesn't exist before its deletion") + end if + + ! Delete directory + call os_delete_dir(os_is_unix(),path) + + ! Check that directory is indeed deleted + stat = (is_dir(path) .eqv. .false.) + if (.not. stat) then + call test_failed(error, & + "Directory path "//path//" cannot be deleted") + end if + + end subroutine check_rmdir + + end module test_filesystem From 28a44c4af25b6885df822d77fe8e28fc21152e68 Mon Sep 17 00:00:00 2001 From: Andre Smit Date: Wed, 20 Apr 2022 05:57:05 -0500 Subject: [PATCH 10/19] Update src/fpm_command_line.f90 Co-authored-by: Laurence Kedward --- src/fpm_command_line.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fpm_command_line.f90 b/src/fpm_command_line.f90 index 1bf9244b1f..f9eb61c376 100644 --- a/src/fpm_command_line.f90 +++ b/src/fpm_command_line.f90 @@ -548,7 +548,7 @@ subroutine get_command_line_settings(cmd_settings) call set_args(common_args // & & ' --skip' // & & ' --all', & - help_install, version_text) + help_clean, version_text) allocate(fpm_clean_settings :: cmd_settings) call get_current_directory(working_dir, error) cmd_settings=fpm_clean_settings( & From 6d9bd0c49f88264cd6800776eca82d4a1ac0993c Mon Sep 17 00:00:00 2001 From: Andre Smit Date: Wed, 20 Apr 2022 05:58:56 -0500 Subject: [PATCH 11/19] Update src/fpm.f90 Co-authored-by: Laurence Kedward --- src/fpm.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fpm.f90 b/src/fpm.f90 index 82bb055f81..7e9d125fa6 100644 --- a/src/fpm.f90 +++ b/src/fpm.f90 @@ -514,7 +514,7 @@ subroutine delete_skip(unix) do i = 1, size(files) if (is_dir(files(i)%s)) then dir = files(i)%s - if (dir /= 'build/dependencies') call os_delete_dir(unix, dir) + if (.not.str_ends_with(dir,'dependencies')) call os_delete_dir(unix, dir) end if end do end subroutine delete_skip From 25ead89ca9b77d10654655c11097a5a77fbfce3a Mon Sep 17 00:00:00 2001 From: Andre Smit Date: Wed, 20 Apr 2022 05:59:11 -0500 Subject: [PATCH 12/19] Update test/fpm_test/test_filesystem.f90 Co-authored-by: Laurence Kedward --- test/fpm_test/test_filesystem.f90 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/fpm_test/test_filesystem.f90 b/test/fpm_test/test_filesystem.f90 index 92ab3d6c37..343877ec27 100644 --- a/test/fpm_test/test_filesystem.f90 +++ b/test/fpm_test/test_filesystem.f90 @@ -143,11 +143,8 @@ subroutine check_mkdir(error, path) !> Directory path character(len=*), intent(in) :: path - logical :: stat - ! Directory shouldn't exist before it's created - stat = (is_dir(path) .eqv. .false.) - if (.not. stat) then + if (is_dir(path)) then call test_failed(error, & "Directory path "//path//" already exists before its creation") end if From 6a5590cb8abacf93ad7d0e78c9c89f0ebc8d2a84 Mon Sep 17 00:00:00 2001 From: Andre Smit Date: Wed, 20 Apr 2022 06:00:20 -0500 Subject: [PATCH 13/19] Update test/fpm_test/test_filesystem.f90 Co-authored-by: Laurence Kedward --- test/fpm_test/test_filesystem.f90 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/fpm_test/test_filesystem.f90 b/test/fpm_test/test_filesystem.f90 index 343877ec27..8c2db71f37 100644 --- a/test/fpm_test/test_filesystem.f90 +++ b/test/fpm_test/test_filesystem.f90 @@ -153,8 +153,7 @@ subroutine check_mkdir(error, path) call mkdir(path) ! Check that directory is indeed created - stat = (is_dir(path) .eqv. .true.) - if (.not. stat) then + if (.not.is_dir(path)) then call test_failed(error, & "Directory path "//path//" cannot be created") end if From d9b970a5f5be13b2d58cca69c69879c7b542098e Mon Sep 17 00:00:00 2001 From: Andre Smit Date: Wed, 20 Apr 2022 06:00:53 -0500 Subject: [PATCH 14/19] Update test/fpm_test/test_filesystem.f90 Co-authored-by: Laurence Kedward --- test/fpm_test/test_filesystem.f90 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/fpm_test/test_filesystem.f90 b/test/fpm_test/test_filesystem.f90 index 8c2db71f37..efba4a9820 100644 --- a/test/fpm_test/test_filesystem.f90 +++ b/test/fpm_test/test_filesystem.f90 @@ -170,11 +170,8 @@ subroutine check_rmdir(error, path) !> Directory path character(len=*), intent(in) :: path - logical :: stat - ! Directory should exist before it's deleted - stat = (is_dir(path) .eqv. .true.) - if (.not. stat) then + if (.not. is_dir(path)) then call test_failed(error, & "Directory path "//path//" doesn't exist before its deletion") end if From 074d9903632dcdc5af6b94854007142f8353a45e Mon Sep 17 00:00:00 2001 From: Andre Smit Date: Wed, 20 Apr 2022 06:01:22 -0500 Subject: [PATCH 15/19] Update test/fpm_test/test_filesystem.f90 Co-authored-by: Laurence Kedward --- test/fpm_test/test_filesystem.f90 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/fpm_test/test_filesystem.f90 b/test/fpm_test/test_filesystem.f90 index efba4a9820..8e77ff50b0 100644 --- a/test/fpm_test/test_filesystem.f90 +++ b/test/fpm_test/test_filesystem.f90 @@ -180,8 +180,7 @@ subroutine check_rmdir(error, path) call os_delete_dir(os_is_unix(),path) ! Check that directory is indeed deleted - stat = (is_dir(path) .eqv. .false.) - if (.not. stat) then + if (is_dir(path)) then call test_failed(error, & "Directory path "//path//" cannot be deleted") end if From 2a52aa911295443c2d297d37638c0bf46f50552c Mon Sep 17 00:00:00 2001 From: Andre Smit Date: Wed, 20 Apr 2022 06:02:26 -0500 Subject: [PATCH 16/19] Update test/fpm_test/test_filesystem.f90 Co-authored-by: Laurence Kedward --- test/fpm_test/test_filesystem.f90 | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/test/fpm_test/test_filesystem.f90 b/test/fpm_test/test_filesystem.f90 index 8e77ff50b0..e7849566f2 100644 --- a/test/fpm_test/test_filesystem.f90 +++ b/test/fpm_test/test_filesystem.f90 @@ -110,15 +110,8 @@ subroutine test_mkdir_rmdir(error) !> Error handling type(error_t), allocatable, intent(out) :: error - logical :: is_win - is_win = (get_os_type() == OS_WINDOWS) - - if (is_win) then - call check_mkdir(error, "tmpdir\subdir") - else - call check_mkdir(error, "tmpdir/subdir") - end if + call check_mkdir(error, join_path("tmpdir","subdir")) if (allocated(error)) return if (is_win) then From 3dd86582c6e7b440f4af2e803db25c1cbb7f13b1 Mon Sep 17 00:00:00 2001 From: Andre Smit Date: Wed, 20 Apr 2022 06:03:31 -0500 Subject: [PATCH 17/19] Update test/fpm_test/test_filesystem.f90 Co-authored-by: Laurence Kedward --- test/fpm_test/test_filesystem.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/test/fpm_test/test_filesystem.f90 b/test/fpm_test/test_filesystem.f90 index e7849566f2..404db5567a 100644 --- a/test/fpm_test/test_filesystem.f90 +++ b/test/fpm_test/test_filesystem.f90 @@ -140,6 +140,7 @@ subroutine check_mkdir(error, path) if (is_dir(path)) then call test_failed(error, & "Directory path "//path//" already exists before its creation") + return end if ! Create directory From fba9dfb120d3f8a10acc56f0e390366ad5dec028 Mon Sep 17 00:00:00 2001 From: Andre Smit Date: Wed, 20 Apr 2022 09:42:56 -0500 Subject: [PATCH 18/19] Update test/fpm_test/test_filesystem.f90 Co-authored-by: Laurence Kedward --- test/fpm_test/test_filesystem.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/test/fpm_test/test_filesystem.f90 b/test/fpm_test/test_filesystem.f90 index 404db5567a..1ce1b6e4c4 100644 --- a/test/fpm_test/test_filesystem.f90 +++ b/test/fpm_test/test_filesystem.f90 @@ -168,6 +168,7 @@ subroutine check_rmdir(error, path) if (.not. is_dir(path)) then call test_failed(error, & "Directory path "//path//" doesn't exist before its deletion") + return end if ! Delete directory From c5b95d5cbc8056bc05cc17eb53445ea128ffe930 Mon Sep 17 00:00:00 2001 From: Andre Smit Date: Wed, 20 Apr 2022 10:08:24 -0500 Subject: [PATCH 19/19] resolve missing module functions --- src/fpm.f90 | 3 ++- test/fpm_test/test_filesystem.f90 | 11 ++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/fpm.f90 b/src/fpm.f90 index 7e9d125fa6..932eae2fc7 100644 --- a/src/fpm.f90 +++ b/src/fpm.f90 @@ -1,5 +1,6 @@ module fpm -use fpm_strings, only: string_t, operator(.in.), glob, join, string_cat, fnv_1a, lower +use fpm_strings, only: string_t, operator(.in.), glob, join, string_cat, fnv_1a, & + lower, str_ends_with use fpm_backend, only: build_package use fpm_command_line, only: fpm_build_settings, fpm_new_settings, & fpm_run_settings, fpm_install_settings, fpm_test_settings, & diff --git a/test/fpm_test/test_filesystem.f90 b/test/fpm_test/test_filesystem.f90 index 1ce1b6e4c4..b6b7681706 100644 --- a/test/fpm_test/test_filesystem.f90 +++ b/test/fpm_test/test_filesystem.f90 @@ -1,6 +1,7 @@ module test_filesystem use testsuite, only : new_unittest, unittest_t, error_t, test_failed - use fpm_filesystem, only: canon_path, is_dir, mkdir, os_delete_dir + use fpm_filesystem, only: canon_path, is_dir, mkdir, os_delete_dir, & + join_path use fpm_environment, only: OS_WINDOWS, get_os_type, os_is_unix implicit none private @@ -110,17 +111,9 @@ subroutine test_mkdir_rmdir(error) !> Error handling type(error_t), allocatable, intent(out) :: error - call check_mkdir(error, join_path("tmpdir","subdir")) if (allocated(error)) return - if (is_win) then - call check_rmdir(error, "tmpdir\subdir") - else - call check_rmdir(error, "tmpdir/subdir") - end if - if (allocated(error)) return - call check_rmdir(error, "tmpdir") if (allocated(error)) return