aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpm/src/fpm_command_line.f905
-rw-r--r--fpm/src/fpm_filesystem.f9013
-rw-r--r--fpm/src/fpm_source_parsing.f904
-rw-r--r--fpm/test/new_test/new_test.f905
4 files changed, 19 insertions, 8 deletions
diff --git a/fpm/src/fpm_command_line.f90 b/fpm/src/fpm_command_line.f90
index cfa6cb9..0217154 100644
--- a/fpm/src/fpm_command_line.f90
+++ b/fpm/src/fpm_command_line.f90
@@ -857,9 +857,8 @@ contains
' ', &
'OPTIONS ', &
' NAME the name of the project directory to create. The name ', &
- ' must be a valid Fortran name composed of 1 to 63 ', &
- ' ASCII alphanumeric characters and underscores, ', &
- ' starting with a letter. ', &
+ ' must be made of up to 63 ASCII letters, digits, underscores, ', &
+ ' or hyphens, and start with a letter. ', &
' ', &
' The default is to create the src/, app/, and test/ directories. ', &
' If any of the following options are specified then only the ', &
diff --git a/fpm/src/fpm_filesystem.f90 b/fpm/src/fpm_filesystem.f90
index 5811cd4..ea3d9d3 100644
--- a/fpm/src/fpm_filesystem.f90
+++ b/fpm/src/fpm_filesystem.f90
@@ -8,7 +8,7 @@ use,intrinsic :: iso_fortran_env, only : stdin=>input_unit, stdout=>output_unit,
private
public :: basename, canon_path, dirname, is_dir, join_path, number_of_rows, read_lines, list_files, env_variable, &
mkdir, exists, get_temp_filename, windows_path, unix_path, getline, delete_file, to_fortran_name
- public :: fileopen, fileclose, filewrite, warnwrite
+ public :: fileopen, fileclose, filewrite, warn
integer, parameter :: LINE_BUFFER_LEN = 1000
@@ -570,4 +570,15 @@ pure function to_fortran_name(string) result(res)
res = replace(string, SPECIAL_CHARACTERS, '_')
end function to_fortran_name
+pure function to_fortran_name(string) result(res)
+ ! Returns string with special characters replaced with an underscore.
+ ! For now, only a hyphen is treated as a special character, but this can be
+ ! expanded to other characters if needed.
+ character(*), intent(in) :: string
+ character(len(string)) :: res
+ character, parameter :: SPECIAL_CHARACTERS(*) = ['-']
+ res = replace(string, SPECIAL_CHARACTERS, '_')
+end function to_fortran_name
+
+
end module fpm_filesystem
diff --git a/fpm/src/fpm_source_parsing.f90 b/fpm/src/fpm_source_parsing.f90
index fc0b629..76cb560 100644
--- a/fpm/src/fpm_source_parsing.f90
+++ b/fpm/src/fpm_source_parsing.f90
@@ -87,7 +87,7 @@ function parse_f_source(f_filename,error) result(f_source)
close(fh)
! Ignore empty files, returned as FPM_UNIT_UNKNOW
- if (len_trim(string_cat(file_lines,' ')) < 1) return
+ if (len_trim(file_lines) < 1) return
f_source%digest = fnv_1a(file_lines)
@@ -392,7 +392,7 @@ function parse_c_source(c_filename,error) result(c_source)
close(fh)
! Ignore empty files, returned as FPM_UNIT_UNKNOW
- if (len_trim(string_cat(file_lines,' ')) < 1) then
+ if (len_trim(file_lines) < 1) then
c_source%unit_type = FPM_UNIT_UNKNOWN
return
end if
diff --git a/fpm/test/new_test/new_test.f90 b/fpm/test/new_test/new_test.f90
index c284002..4ff00c3 100644
--- a/fpm/test/new_test/new_test.f90
+++ b/fpm/test/new_test/new_test.f90
@@ -78,10 +78,11 @@ logical :: IS_OS_WINDOWS
if( is_dir('name-with-hyphens') ) then
tally=[tally,.true.]
- else
+
+ else
write(*,*)'ERROR: directory name-with-hyphens/ exists'
tally=[tally,.false.]
- endif
+ endif
! assuming hidden files in .git and .gitignore are ignored for now
TESTS: do i=1,size(directories)