Skip to content

Commit b2ae7db

Browse files
authored
Merge branch 'master' into update_new
2 parents 712d5ed + a16e812 commit b2ae7db

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

fpm/src/fpm_command_line.f90

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -857,9 +857,8 @@ subroutine set_help()
857857
' ', &
858858
'OPTIONS ', &
859859
' NAME the name of the project directory to create. The name ', &
860-
' must be a valid Fortran name composed of 1 to 63 ', &
861-
' ASCII alphanumeric characters and underscores, ', &
862-
' starting with a letter. ', &
860+
' must be made of up to 63 ASCII letters, digits, underscores, ', &
861+
' or hyphens, and start with a letter. ', &
863862
' ', &
864863
' The default is to create the src/, app/, and test/ directories. ', &
865864
' If any of the following options are specified then only the ', &

fpm/src/fpm_filesystem.f90

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module fpm_filesystem
88
private
99
public :: basename, canon_path, dirname, is_dir, join_path, number_of_rows, read_lines, list_files, env_variable, &
1010
mkdir, exists, get_temp_filename, windows_path, unix_path, getline, delete_file, to_fortran_name
11-
public :: fileopen, fileclose, filewrite, warnwrite
11+
public :: fileopen, fileclose, filewrite, warn
1212

1313
integer, parameter :: LINE_BUFFER_LEN = 1000
1414

@@ -570,4 +570,15 @@ pure function to_fortran_name(string) result(res)
570570
res = replace(string, SPECIAL_CHARACTERS, '_')
571571
end function to_fortran_name
572572

573+
pure function to_fortran_name(string) result(res)
574+
! Returns string with special characters replaced with an underscore.
575+
! For now, only a hyphen is treated as a special character, but this can be
576+
! expanded to other characters if needed.
577+
character(*), intent(in) :: string
578+
character(len(string)) :: res
579+
character, parameter :: SPECIAL_CHARACTERS(*) = ['-']
580+
res = replace(string, SPECIAL_CHARACTERS, '_')
581+
end function to_fortran_name
582+
583+
573584
end module fpm_filesystem

fpm/src/fpm_source_parsing.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function parse_f_source(f_filename,error) result(f_source)
8787
close(fh)
8888

8989
! Ignore empty files, returned as FPM_UNIT_UNKNOW
90-
if (len_trim(string_cat(file_lines,' ')) < 1) return
90+
if (len_trim(file_lines) < 1) return
9191

9292
f_source%digest = fnv_1a(file_lines)
9393

@@ -392,7 +392,7 @@ function parse_c_source(c_filename,error) result(c_source)
392392
close(fh)
393393

394394
! Ignore empty files, returned as FPM_UNIT_UNKNOW
395-
if (len_trim(string_cat(file_lines,' ')) < 1) then
395+
if (len_trim(file_lines) < 1) then
396396
c_source%unit_type = FPM_UNIT_UNKNOWN
397397
return
398398
end if

fpm/test/new_test/new_test.f90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ program new_test
7878

7979
if( is_dir('name-with-hyphens') ) then
8080
tally=[tally,.true.]
81-
else
81+
82+
else
8283
write(*,*)'ERROR: directory name-with-hyphens/ exists'
8384
tally=[tally,.false.]
84-
endif
85+
endif
8586

8687
! assuming hidden files in .git and .gitignore are ignored for now
8788
TESTS: do i=1,size(directories)

0 commit comments

Comments
 (0)